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

Method Add

library/cpp/containers/comptrie/minimize.cpp:40–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40 void Add(size_t key, size_t value) {
41 size_t hikey = key & 0xFFFF;
42
43 if (Data.size() <= hikey)
44 Data.resize(hikey + 1);
45
46 TSizePairVector& sublist = Data[hikey];
47
48 for (auto& it : sublist) {
49 if (it.first == key) {
50 it.second = value;
51
52 return;
53 }
54 }
55
56 sublist.push_back(TSizePair(key, value));
57 }
58
59 bool Contains(size_t key) const {
60 return (Get(key) != 0);

Callers 15

CreateTrieMethod · 0.45
TestPhraseSearchMethod · 0.45
TestAddGetMethod · 0.45
TestRandomMethod · 0.45
TestFindTailsImplMethod · 0.45
TestPrefixGroupedMethod · 0.45
TestMergeFromFileMethod · 0.45
TestMergeFromBufferMethod · 0.45
TestUniqueImplMethod · 0.45
TestAddRetValueMethod · 0.45
TestClearMethod · 0.45

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45

Tested by 15

TestPhraseSearchMethod · 0.36
TestAddGetMethod · 0.36
TestRandomMethod · 0.36
TestFindTailsImplMethod · 0.36
TestPrefixGroupedMethod · 0.36
TestMergeFromFileMethod · 0.36
TestMergeFromBufferMethod · 0.36
TestUniqueImplMethod · 0.36
TestAddRetValueMethod · 0.36
TestClearMethod · 0.36
TestIterateEmptyKeyMethod · 0.36
TestTrieSetMethod · 0.36