diff options
author | danglassey <danglassey> | 2002-08-17 13:01:04 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-08-17 13:01:04 +0000 |
commit | 8c4b02a3cf294b2126d0f36269c26c104d9d9a74 (patch) | |
tree | aa74bce9b5c11e714c946c7426345b3dea7b6a9c /include/multimapwdef.h | |
parent | b8824a0bcb09873654d8c203a1eba913f1615b2a (diff) | |
download | sword-sf-cvs-8c4b02a3cf294b2126d0f36269c26c104d9d9a74.tar.gz |
sync with crosswire 20020817-1300
Diffstat (limited to 'include/multimapwdef.h')
-rw-r--r-- | include/multimapwdef.h | 7 |
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())); |