diff options
author | Max Horn | 2007-01-21 00:11:45 +0000 |
---|---|---|
committer | Max Horn | 2007-01-21 00:11:45 +0000 |
commit | 0c148fc44e25516a06481ff62ba2c48428b48192 (patch) | |
tree | 10e853b292b17b07faa3d5238fc0bc2d08069aa6 | |
parent | 12476efb587097abb04657a1d601564718e99c97 (diff) | |
download | scummvm-rg350-0c148fc44e25516a06481ff62ba2c48428b48192.tar.gz scummvm-rg350-0c148fc44e25516a06481ff62ba2c48428b48192.tar.bz2 scummvm-rg350-0c148fc44e25516a06481ff62ba2c48428b48192.zip |
Added non-const variant of HashMap::getVal
svn-id: r25136
-rw-r--r-- | common/hashmap.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/common/hashmap.h b/common/hashmap.h index c859239606..b13ca79980 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -166,6 +166,7 @@ public: Val &operator [](const Key &key); const Val &operator [](const Key &key) const; + Val &getVal(const Key &key); const Val &getVal(const Key &key) const; void setVal(const Key &key, const Val &val); @@ -381,9 +382,7 @@ bool HashMap<Key, Val, HashFunc, EqualFunc>::contains(const Key &key) const { template <class Key, class Val, class HashFunc, class EqualFunc> Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator [](const Key &key) { - uint ctr = lookupAndCreateIfMissing(key); - assert(_arr[ctr] != NULL); - return _arr[ctr]->_value; + return getVal(key); } template <class Key, class Val, class HashFunc, class EqualFunc> @@ -392,6 +391,13 @@ const Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator [](const Key &key) c } template <class Key, class Val, class HashFunc, class EqualFunc> +Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) { + uint ctr = lookupAndCreateIfMissing(key); + assert(_arr[ctr] != NULL); + return _arr[ctr]->_value; +} + +template <class Key, class Val, class HashFunc, class EqualFunc> const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) const { uint ctr = lookup(key); assert(_arr[ctr] != NULL); |