diff options
author | Tim King <taking@cs.nyu.edu> | 2017-07-20 17:04:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 17:04:30 -0700 |
commit | 8b0659e6cd342ae40b676781b5e819d5fd2b3af7 (patch) | |
tree | 5ac55f64d115b3e8865ce8f691f38da65fc82a94 /src/context | |
parent | 6d82ee2d1f84065ff4a86f688a3b671b85728f80 (diff) |
Moving from the gnu extensions for hash maps to the c++11 hash maps
* Replacing __gnu_cxx::hash_map with std::unordered_map.
* Replacing __gnu_cxx::hash_set with std::unordered_set.
* Replacing __gnu_cxx::hash with std::hash.
* Adding missing includes.
Diffstat (limited to 'src/context')
-rw-r--r-- | src/context/cdhashmap.h | 9 | ||||
-rw-r--r-- | src/context/cdhashmap_forward.h | 7 | ||||
-rw-r--r-- | src/context/cdinsert_hashmap.h | 7 | ||||
-rw-r--r-- | src/context/cdtrail_hashmap.h | 7 | ||||
-rw-r--r-- | src/context/cdtrail_hashmap_forward.h | 7 |
5 files changed, 18 insertions, 19 deletions
diff --git a/src/context/cdhashmap.h b/src/context/cdhashmap.h index 575bde120..b6024b65d 100644 --- a/src/context/cdhashmap.h +++ b/src/context/cdhashmap.h @@ -15,7 +15,7 @@ ** which must be saved and restored as contexts are pushed and ** popped. Requires that operator= be defined for the data class, ** and operator== for the key class. For key types that don't have a - ** __gnu_cxx::hash<>, you should provide an explicit HashFcn. + ** std::hash<>, you should provide an explicit HashFcn. ** ** See also: ** CDInsertHashMap : An "insert-once" CD hash map. @@ -82,8 +82,9 @@ #ifndef __CVC4__CONTEXT__CDHASHMAP_H #define __CVC4__CONTEXT__CDHASHMAP_H -#include <ext/hash_map> +#include <functional> #include <iterator> +#include <unordered_map> #include <vector> #include "base/cvc4_assert.h" @@ -95,7 +96,7 @@ namespace context { // Auxiliary class: almost the same as CDO (see cdo.h) -template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > +template <class Key, class Data, class HashFcn = std::hash<Key> > class CDOhash_map : public ContextObj { friend class CDHashMap<Key, Data, HashFcn>; @@ -268,7 +269,7 @@ template <class Key, class Data, class HashFcn> class CDHashMap : public ContextObj { typedef CDOhash_map<Key, Data, HashFcn> Element; - typedef __gnu_cxx::hash_map<Key, Element*, HashFcn> table_type; + typedef std::unordered_map<Key, Element*, HashFcn> table_type; friend class CDOhash_map<Key, Data, HashFcn>; diff --git a/src/context/cdhashmap_forward.h b/src/context/cdhashmap_forward.h index e099f612e..a8fbc5ee2 100644 --- a/src/context/cdhashmap_forward.h +++ b/src/context/cdhashmap_forward.h @@ -26,15 +26,14 @@ #ifndef __CVC4__CONTEXT__CDHASHMAP_FORWARD_H #define __CVC4__CONTEXT__CDHASHMAP_FORWARD_H +#include <functional> + /// \cond internals -namespace __gnu_cxx { - template <class Key> struct hash; -}/* __gnu_cxx namespace */ namespace CVC4 { namespace context { - template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > + template <class Key, class Data, class HashFcn = std::hash<Key> > class CDHashMap; }/* CVC4::context namespace */ }/* CVC4 namespace */ diff --git a/src/context/cdinsert_hashmap.h b/src/context/cdinsert_hashmap.h index ef8f661fa..db679c1f7 100644 --- a/src/context/cdinsert_hashmap.h +++ b/src/context/cdinsert_hashmap.h @@ -34,7 +34,8 @@ #include "cvc4_private.h" #include <deque> -#include <ext/hash_map> +#include <functional> +#include <unordered_map> #include <utility> #include "base/cvc4_assert.h" @@ -50,14 +51,14 @@ namespace CVC4 { namespace context { -template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > +template <class Key, class Data, class HashFcn = std::hash<Key> > class InsertHashMap { private: typedef std::deque<Key> KeyVec; /** A list of the keys in the map maintained as a stack. */ KeyVec d_keys; - typedef __gnu_cxx::hash_map<Key, Data, HashFcn> HashMap; + typedef std::unordered_map<Key, Data, HashFcn> HashMap; /** The hash_map used for element lookup. */ HashMap d_hashMap; diff --git a/src/context/cdtrail_hashmap.h b/src/context/cdtrail_hashmap.h index 0d265271d..e64c51c65 100644 --- a/src/context/cdtrail_hashmap.h +++ b/src/context/cdtrail_hashmap.h @@ -44,8 +44,9 @@ #pragma once -#include <ext/hash_map> #include <deque> +#include <functional> +#include <unordered_map> #include <utility> #include "base/cvc4_assert.h" @@ -58,7 +59,7 @@ namespace CVC4 { namespace context { -template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > +template <class Key, class Data, class HashFcn = std::hash<Key> > class TrailHashMap { public: /** A pair of Key and Data that mirrors hash_map::value_type. */ @@ -92,7 +93,7 @@ private: KDTVec d_kdts; - typedef __gnu_cxx::hash_map<Key, size_t, HashFcn> PositionMap; + typedef std::unordered_map<Key, size_t, HashFcn> PositionMap; typedef typename PositionMap::iterator PM_iterator; typedef typename PositionMap::const_iterator PM_const_iterator; diff --git a/src/context/cdtrail_hashmap_forward.h b/src/context/cdtrail_hashmap_forward.h index b2beb83bc..970f2758c 100644 --- a/src/context/cdtrail_hashmap_forward.h +++ b/src/context/cdtrail_hashmap_forward.h @@ -25,14 +25,11 @@ #pragma once -namespace __gnu_cxx { - template <class Key> struct hash; -}/* __gnu_cxx namespace */ +#include <functional> namespace CVC4 { namespace context { - template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > + template <class Key, class Data, class HashFcn = std::hash<Key> > class CDTrailHashMap; }/* CVC4::context namespace */ }/* CVC4 namespace */ - |