aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers
diff options
context:
space:
mode:
authordanlark <danlark@yandex-team.ru>2022-02-10 16:46:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:10 +0300
commitbaa58daefa91fde4b4769facdbd2903763b9c6a8 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/containers
parent3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff)
downloadydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers')
-rw-r--r--library/cpp/containers/comptrie/chunked_helpers_trie.h4
-rw-r--r--library/cpp/containers/comptrie/comptrie_builder.h10
-rw-r--r--library/cpp/containers/comptrie/comptrie_builder.inl14
-rw-r--r--library/cpp/containers/comptrie/comptrie_trie.h16
-rw-r--r--library/cpp/containers/comptrie/comptrie_ut.cpp36
-rw-r--r--library/cpp/containers/comptrie/loader/loader_ut.cpp2
-rw-r--r--library/cpp/containers/comptrie/search_iterator.h2
-rw-r--r--library/cpp/containers/comptrie/set.h2
-rw-r--r--library/cpp/containers/stack_array/ut/tests_ut.cpp2
-rw-r--r--library/cpp/containers/str_map/str_map.h2
10 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/containers/comptrie/chunked_helpers_trie.h b/library/cpp/containers/comptrie/chunked_helpers_trie.h
index c95cee2322..cfa35f5ba2 100644
--- a/library/cpp/containers/comptrie/chunked_helpers_trie.h
+++ b/library/cpp/containers/comptrie/chunked_helpers_trie.h
@@ -36,7 +36,7 @@ public:
void Add(const char* key, size_t keylen) {
Builder.Add(key, keylen, 0);
- assert(Has(((TString)key).substr(0, keylen).data()));
+ assert(Has(((TString)key).substr(0, keylen).data()));
}
void Add(const char* key) {
@@ -195,7 +195,7 @@ public:
Sort(Values.begin(), Values.end());
TTrieMapWriter<T, true> writer;
for (typename TValues::const_iterator toValue = Values.begin(); toValue != Values.end(); ++toValue)
- writer.Add(toValue->first.data(), toValue->second);
+ writer.Add(toValue->first.data(), toValue->second);
writer.Save(out);
}
diff --git a/library/cpp/containers/comptrie/comptrie_builder.h b/library/cpp/containers/comptrie/comptrie_builder.h
index bc7068faa0..cf7d2e39a3 100644
--- a/library/cpp/containers/comptrie/comptrie_builder.h
+++ b/library/cpp/containers/comptrie/comptrie_builder.h
@@ -52,7 +52,7 @@ public:
bool Add(const TSymbol* key, size_t keylen, const TData& value);
bool Add(const TKeyBuf& key, const TData& value) {
- return Add(key.data(), key.size(), value);
+ return Add(key.data(), key.size(), value);
}
// add already serialized data
@@ -63,22 +63,22 @@ public:
bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& filename);
bool AddSubtreeInFile(const TKeyBuf& key, const TString& filename) {
- return AddSubtreeInFile(key.data(), key.size(), filename);
+ return AddSubtreeInFile(key.data(), key.size(), filename);
}
bool AddSubtreeInBuffer(const TSymbol* key, size_t keylen, TArrayWithSizeHolder<char>&& buffer);
bool AddSubtreeInBuffer(const TKeyBuf& key, TArrayWithSizeHolder<char>&& buffer) {
- return AddSubtreeInBuffer(key.data(), key.size(), std::move(buffer));
+ return AddSubtreeInBuffer(key.data(), key.size(), std::move(buffer));
}
bool Find(const TSymbol* key, size_t keylen, TData* value) const;
bool Find(const TKeyBuf& key, TData* value = nullptr) const {
- return Find(key.data(), key.size(), value);
+ return Find(key.data(), key.size(), value);
}
bool FindLongestPrefix(const TSymbol* key, size_t keylen, size_t* prefixLen, TData* value = nullptr) const;
bool FindLongestPrefix(const TKeyBuf& key, size_t* prefixLen, TData* value = nullptr) const {
- return FindLongestPrefix(key.data(), key.size(), prefixLen, value);
+ return FindLongestPrefix(key.data(), key.size(), prefixLen, value);
}
size_t Save(IOutputStream& os) const;
diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl
index 350938ea65..f273fa6571 100644
--- a/library/cpp/containers/comptrie/comptrie_builder.inl
+++ b/library/cpp/containers/comptrie/comptrie_builder.inl
@@ -232,7 +232,7 @@ public:
}
TCompactTrie<char, D, S> trie(Buffer.Get(), Buffer.Size(), packer);
- result = trie.Find(key.data(), key.size(), value);
+ result = trie.Find(key.data(), key.size(), value);
return nullptr;
}
@@ -245,7 +245,7 @@ public:
TCompactTrie<char, D, S> trie(Buffer.Get(), Buffer.Size(), packer);
size_t prefixLen = 0;
- result = trie.FindLongestPrefix(key.data(), key.size(), &prefixLen, value);
+ result = trie.FindLongestPrefix(key.data(), key.size(), &prefixLen, value);
key = key.SubStr(prefixLen);
return nullptr;
@@ -298,7 +298,7 @@ public:
}
TCompactTrie<char, D, S> trie(TBlob::FromFile(Data->FileName), packer);
- result = trie.Find(key.data(), key.size(), value);
+ result = trie.Find(key.data(), key.size(), value);
return nullptr;
}
@@ -310,7 +310,7 @@ public:
TCompactTrie<char, D, S> trie(TBlob::FromFile(Data->FileName), packer);
size_t prefixLen = 0;
- result = trie.FindLongestPrefix(key.data(), key.size(), &prefixLen, value);
+ result = trie.FindLongestPrefix(key.data(), key.size(), &prefixLen, value);
key = key.SubStr(prefixLen);
return nullptr;
@@ -735,7 +735,7 @@ bool TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::FindLongestPrefixImp
endResult = true;
}
if (endResult && prefixLen)
- *prefixLen = keyTail ? key.size() - keyTail.size() : key.size();
+ *prefixLen = keyTail ? key.size() - keyTail.size() : key.size();
return endResult;
}
@@ -1021,11 +1021,11 @@ const typename TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode*
if (it != this->end()) {
const char* const arcLabel = it->Label.AsCharPtr();
const size_t arcLabelLen = it->Label.Length();
- if (key.size() >= arcLabelLen && memcmp(key.data(), arcLabel, arcLabelLen) == 0) {
+ if (key.size() >= arcLabelLen && memcmp(key.data(), arcLabel, arcLabelLen) == 0) {
const TStringBuf srcKey = key;
key = key.SubStr(arcLabelLen);
const TNode* const node = it->Node;
- if (srcKey.size() == arcLabelLen) {
+ if (srcKey.size() == arcLabelLen) {
// unpack value of it->Node, if it has value
if (!node->IsFinal())
return nullptr;
diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h
index 8f18b66d2a..40ec1e52b3 100644
--- a/library/cpp/containers/comptrie/comptrie_trie.h
+++ b/library/cpp/containers/comptrie/comptrie_trie.h
@@ -82,7 +82,7 @@ public:
bool Find(const TSymbol* key, size_t keylen, TData* value = nullptr) const;
bool Find(const TKeyBuf& key, TData* value = nullptr) const {
- return Find(key.data(), key.size(), value);
+ return Find(key.data(), key.size(), value);
}
TData Get(const TSymbol* key, size_t keylen) const {
@@ -92,11 +92,11 @@ public:
return value;
}
TData Get(const TKeyBuf& key) const {
- return Get(key.data(), key.size());
+ return Get(key.data(), key.size());
}
TData GetDefault(const TKeyBuf& key, const TData& def) const {
TData value;
- if (!Find(key.data(), key.size(), &value))
+ if (!Find(key.data(), key.size(), &value))
return def;
else
return value;
@@ -120,21 +120,21 @@ public:
void FindPhrases(const TSymbol* key, size_t keylen, TPhraseMatchVector& matches, TSymbol separator = TSymbol(' ')) const;
void FindPhrases(const TKeyBuf& key, TPhraseMatchVector& matches, TSymbol separator = TSymbol(' ')) const {
- return FindPhrases(key.data(), key.size(), matches, separator);
+ return FindPhrases(key.data(), key.size(), matches, separator);
}
bool FindLongestPrefix(const TSymbol* key, size_t keylen, size_t* prefixLen, TData* value = nullptr, bool* hasNext = nullptr) const;
bool FindLongestPrefix(const TKeyBuf& key, size_t* prefixLen, TData* value = nullptr, bool* hasNext = nullptr) const {
- return FindLongestPrefix(key.data(), key.size(), prefixLen, value, hasNext);
+ return FindLongestPrefix(key.data(), key.size(), prefixLen, value, hasNext);
}
// Return trie, containing all tails for the given key
inline TCompactTrie<T, D, S> FindTails(const TSymbol* key, size_t keylen) const;
TCompactTrie<T, D, S> FindTails(const TKeyBuf& key) const {
- return FindTails(key.data(), key.size());
+ return FindTails(key.data(), key.size());
}
bool FindTails(const TSymbol* key, size_t keylen, TCompactTrie<T, D, S>& res) const;
bool FindTails(const TKeyBuf& key, TCompactTrie<T, D, S>& res) const {
- return FindTails(key.data(), key.size(), res);
+ return FindTails(key.data(), key.size(), res);
}
// same as FindTails(&key, 1), a bit faster
@@ -455,7 +455,7 @@ template <class T, class D, class S>
void TCompactTrie<T, D, S>::Print(IOutputStream& os) {
typedef typename ::TCompactTrieKeySelector<T>::TKeyBuf TSBuffer;
for (TConstIterator it = Begin(); it != End(); ++it) {
- os << TSBuffer((*it).first.data(), (*it).first.size()) << "\t" << (*it).second << Endl;
+ os << TSBuffer((*it).first.data(), (*it).first.size()) << "\t" << (*it).second << Endl;
}
}
diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp
index 8b405d9b40..74bee09b5d 100644
--- a/library/cpp/containers/comptrie/comptrie_ut.cpp
+++ b/library/cpp/containers/comptrie/comptrie_ut.cpp
@@ -404,7 +404,7 @@ void TCompactTrieTest::CheckData(const char* data, size_t datalen) {
typename TCompactTrie<T>::TKey key = MakeWideKey<T>(testkey);
ui64 value = 0;
size_t prefixLen = 0;
- UNIT_ASSERT(trie.FindLongestPrefix(key.data(), testkey.length() - 1, &prefixLen, &value));
+ UNIT_ASSERT(trie.FindLongestPrefix(key.data(), testkey.length() - 1, &prefixLen, &value));
UNIT_ASSERT_EQUAL(prefixLen, 3);
UNIT_ASSERT_EQUAL(6, value);
@@ -671,9 +671,9 @@ void TCompactTrieTest::TestRandom(const size_t n, const size_t maxKeySize) {
if (key != EMPTY_KEY && keys.find(key) == keys.end()) {
const typename T::TData val = T::Data(key);
keys[key] = val;
- UNIT_ASSERT_C(!builder.Find(key.data(), key.size(), &dummy), "key = " << HexEncode(TString(key)));
- builder.Add(key.data(), key.size(), val);
- UNIT_ASSERT_C(builder.Find(key.data(), key.size(), &dummy), "key = " << HexEncode(TString(key)));
+ UNIT_ASSERT_C(!builder.Find(key.data(), key.size(), &dummy), "key = " << HexEncode(TString(key)));
+ builder.Add(key.data(), key.size(), val);
+ UNIT_ASSERT_C(builder.Find(key.data(), key.size(), &dummy), "key = " << HexEncode(TString(key)));
UNIT_ASSERT(dummy == val);
}
}
@@ -737,7 +737,7 @@ void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) {
for (auto& i : SampleData) {
TString temp = i;
ui64 val = temp.size() * 2;
- builder.Add(temp.data(), temp.size(), val);
+ builder.Add(temp.data(), temp.size(), val);
if (temp.StartsWith(prefix)) {
input[temp.substr(prefix.size())] = val;
}
@@ -749,13 +749,13 @@ void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) {
size_t len = builder.Save(stream);
TTrie trie(stream.Buffer().Data(), len);
- TTrie subtrie = trie.FindTails(prefix.data(), prefix.size());
+ TTrie subtrie = trie.FindTails(prefix.data(), prefix.size());
TMap<TString, ui64> output;
for (TTrie::TConstIterator i = subtrie.Begin(), mi = subtrie.End(); i != mi; ++i) {
TTrie::TValueType val = *i;
- output[TString(val.first.data(), val.first.size())] = val.second;
+ output[TString(val.first.data(), val.first.size())] = val.second;
}
UNIT_ASSERT(input.size() == output.size());
UNIT_ASSERT(input == output);
@@ -764,12 +764,12 @@ void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) {
CompactTrieMinimize<TTrie::TPacker>(buftmp, stream.Buffer().Data(), len, false);
TTrie trieMin(buftmp.Buffer().Data(), buftmp.Buffer().Size());
- subtrie = trieMin.FindTails(prefix.data(), prefix.size());
+ subtrie = trieMin.FindTails(prefix.data(), prefix.size());
output.clear();
for (TTrie::TConstIterator i = subtrie.Begin(), mi = subtrie.End(); i != mi; ++i) {
TTrie::TValueType val = *i;
- output[TString(val.first.data(), val.first.size())] = val.second;
+ output[TString(val.first.data(), val.first.size())] = val.second;
}
UNIT_ASSERT(input.size() == output.size());
UNIT_ASSERT(input == output);
@@ -878,9 +878,9 @@ void TCompactTrieTest::TestMergeFromFile() {
UNIT_ASSERT_VALUES_EQUAL(113u, trie.Get("com.google"));
UNIT_ASSERT_VALUES_EQUAL(114u, trie.Get("com.yahoo"));
- unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res").data());
- unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com").data());
- unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru").data());
+ unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res").data());
+ unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com").data());
+ unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru").data());
}
void TCompactTrieTest::TestMergeFromBuffer() {
@@ -926,7 +926,7 @@ void TCompactTrieTest::TestMergeFromBuffer() {
UNIT_ASSERT_VALUES_EQUAL(2u, trie.Get("com.bbbbb"));
UNIT_ASSERT_VALUES_EQUAL(3u, trie.Get("com.ccccc"));
- unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMergeFromBuffer-res").data());
+ unlink((GetSystemTempDir() + "/TCompactTrieTest-TestMergeFromBuffer-res").data());
}
void TCompactTrieTest::TestUnique() {
@@ -1168,7 +1168,7 @@ void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys,
CheckEquality<typename TContainer::value_type>(*p, *p1);
}
- unlink(fileName.data());
+ unlink(fileName.data());
}
template <>
@@ -1190,7 +1190,7 @@ void TCompactTrieTest::TestTrieWithContainers<std::pair<TUtf16String, TVector<i6
CheckEquality<TContainer::second_type>(value.second, sampleData[i].second);
}
- unlink(fileName.data());
+ unlink(fileName.data());
}
void TCompactTrieTest::TestTrieForVectorInt64() {
@@ -1525,7 +1525,7 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra
size_t prefixSize = 0xfcfcfc;
TString value = "abcd";
const bool expectedResult = hasEmptyKey || expectedSize != 0;
- UNIT_ASSERT_VALUES_EQUAL_C(expectedResult, builder.FindLongestPrefix(otherKey.data(), otherKey.size(), &prefixSize, &value), "otherKey = " << HexEncode(otherKey));
+ UNIT_ASSERT_VALUES_EQUAL_C(expectedResult, builder.FindLongestPrefix(otherKey.data(), otherKey.size(), &prefixSize, &value), "otherKey = " << HexEncode(otherKey));
if (expectedResult) {
UNIT_ASSERT_VALUES_EQUAL(expectedSize, prefixSize);
if (expectedSize) {
@@ -1543,7 +1543,7 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra
extendedKey += RandChar();
size_t extendedPrefixSize = 0xdddddd;
TString extendedValue = "dcba";
- UNIT_ASSERT_VALUES_EQUAL(expectedResult, builder.FindLongestPrefix(extendedKey.data(), extendedKey.size(), &extendedPrefixSize, &extendedValue));
+ UNIT_ASSERT_VALUES_EQUAL(expectedResult, builder.FindLongestPrefix(extendedKey.data(), extendedKey.size(), &extendedPrefixSize, &extendedValue));
if (expectedResult) {
UNIT_ASSERT_VALUES_EQUAL(value, extendedValue);
UNIT_ASSERT_VALUES_EQUAL(prefixSize, extendedPrefixSize);
@@ -1553,7 +1553,7 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra
}
}
}
- builder.Add(key.data(), key.size(), key);
+ builder.Add(key.data(), key.size(), key);
}
TBufferOutput buffer;
diff --git a/library/cpp/containers/comptrie/loader/loader_ut.cpp b/library/cpp/containers/comptrie/loader/loader_ut.cpp
index cd7976755f..345063a31e 100644
--- a/library/cpp/containers/comptrie/loader/loader_ut.cpp
+++ b/library/cpp/containers/comptrie/loader/loader_ut.cpp
@@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(ArchiveLoaderTests) {
"zero", "one", "two"};
i32 val = -1;
for (i32 i = 0; i < 3; ++i) {
- UNIT_ASSERT(trie.Find(TrieKyes[i].data(), TrieKyes[i].size(), &val));
+ UNIT_ASSERT(trie.Find(TrieKyes[i].data(), TrieKyes[i].size(), &val));
UNIT_ASSERT_EQUAL(i, val);
}
diff --git a/library/cpp/containers/comptrie/search_iterator.h b/library/cpp/containers/comptrie/search_iterator.h
index 1f6eeb241e..247f7e5936 100644
--- a/library/cpp/containers/comptrie/search_iterator.h
+++ b/library/cpp/containers/comptrie/search_iterator.h
@@ -60,7 +60,7 @@ public:
return NCompactTrie::Advance(DataPos, DataEnd, ValuePos, label, Trie->Packer);
}
inline bool Advance(const TKeyBuf& key) {
- return Advance(key.data(), key.size());
+ return Advance(key.data(), key.size());
}
bool Advance(const TSymbol* key, size_t keylen);
bool GetValue(TData* value = nullptr) const;
diff --git a/library/cpp/containers/comptrie/set.h b/library/cpp/containers/comptrie/set.h
index 205a96ef46..acd43338f0 100644
--- a/library/cpp/containers/comptrie/set.h
+++ b/library/cpp/containers/comptrie/set.h
@@ -31,7 +31,7 @@ public:
}
bool Has(const typename TBase::TKeyBuf& key) const {
- return TBase::Find(key.data(), key.size());
+ return TBase::Find(key.data(), key.size());
}
bool FindTails(const typename TBase::TKeyBuf& key, TCompactTrieSet<T>& res) const {
diff --git a/library/cpp/containers/stack_array/ut/tests_ut.cpp b/library/cpp/containers/stack_array/ut/tests_ut.cpp
index 6a585611cc..3e96384f0e 100644
--- a/library/cpp/containers/stack_array/ut/tests_ut.cpp
+++ b/library/cpp/containers/stack_array/ut/tests_ut.cpp
@@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TestStackArray) {
UNIT_ASSERT_VALUES_EQUAL(x, 0xCCCCCCCC);
}
- for (size_t i = 0; i < s.size(); ++i) {
+ for (size_t i = 0; i < s.size(); ++i) {
s[i] = i;
}
diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h
index fc53fe01f6..31b00d1b99 100644
--- a/library/cpp/containers/str_map/str_map.h
+++ b/library/cpp/containers/str_map/str_map.h
@@ -6,7 +6,7 @@
#include <util/generic/buffer.h>
#include <util/str_stl.h> // less<> and equal_to<> for const char*
#include <utility>
-#include <util/generic/noncopyable.h>
+#include <util/generic/noncopyable.h>
template <class T, class HashFcn = THash<const char*>, class EqualTo = TEqualTo<const char*>, class Alloc = std::allocator<const char*>>
class string_hash;