#include <Comparable.hpp>
// Let's use long as keys Comparable<long> a(0), b(1); if (a.Compare(b) == Comparable::Equal) // Values are equal printf("Equal!\n"); else if (a.Compare(b) == Comparable::Less) // In this example, we should get here as a is less than b printf("Less!\n"); else printf("Greater!\n");
Public Types | |
typedef CompareType | Result |
Public Member Functions | |
Comparable (KeyType _key) | |
No default constructor, must provide a key. | |
Result | Compare (const KeyType &_key) const |
Compare this item against the given key. | |
KeyType | Key () const |
Return the key in this comparator. |
typedef CompareType Comparator::Comparable< KeyType, Policy >::Result |
Comparator::Comparable< KeyType, Policy >::Comparable | ( | KeyType | _key | ) | [inline] |
No default constructor, must provide a key.
Result Comparator::Comparable< KeyType, Policy >::Compare | ( | const KeyType & | _key | ) | const [inline] |
Compare this item against the given key.
KeyType Comparator::Comparable< KeyType, Policy >::Key | ( | ) | const [inline] |
Return the key in this comparator.