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

Method copy_from_dynamic

util/generic/hash_table.h:1416–1441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414
1415template <class V, class K, class HF, class Ex, class Eq, class A>
1416void THashTable<V, K, HF, Ex, Eq, A>::copy_from_dynamic(const THashTable& ht) {
1417 Y_ASSERT(buckets.size() == ht.buckets.size() && !ht.empty());
1418
1419#ifdef __STL_USE_EXCEPTIONS
1420 try {
1421#endif /* __STL_USE_EXCEPTIONS */
1422 for (size_type i = 0; i < ht.buckets.size(); ++i) { /*y*/
1423 if (const node* cur = ht.buckets[i]) {
1424 node* copy = new_node(cur->val);
1425 buckets[i] = copy;
1426
1427 for (node* next = cur->next; !((uintptr_t)next & 1); cur = next, next = cur->next) {
1428 copy->next = new_node(next->val);
1429 copy = copy->next;
1430 }
1431 copy->next = (node*)((uintptr_t)&buckets[i + 1] | 1); /*y*/
1432 }
1433 }
1434 num_elements = ht.num_elements;
1435#ifdef __STL_USE_EXCEPTIONS
1436 } catch (...) {
1437 basic_clear();
1438 throw;
1439 }
1440#endif /* __STL_USE_EXCEPTIONS */
1441}
1442
1443namespace NPrivate {
1444 template <class Key>

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected