MCPcopy Create free account
hub / github.com/apache/arrow / GetOrInsert

Method GetOrInsert

cpp/src/arrow/util/concurrent_map.h:37–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36 template <typename ValueFunc>
37 V GetOrInsert(const K& key, ValueFunc&& compute_value_func) {
38 auto lock = mutex_.Lock();
39 auto it = map_.find(key);
40 if (it == map_.end()) {
41 auto pair = map_.emplace(key, compute_value_func());
42 it = pair.first;
43 }
44 return it->second;
45 }
46
47 void Erase(const K& key) {
48 auto lock = mutex_.Lock();

Callers

nothing calls this directly

Calls 3

LockMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected