[Scummvm-cvs-logs] SF.net SVN: scummvm: [25136] scummvm/trunk/common/hashmap.h
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jan 21 01:11:46 CET 2007
Revision: 25136
http://scummvm.svn.sourceforge.net/scummvm/?rev=25136&view=rev
Author: fingolfin
Date: 2007-01-20 16:11:45 -0800 (Sat, 20 Jan 2007)
Log Message:
-----------
Added non-const variant of HashMap::getVal
Modified Paths:
--------------
scummvm/trunk/common/hashmap.h
Modified: scummvm/trunk/common/hashmap.h
===================================================================
--- scummvm/trunk/common/hashmap.h 2007-01-21 00:06:50 UTC (rev 25135)
+++ scummvm/trunk/common/hashmap.h 2007-01-21 00:11:45 UTC (rev 25136)
@@ -166,6 +166,7 @@
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 @@
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 @@
}
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list