diff options
author | Tim King <taking@cs.nyu.edu> | 2018-07-26 13:55:53 -0700 |
---|---|---|
committer | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2018-07-26 15:55:53 -0500 |
commit | 21e1d582ecbb92f62f4a23a338b0455b2ebe5538 (patch) | |
tree | dd42228ae4bd6401bfc553f20c5586f396f70952 | |
parent | fc913810a1ef8269d4f75f492631ec8d7f5dcab9 (diff) |
Changing CDInsertHashMap to store <const Key, const Data> pairs. This is in preparation for adding map utility functions. (#2209)
-rw-r--r-- | src/context/cdinsert_hashmap.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/context/cdinsert_hashmap.h b/src/context/cdinsert_hashmap.h index 009fed99a..62268b471 100644 --- a/src/context/cdinsert_hashmap.h +++ b/src/context/cdinsert_hashmap.h @@ -54,11 +54,11 @@ namespace context { template <class Key, class Data, class HashFcn = std::hash<Key> > class InsertHashMap { private: - typedef std::deque<Key> KeyVec; + using KeyVec = std::deque<Key>; /** A list of the keys in the map maintained as a stack. */ KeyVec d_keys; - typedef std::unordered_map<Key, Data, HashFcn> HashMap; + using HashMap = std::unordered_map<const Key, const Data, HashFcn>; /** The hash_map used for element lookup. */ HashMap d_hashMap; @@ -73,6 +73,8 @@ public: /**An iterator over the elements in the hash_map. */ typedef typename HashMap::const_iterator const_iterator; + // The type of the <Key, Data> values in the hashmap. + using value_type = typename HashMap::value_type; /** * Returns an iterator to the begining of the HashMap. @@ -289,6 +291,9 @@ public: */ typedef typename IHM::key_iterator key_iterator; + // The type of the <key, data> values in the hashmap. + using value_type = typename IHM::value_type; + /** Returns true if the map is empty in the current context. */ bool empty() const{ return d_size == 0; |