MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / Overwrite

Method Overwrite

Bcore/src/main/cpp/base/safe_map.h:122–129  ·  view source on GitHub ↗

Used to insert a new mapping or overwrite an existing mapping. Note that if the value type of this container is a pointer, any overwritten pointer will be lost and if this container was the owner, you have a leak. Returns iterator pointing to the new or overwritten entry.

Source from the content-addressed store, hash-verified

120 // of this container is a pointer, any overwritten pointer will be lost and if this container
121 // was the owner, you have a leak. Returns iterator pointing to the new or overwritten entry.
122 iterator Overwrite(const K& k, const V& v) {
123 std::pair<iterator, bool> result = map_.insert(std::make_pair(k, v));
124 if (!result.second) {
125 // Already there - update the value for the existing key
126 result.first->second = v;
127 }
128 return result.first;
129 }
130
131 template <typename CreateFn>
132 V GetOrCreate(const K& k, CreateFn create) {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected