diff options
Diffstat (limited to 'libartbase/base/hash_map.h')
-rw-r--r-- | libartbase/base/hash_map.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libartbase/base/hash_map.h b/libartbase/base/hash_map.h index 7d018921f0..32c232a1b2 100644 --- a/libartbase/base/hash_map.h +++ b/libartbase/base/hash_map.h @@ -81,6 +81,13 @@ class HashMap : public HashSet<std::pair<Key, Value>, HashMap() : Base() { } explicit HashMap(const Alloc& alloc) : Base(alloc) { } + + // Used to insert a new mapping. + typename Base::iterator Overwrite(const Key& k, const Value& v) { + auto res = Base::insert({ k, v }).first; + *res = { k, v }; + return res; + } }; } // namespace art |