summaryrefslogtreecommitdiff
path: root/utils/hash.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@Chriss-MacBook-Air.local>2013-11-10 00:58:44 -0500
committerChris Dyer <cdyer@Chriss-MacBook-Air.local>2013-11-10 00:58:44 -0500
commitd9cc1a6986188a97e09e4c8cef46c34eee5f9cd2 (patch)
tree662e45620fcf5b27f6a6edb5a5c105a0514e51cd /utils/hash.h
parentdb0dcd780abea416cfdb2b2382152dbe11c35170 (diff)
guard against direct includes of tr1
Diffstat (limited to 'utils/hash.h')
-rw-r--r--utils/hash.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/hash.h b/utils/hash.h
index 189ed1ae..e56fca06 100644
--- a/utils/hash.h
+++ b/utils/hash.h
@@ -20,11 +20,17 @@
# define HASH_MAP_RESERVED(h,empty,deleted) do { (h).set_empty_key(empty); (h).set_deleted_key(deleted); } while(0)
# define HASH_MAP_EMPTY(h,empty) do { (h).set_empty_key(empty); } while(0)
#else
+#ifdef HAVE_CXX11
+# include <unordered_map>
+# include <unordered_set>
+#else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
-# define SPARSE_HASH_MAP std::tr1::unordered_map
-# define HASH_MAP std::tr1::unordered_map
-# define HASH_SET std::tr1::unordered_set
+namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; }
+#endif
+# define SPARSE_HASH_MAP std::unordered_map
+# define HASH_MAP std::unordered_map
+# define HASH_SET std::unordered_set
# define HASH_MAP_DELETED(h,deleted)
# define HASH_MAP_RESERVED(h,empty,deleted)
# define HASH_MAP_EMPTY(h,empty)