#include <pair_comparator.hh>
Public Types | |
| typedef ComparatorFirst< typename T::pointee_type::first_type > | comparator_first |
| typedef ComparatorSecond< typename T::pointee_type::second_type > | comparator_second |
Public Member Functions | |
| bool | operator() (const T &a, const T &b) const |
| compares lexicographically a pair | |
Definition at line 56 of file pair_comparator.hh.
| typedef ComparatorFirst< typename T::pointee_type::first_type > lestes::std::pair_comparator< T, ComparatorFirst, ComparatorSecond >::comparator_first |
Definition at line 63 of file pair_comparator.hh.
| typedef ComparatorSecond< typename T::pointee_type::second_type > lestes::std::pair_comparator< T, ComparatorFirst, ComparatorSecond >::comparator_second |
Definition at line 64 of file pair_comparator.hh.
| bool lestes::std::pair_comparator< T, ComparatorFirst, ComparatorSecond >::operator() | ( | const T & | a, | |
| const T & | b | |||
| ) | const [inline] |
compares lexicographically a pair
The inner workings determine the ordering by examining first the first part of the pair. If the first pair's first element is strictly less (where less is the relation of ComparatorFirst) than the second's, the whole first pair is less (the relation imposed by this comparator) than the second. If however the second's first is less than the first's, the first pair is not less than second. In the remaining case, i.e. neither first's first nor second's first is less than the other, the relation on the pair is determined solely by ComparatorSecond on the seconds of both pairs.
Definition at line 81 of file pair_comparator.hh.
00082 { 00083 comparator_first ftc; 00084 bool ab = ftc(a->first, b->first); 00085 if (ab) 00086 return true; 00087 bool ba = ftc(b->first, a->first); 00088 if (ba) 00089 return false; 00090 comparator_second stc; 00091 return stc(a->second, b->second); 00092 }
1.5.1-20070107