blob: ff0404e8c66b60deb7ef0822e7d87012f560da52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
$NetBSD: patch-src_hash__map.hh,v 1.2 2014/05/06 08:21:15 wiz Exp $
Add missing include. Use C++11 STL for libc++ and when in C++11 mode.
--- src/hash_map.hh.orig 2013-05-06 13:12:19.000000000 +0000
+++ src/hash_map.hh
@@ -50,7 +50,43 @@ namespace hashmap {
};
}
-#if HAVE_TR1_UNORDERED_MAP_AND_SET && HAVE_WORKING_TR1_UNORDERED_MAP_AND_SET
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#define HASHMAP_PRESENT
+#include <unordered_map>
+#include <unordered_set>
+
+namespace hashmap {
+ template<>
+ struct hash<std::string>
+ {
+ size_t operator()(std::string const & s) const
+ {
+ return std::hash<std::string>()(s);
+ }
+ };
+
+ template<typename _Key, typename _Value>
+ class hash_map : public std::unordered_map<_Key,
+ _Value,
+ hash<_Key>,
+ equal_to<_Key> >
+ {};
+
+ template<typename _Key>
+ class hash_set : public std::unordered_set<_Key,
+ hash<_Key>,
+ equal_to<_Key> >
+ {};
+
+ template<typename _Key, typename _Value>
+ class hash_multimap : public std::unordered_multimap<_Key,
+ _Value,
+ hash<_Key>,
+ equal_to<_Key> >
+ {};
+}
+
+#elif HAVE_TR1_UNORDERED_MAP_AND_SET && HAVE_WORKING_TR1_UNORDERED_MAP_AND_SET
#define HASHMAP_PRESENT
#include <tr1/functional>
#include <tr1/unordered_map>
|