34 #if(defined _MSC_VER && _MSC_VER > 1500)
35 # include <unordered_map>
36 # include <unordered_set>
37 # define TLP_HASH_MAP std::unordered_map
38 # define TLP_HASH_SET std::unordered_set
39 # define TLP_BEGIN_HASH_NAMESPACE namespace std
40 # define TLP_END_HASH_NAMESPACE
42 #elif (! defined _MSC_VER && (__GNUC__ < 4 || __GNUC_MINOR__ < 1))
43 # include <tulip/tulipconf.h>
48 # include <ext/hash_map>
49 # include <ext/hash_set>
51 # define TLP_HASH_MAP stdext::hash_map
52 # define TLP_HASH_SET stdext::hash_set
53 # define TLP_BEGIN_HASH_NAMESPACE namespace stdext
54 # define TLP_END_HASH_NAMESPACE
59 template<>
struct hash<const std::string> {
60 size_t operator()(
const std::string &s)
const {
61 return hash<const char *>()(s.c_str());
64 template<>
struct hash<std::string> {
65 size_t operator()(
const std::string &s)
const {
66 return hash<const char *>()(s.c_str());
71 size_t operator()(
const double s)
const {
77 size_t operator()(
const float s)
const {
78 return hash<unsigned int>()(*((
unsigned int *) &s));
84 # include <tr1/unordered_map>
85 # include <tr1/unordered_set>
86 # define TLP_HASH_MAP std::tr1::unordered_map
87 # define TLP_HASH_SET std::tr1::unordered_set
88 # define TLP_BEGIN_HASH_NAMESPACE namespace std { namespace tr1
89 # define TLP_END_HASH_NAMESPACE }
101 TLP_BEGIN_HASH_NAMESPACE {
103 inline void hash_combine(std::size_t & seed,
const T & v) {
105 seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
107 } TLP_END_HASH_NAMESPACE