| 130 | |
| 131 | template <typename CreateFn> |
| 132 | V GetOrCreate(const K& k, CreateFn create) { |
| 133 | static_assert(std::is_same<V, typename std::result_of<CreateFn()>::type>::value, |
| 134 | "Argument `create` should return a value of type V."); |
| 135 | auto lb = lower_bound(k); |
| 136 | if (lb != end() && !key_comp()(k, lb->first)) { |
| 137 | return lb->second; |
| 138 | } |
| 139 | auto it = PutBefore(lb, k, create()); |
| 140 | return it->second; |
| 141 | } |
| 142 | |
| 143 | iterator FindOrAdd(const K& k, const V& v) { |
| 144 | iterator it = find(k); |
nothing calls this directly
no outgoing calls
no test coverage detected