22 #ifndef SPOT_MISC_HASH_HH
23 # define SPOT_MISC_HASH_HH
26 # include <functional>
27 # include "misc/hashfunc.hh"
28 # include "misc/_config.h"
30 #ifdef SPOT_HAVE_UNORDERED_MAP
31 # include <unordered_map>
32 # include <unordered_set>
34 # define hash_map unordered_map
35 # define hash_multimap unordered_multimap
36 # define hash_set unordered_set
38 #ifdef SPOT_HAVE_TR1_UNORDERED_MAP
39 # include <tr1/unordered_map>
40 # include <tr1/unordered_set>
41 namespace Sgi = std::tr1;
42 # define hash_map unordered_map
43 # define hash_multimap unordered_multimap
44 # define hash_set unordered_set
46 #ifdef SPOT_HAVE_EXT_HASH_MAP
47 # include <ext/hash_map>
48 # include <ext/hash_set>
49 # if __GNUC__ == 3 && __GNUC_MINOR__ == 0
52 namespace Sgi = ::__gnu_cxx;
55 # if defined(__GNUC__) && (__GNUC__ < 3)
56 # include <hash_map.h>
57 # include <hash_set.h>
61 using ::hash_multimap;
81 public std::unary_function<const T*, size_t>
83 size_t operator()(
const T* p)
const
86 - static_cast<const char*>(0));
93 #if defined(SPOT_HAVE_UNORDERED_MAP) || defined(SPOT_HAVE_TR1_UNORDERED_MAP)
95 #else // e.g. GCC < 4.3
97 public Sgi::hash<const char*>,
98 public std::unary_function<const std::string&, size_t>
100 size_t operator()(
const std::string& s)
const
104 return Sgi::hash<const char*>::operator()(s.c_str());
114 public std::unary_function<const T&, size_t>
116 size_t operator()(
const T& s)
const
123 #endif // SPOT_MISC_HASH_HH
Sgi::hash< std::string > string_hash
A hash function for strings.
Definition: hash.hh:94
A hash function for pointers.
Definition: hash.hh:80
size_t knuth32_hash(size_t key)
Knuth's Multiplicative hash function.
Definition: hashfunc.hh:54
A hash function that returns identity.
Definition: hash.hh:113