MCPcopy Create free account
hub / github.com/NativeScript/android / try_emplace_impl

Method try_emplace_impl

test-app/runtime/src/main/cpp/robin_hood.h:2260–2286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2258
2259 template <typename OtherKey, typename... Args>
2260 std::pair<iterator, bool> try_emplace_impl(OtherKey&& key, Args&&... args) {
2261 ROBIN_HOOD_TRACE(this)
2262 auto idxAndState = insertKeyPrepareEmptySpot(key);
2263 switch (idxAndState.second) {
2264 case InsertionState::key_found:
2265 break;
2266
2267 case InsertionState::new_node:
2268 ::new (static_cast<void*>(&mKeyVals[idxAndState.first])) Node(
2269 *this, std::piecewise_construct, std::forward_as_tuple(std::forward<OtherKey>(key)),
2270 std::forward_as_tuple(std::forward<Args>(args)...));
2271 break;
2272
2273 case InsertionState::overwrite_node:
2274 mKeyVals[idxAndState.first] = Node(*this, std::piecewise_construct,
2275 std::forward_as_tuple(std::forward<OtherKey>(key)),
2276 std::forward_as_tuple(std::forward<Args>(args)...));
2277 break;
2278
2279 case InsertionState::overflow_error:
2280 throwOverflowError();
2281 break;
2282 }
2283
2284 return std::make_pair(iterator(mKeyVals + idxAndState.first, mInfo + idxAndState.first),
2285 InsertionState::key_found != idxAndState.second);
2286 }
2287
2288 template <typename OtherKey, typename Mapped>
2289 std::pair<iterator, bool> insertOrAssignImpl(OtherKey&& key, Mapped&& obj) {

Callers

nothing calls this directly

Calls 2

NodeClass · 0.85
iteratorClass · 0.85

Tested by

no test coverage detected