about summary refs log tree commit diff stats
path: root/subx/001help.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-13 23:55:07 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-13 23:55:07 -0700
commit06d9b1a5417dedf3fe256fcccbae852e4bdd125c (patch)
tree623794b234a23f04f6ec2040635a5135c88f83bc /subx/001help.cc
parentdc559a00c7592469e716a2baee963987fb34d4a9 (diff)
downloadmu-06d9b1a5417dedf3fe256fcccbae852e4bdd125c.tar.gz
4694
Check for duplicate docstrings.
Diffstat (limited to 'subx/001help.cc')
-rw-r--r--subx/001help.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/subx/001help.cc b/subx/001help.cc
index 64f02274..5f90abca 100644
--- a/subx/001help.cc
+++ b/subx/001help.cc
@@ -250,6 +250,11 @@ template<typename T> bool contains_key(T& map, typename T::key_type const& key)
 template<typename T> typename T::mapped_type& get_or_insert(T& map, typename T::key_type const& key) {
   return map[key];
 }
+template<typename T> typename T::mapped_type const& put_new(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {
+  assert(map.find(key) == map.end());
+  map[key] = value;
+  return map[key];
+}
 //: The contract: any container that relies on get_or_insert should never call
 //: contains_key.