15 #ifndef STL_COMPARES_H
16 #define STL_COMPARES_H
18 #include "dtoolbase.h"
20 #include "nearly_zero.h"
28 template<
class Key,
class Compare = less<Key> >
31 INLINE
bool is_equal(
const Key &a,
const Key &b)
const {
32 return !operator()(a, b) && !operator()(b, a);
42 template<
class Key,
class Compare = less<Key> >
45 INLINE
size_t operator () (
const Key &key)
const {
48 INLINE
bool operator () (
const Key &a,
const Key &b)
const {
49 return Compare::operator ()(a, b);
51 INLINE
bool is_equal(
const Key &a,
const Key &b)
const {
52 return !operator()(a, b) && !operator()(b, a);
56 #endif // HAVE_STL_HASH
67 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
81 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
82 INLINE
bool is_equal(
const Key &a,
const Key &b)
const;
95 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
108 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
109 INLINE
bool is_equal(
const Key &a,
const Key &b)
const;
124 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
125 INLINE
bool is_equal(
const Key &a,
const Key &b)
const;
136 template<
class Key,
class Compare = less<Key> >
139 INLINE
static size_t add_hash(
size_t start,
const Key &key);
150 INLINE
static size_t add_hash(
size_t start,
const void *key);
162 INLINE
bool operator () (
const Key &a,
const Key &b)
const;
163 INLINE
size_t add_hash(
size_t start,
const Key &key)
const;
164 const Key _threshold;
173 template<
class Key,
class Compare = less<Key> >
177 INLINE
bool operator () (
const Key &a,
const Key &b)
const {
180 INLINE
static size_t add_hash(
size_t start,
const Key &key);
189 template<
class Key,
class Compare = less<Key> >
193 INLINE
bool operator () (
const Key &a,
const Key &b)
const {
205 template<
class Key,
class Compare>
209 INLINE
bool operator () (
const Key &a,
const Key &b)
const {
228 INLINE
bool is_equal(
const Key &a,
const Key &b)
const;
231 #include "stl_compares.I"
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
This hash_compare class hashes a class object.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
size_t operator()(const Key &key) const
Computes a size_t hash from the float.
This hash_compare class hashes a string.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
This hash_compare class hashes a float or a double.
size_t operator()(const Key &key) const
Trivially computes a size_t hash from the components of the string.
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
This hash_compare class hashes a pointer to a class object.
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equal to b, false otherwise.
This is the default hash_compare class, which assumes the Key is a size_t value or can be implicitly ...
size_t operator()(const Key &key) const
Calls the Key's get_hash() method.
This is the default hash_compare class, which assumes the Key is a pointer value. ...
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
Compares two floating point numbers, within threshold of equivalence.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
bool is_equal(const Key &a, const Key &b) const
Returns true if a is equivalent to b, false otherwise.
An STL function object class, this is intended to be used on any ordered collection of pointers to cl...
bool operator()(const Key &a, const Key &b) const
Returns true if a sorts before b, false otherwise.
static size_t add_hash(size_t start, const Key &key)
Adds the elements of the indicated key into a running hash.