99* Multi Theft Auto is available from http://www.multitheftauto.com/
1010*
1111*****************************************************************************/
12+ #pragma once
1213
1314#if WITH_ALLOC_TRACKING
1415 #define CHashMap CMap
1516#else
1617
17- #if defined(WIN32)
18- #include < hash_map>
19- #define HASH_MAP_TYPE stdext::hash_map
20- #elif defined(__GNUC__) && (__GNUC__ >= 3)
21- #include < ext/hash_map>
22- #define HASH_MAP_TYPE __gnu_cxx::hash_map
23- #endif
24-
18+ #include < unordered_map>
2519#include < functional>
2620
2721namespace SharedUtil
@@ -32,7 +26,7 @@ namespace SharedUtil
3226 // Using hash_map
3327 //
3428 template < class K , class V >
35- class CHashMap : public HASH_MAP_TYPE < K, V >
29+ class CHashMap : public std ::unordered_map < K, V >
3630 {
3731 public:
3832 };
@@ -110,23 +104,19 @@ namespace SharedUtil
110104
111105
112106// Calculate a hash value for SString
113- #if defined(WIN32)
114- inline size_t hash_value ( const SString& strString )
107+ template <>
108+ struct std ::hash<SString>
109+ {
110+ size_t operator ()(const SString& str) const
111+ {
112+ return std::hash<std::string>()(str);
113+ }
114+ };
115+
116+ inline size_t hash_value ( const SString& strString ) // Required for sparsehash
115117{
116118 std::hash<std::string> hashFunction;
117119 return hashFunction ( strString );
118120}
119- #elif defined(__GNUC__) && (__GNUC__ >= 3)
120- namespace __gnu_cxx
121- {
122- template <>
123- struct hash < SString >
124- {
125- size_t operator () ( const SString& strString ) const
126- {
127- return __stl_hash_string ( strString );
128- }
129- };
130- }
131- #endif
121+
132122#endif // WITH_ALLOC_TRACKING
0 commit comments