aboutsummaryrefslogtreecommitdiffstats
path: root/include/multimapwdef.h
diff options
context:
space:
mode:
authordanglassey <danglassey>2002-08-17 13:01:04 +0000
committerdanglassey <danglassey>2002-08-17 13:01:04 +0000
commit8c4b02a3cf294b2126d0f36269c26c104d9d9a74 (patch)
treeaa74bce9b5c11e714c946c7426345b3dea7b6a9c /include/multimapwdef.h
parentb8824a0bcb09873654d8c203a1eba913f1615b2a (diff)
downloadsword-sf-cvs-8c4b02a3cf294b2126d0f36269c26c104d9d9a74.tar.gz
sync with crosswire 20020817-1300
Diffstat (limited to 'include/multimapwdef.h')
-rw-r--r--include/multimapwdef.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/multimapwdef.h b/include/multimapwdef.h
index fbab567..d3f8f90 100644
--- a/include/multimapwdef.h
+++ b/include/multimapwdef.h
@@ -11,6 +11,13 @@ template <class Key, class T, class Compare>
class multimapwithdefault : public multimap<Key, T, Compare> {
public:
typedef pair<const Key, T> value_type;
+ T& getWithDefault(const Key& k, const T& defaultValue) {
+ if (find(k) == end()) {
+ insert(value_type(k, defaultValue));
+ }
+ return (*(find(k))).second;
+ }
+
T& operator[](const Key& k) {
if (find(k) == end()) {
insert(value_type(k, T()));