MCPcopy Create free account
hub / github.com/catboost/catboost / insert

Method insert

library/cpp/containers/dense_hash/dense_hash.h:332–345  ·  view source on GitHub ↗

We need this overload because we want to optimize insertion when somebody inserts value_type. So we don't need to extract the key. This overload also allows brace enclosed initializer to be inserted.

Source from the content-addressed store, hash-verified

330 // So we don't need to extract the key.
331 // This overload also allows brace enclosed initializer to be inserted.
332 std::pair<iterator, bool> insert(const value_type& t) {
333 size_type hs = hasher{}(t.first);
334 auto p = GetBucketInfo(hs & BucketMask, t.first);
335 if (p.second) {
336 ++NumFilled;
337 if (NumFilled >= GrowThreshold) {
338 Grow();
339 p.first = FindProperBucket(hs & BucketMask, t.first);
340 }
341 SetValue(p.first, t);
342 return { iterator{ this, p.first }, true };
343 }
344 return { iterator{ this, p.first }, false };
345 }
346
347 // We need this overload because we want to optimize insertion when somebody inserts value_type.
348 // So we don't need to extract the key.

Callers 1

InsertIntervalImplMethod · 0.45

Calls 3

SetValueFunction · 0.50
moveFunction · 0.50
emplaceFunction · 0.50

Tested by

no test coverage detected