diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/containers | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers')
28 files changed, 171 insertions, 171 deletions
diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 5e40f47ab9..bed0167a19 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -17,7 +17,7 @@ class super_atomizer; template <class HashFcn, class EqualTo> class atomizer: public string_hash<ui32, HashFcn, EqualTo> { private: - TVector<const char*> order; + TVector<const char*> order; public: using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; @@ -48,7 +48,7 @@ public: std::pair<iterator, bool> ins = insert_copy(key, ui32(size() + 1)); if (ins.second) { // new? if (pool.Begin() != old_begin) // repoint? - for (TVector<const char*>::iterator ptr = order.begin(); ptr != order.end(); ++ptr) + for (TVector<const char*>::iterator ptr = order.begin(); ptr != order.end(); ++ptr) if (old_begin <= *ptr && *ptr < old_end) // from old pool? *ptr += pool.Begin() - old_begin; order.push_back((*ins.first).first); // copy of 'key' @@ -108,7 +108,7 @@ public: template <class T, class HashFcn, class EqualTo> class super_atomizer: public string_hash<ui32, HashFcn, EqualTo> { private: - using TOrder = TVector<std::pair<const char*, T>>; + using TOrder = TVector<std::pair<const char*, T>>; TOrder order; public: diff --git a/library/cpp/containers/bitseq/bititerator_ut.cpp b/library/cpp/containers/bitseq/bititerator_ut.cpp index ed0925866f..8669410f5d 100644 --- a/library/cpp/containers/bitseq/bititerator_ut.cpp +++ b/library/cpp/containers/bitseq/bititerator_ut.cpp @@ -4,8 +4,8 @@ #include <util/generic/vector.h> Y_UNIT_TEST_SUITE(TBitIteratorTest) { - TVector<ui16> GenWords() { - TVector<ui16> words(1, 0); + TVector<ui16> GenWords() { + TVector<ui16> words(1, 0); for (ui16 word = 1; word; ++word) words.push_back(word); return words; @@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TBitIteratorTest) { } Y_UNIT_TEST(TestForward) { - TVector<ui32> words; + TVector<ui32> words; words.push_back((1 << 10) | (1 << 20) | (1 << 25)); words.push_back(1 | (1 << 5) | (1 << 6) | (1 << 30)); for (int i = 0; i < 3; ++i) @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TBitIteratorTest) { } Y_UNIT_TEST(TestUnalignedReadAndPeek) { - TVector<ui32> words; + TVector<ui32> words; words.push_back((1 << 10) | (1 << 20) | (1 << 25)); words.push_back(1 | (1 << 5) | (1 << 6) | (1 << 30)); for (int i = 0; i < 5; ++i) diff --git a/library/cpp/containers/bitseq/bitvector.h b/library/cpp/containers/bitseq/bitvector.h index 3f8fd81ee5..7485b9a072 100644 --- a/library/cpp/containers/bitseq/bitvector.h +++ b/library/cpp/containers/bitseq/bitvector.h @@ -19,7 +19,7 @@ public: private: friend class TReadonlyBitVector<T>; ui64 Size_; - TVector<TWord> Data_; + TVector<TWord> Data_; public: TBitVector() diff --git a/library/cpp/containers/compact_vector/compact_vector.h b/library/cpp/containers/compact_vector/compact_vector.h index dbe7473f0c..94664aeb28 100644 --- a/library/cpp/containers/compact_vector/compact_vector.h +++ b/library/cpp/containers/compact_vector/compact_vector.h @@ -8,7 +8,7 @@ #include <cstdlib> -// vector that is 8 bytes when empty (TVector is 24 bytes) +// vector that is 8 bytes when empty (TVector is 24 bytes) template <typename T> class TCompactVector { diff --git a/library/cpp/containers/comptrie/chunked_helpers_trie.h b/library/cpp/containers/comptrie/chunked_helpers_trie.h index cfa35f5ba2..e59d5f7263 100644 --- a/library/cpp/containers/comptrie/chunked_helpers_trie.h +++ b/library/cpp/containers/comptrie/chunked_helpers_trie.h @@ -139,7 +139,7 @@ public: #endif } - void Add(const TString& s, const T& value) { + void Add(const TString& s, const T& value) { ui64 intValue = 0; memcpy(&intValue, &value, sizeof(T)); Builder.Add(s.data(), s.size(), intValue); @@ -180,8 +180,8 @@ public: template <typename T> class TTrieSortedMapWriter { private: - typedef std::pair<TString, T> TValue; - typedef TVector<TValue> TValues; + typedef std::pair<TString, T> TValue; + typedef TVector<TValue> TValues; TValues Values; public: diff --git a/library/cpp/containers/comptrie/comptrie_builder.h b/library/cpp/containers/comptrie/comptrie_builder.h index cf7d2e39a3..815737bd36 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.h +++ b/library/cpp/containers/comptrie/comptrie_builder.h @@ -61,8 +61,8 @@ public: return AddPtr(key.data(), key.size(), data); } - bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& filename); - bool AddSubtreeInFile(const TKeyBuf& key, const TString& filename) { + 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); } @@ -83,8 +83,8 @@ public: size_t Save(IOutputStream& os) const; size_t SaveAndDestroy(IOutputStream& os); - size_t SaveToFile(const TString& fileName) const { - TFixedBufferFileOutput out(fileName); + size_t SaveToFile(const TString& fileName) const { + TFixedBufferFileOutput out(fileName); return Save(out); } diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl index f273fa6571..8c9f681982 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.inl +++ b/library/cpp/containers/comptrie/comptrie_builder.inl @@ -78,7 +78,7 @@ public: bool AddEntry(const TSymbol* key, size_t keylen, const TData& value); bool AddEntryPtr(const TSymbol* key, size_t keylen, const char* value); - bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName); + bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName); bool AddSubtreeInBuffer(const TSymbol* key, size_t keylen, TArrayWithSizeHolder<char>&& buffer); bool FindEntry(const TSymbol* key, size_t keylen, TData* value) const; bool FindLongestPrefix(const TSymbol* key, size_t keylen, size_t* prefixlen, TData* value) const; @@ -269,12 +269,12 @@ public: struct TSubtreeInFile: public ISubtree { struct TData { - TString FileName; + TString FileName; ui64 Size; }; THolder<TData> Data; - TSubtreeInFile(const TString& fileName) { + TSubtreeInFile(const TString& fileName) { // stupid API TFile file(fileName, RdOnly); i64 size = file.GetLength(); @@ -321,7 +321,7 @@ public: } ui64 Save(const TBuilderImpl*, IOutputStream& os) const override { - TUnbufferedFileInput is(Data->FileName); + TUnbufferedFileInput is(Data->FileName); ui64 written = TransferData(&is, &os); if (written != Data->Size) ythrow yexception() << "file " << Data->FileName.Quote() << " size changed"; @@ -400,7 +400,7 @@ public: return pool.Allocate(); } - inline void operator delete(void* ptr, TFixedSizeAllocator& pool) noexcept { + inline void operator delete(void* ptr, TFixedSizeAllocator& pool) noexcept { pool.Release(ptr); } @@ -436,7 +436,7 @@ bool TCompactTrieBuilder<T, D, S>::AddPtr(const TSymbol* key, size_t keylen, con } template <class T, class D, class S> -bool TCompactTrieBuilder<T, D, S>::AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName) { +bool TCompactTrieBuilder<T, D, S>::AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName) { return Impl->AddSubtreeInFile(key, keylen, fileName); } @@ -566,7 +566,7 @@ bool TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::AddEntryPtr( template <class T, class D, class S> bool TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::AddSubtreeInFile( - const TSymbol* key, size_t keylen, const TString& fileName) { + const TSymbol* key, size_t keylen, const TString& fileName) { typedef typename TNode::ISubtree ISubtree; typedef typename TNode::TSubtreeInFile TSubtreeInFile; diff --git a/library/cpp/containers/comptrie/comptrie_impl.h b/library/cpp/containers/comptrie/comptrie_impl.h index f41c38311a..6effd9c909 100644 --- a/library/cpp/containers/comptrie/comptrie_impl.h +++ b/library/cpp/containers/comptrie/comptrie_impl.h @@ -59,12 +59,12 @@ namespace NCompTriePrivate { template <> struct TStringForChar<char> { - typedef TString TResult; + typedef TString TResult; }; template <> struct TStringForChar<wchar16> { - typedef TUtf16String TResult; + typedef TUtf16String TResult; }; template <> diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b3..bf47ec8cd0 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -41,7 +41,7 @@ public: typedef std::pair<TKey, TData> TValueType; typedef std::pair<size_t, TData> TPhraseMatch; - typedef TVector<TPhraseMatch> TPhraseMatchVector; + typedef TVector<TPhraseMatch> TPhraseMatchVector; typedef TCompactTrieBuilder<T, D, S> TBuilder; @@ -202,7 +202,7 @@ protected: bool hasNext; return LookupLongestPrefix(key, keylen, prefixLen, valuepos, hasNext); } - void LookupPhrases(const char* datapos, size_t len, const TSymbol* key, size_t keylen, TVector<TPhraseMatch>& matches, TSymbol separator) const; + void LookupPhrases(const char* datapos, size_t len, const TSymbol* key, size_t keylen, TVector<TPhraseMatch>& matches, TSymbol separator) const; }; template <class T = char, class D = ui64, class S = TCompactTriePacker<D>> diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..22e61adf83 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -138,19 +138,19 @@ private: template <class T, bool minimize> void TestRandom(const size_t n, const size_t maxKeySize); - void TestFindTailsImpl(const TString& prefix); + void TestFindTailsImpl(const TString& prefix); void TestUniqueImpl(bool isPrefixGrouped); - TVector<TUtf16String> GetSampleKeys(size_t nKeys) const; + TVector<TUtf16String> GetSampleKeys(size_t nKeys) const; template <class TContainer> - TVector<TContainer> GetSampleVectorData(size_t nValues); + TVector<TContainer> GetSampleVectorData(size_t nValues); template <class TContainer> - TVector<TContainer> GetSampleTextVectorData(size_t nValues); + TVector<TContainer> GetSampleTextVectorData(size_t nValues); template <class T> void CheckEquality(const T& value1, const T& value2) const; template <class TContainer> - void TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName); + void TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName); template <typename TChar> void TestSearchIterImpl(); @@ -287,7 +287,7 @@ typename TCompactTrie<T>::TKey MakeWideKey(const char* str, size_t len) { } template <class T> -typename TCompactTrie<T>::TKey MakeWideKey(const TString& str) { +typename TCompactTrie<T>::TKey MakeWideKey(const TString& str) { return MakeWideKey<T>(str.c_str(), str.length()); } @@ -321,7 +321,7 @@ void TCompactTrieTest::CreateTrie(IOutputStream& out, bool minimize, bool useFas } // Iterates over all strings of length <= 4 made of letters a-g. -static bool LexicographicStep(TString& s) { +static bool LexicographicStep(TString& s) { if (s.length() < 4) { s += "a"; return true; @@ -343,7 +343,7 @@ void TCompactTrieTest::CheckUpperBound(const char* data, size_t datalen) { typedef typename TCompactTrie<T>::TKey TKey; typedef typename TCompactTrie<T>::TData TData; - TString key; + TString key; do { const TKey wideKey = MakeWideKey<T>(key); typename TCompactTrie<T>::TConstIterator it = trie.UpperBound(wideKey); @@ -375,7 +375,7 @@ void TCompactTrieTest::CheckData(const char* data, size_t datalen) { UNIT_ASSERT_EQUAL(len, prefixLen); UNIT_ASSERT_EQUAL(len * 2, value); - TString badkey("bb"); + TString badkey("bb"); badkey += i; key = MakeWideKey<T>(badkey); UNIT_ASSERT(!trie.Find(key)); @@ -400,7 +400,7 @@ void TCompactTrieTest::CheckData(const char* data, size_t datalen) { UNIT_ASSERT_EQUAL(len, prefixLen); } - TString testkey("fbbaa"); + TString testkey("fbbaa"); typename TCompactTrie<T>::TKey key = MakeWideKey<T>(testkey); ui64 value = 0; size_t prefixLen = 0; @@ -423,7 +423,7 @@ template <class T> void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { typedef typename TCompactTrie<T>::TKey TKey; typedef typename TCompactTrie<T>::TValueType TValue; - TMap<TKey, ui64> stored; + TMap<TKey, ui64> stored; for (auto& i : SampleData) { size_t len = strlen(i); @@ -432,10 +432,10 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { } TCompactTrie<T> trie(data, datalen); - TVector<TValue> items; + TVector<TValue> items; typename TCompactTrie<T>::TConstIterator it = trie.Begin(); size_t entry_count = 0; - TMap<TKey, ui64> received; + TMap<TKey, ui64> received; while (it != trie.End()) { UNIT_ASSERT_VALUES_EQUAL(it.GetKeySize(), it.GetKey().size()); received.insert(*it); @@ -443,7 +443,7 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { entry_count++; it++; } - TMap<TKey, ui64> received2; + TMap<TKey, ui64> received2; for (std::pair<TKey, ui64> x : trie) { received2.insert(x); } @@ -573,7 +573,7 @@ void TCompactTrieTest::TestPhraseSearch() { builder.Save(bufout); TCompactTrie<char> trie(bufout.Buffer().Data(), bufout.Buffer().Size()); - TVector<TCompactTrie<char>::TPhraseMatch> matches; + TVector<TCompactTrie<char>::TPhraseMatch> matches; trie.FindPhrases(goodphrase, strlen(goodphrase), matches); UNIT_ASSERT(matches.size() == Y_ARRAY_SIZE(phrases)); @@ -650,9 +650,9 @@ static char RandChar() { return char(RandomNumber<size_t>() % 256); } -static TString RandStr(const size_t max) { +static TString RandStr(const size_t max) { size_t len = RandomNumber<size_t>() % max; - TString key; + TString key; for (size_t j = 0; j < len; ++j) key += RandChar(); return key; @@ -662,12 +662,12 @@ template <class T, bool minimize> void TCompactTrieTest::TestRandom(const size_t n, const size_t maxKeySize) { const TStringBuf EMPTY_KEY = TStringBuf("", 1); TCompactTrieBuilder<char, typename T::TData, T> builder; - typedef TMap<TString, typename T::TData> TKeys; + typedef TMap<TString, typename T::TData> TKeys; TKeys keys; typename T::TData dummy; for (size_t i = 0; i < n; ++i) { - const TString key = RandStr(maxKeySize); + const TString key = RandStr(maxKeySize); if (key != EMPTY_KEY && keys.find(key) == keys.end()) { const typename T::TData val = T::Data(key); keys[key] = val; @@ -729,13 +729,13 @@ void TCompactTrieTest::TestRandom() { TestRandom<TStrokaPacker, true>(100, 100); } -void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { +void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { TCompactTrieBuilder<> builder; - TMap<TString, ui64> input; + TMap<TString, ui64> input; for (auto& i : SampleData) { - TString temp = i; + TString temp = i; ui64 val = temp.size() * 2; builder.Add(temp.data(), temp.size(), val); if (temp.StartsWith(prefix)) { @@ -751,7 +751,7 @@ void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { TTrie subtrie = trie.FindTails(prefix.data(), prefix.size()); - TMap<TString, ui64> output; + TMap<TString, ui64> output; for (TTrie::TConstIterator i = subtrie.Begin(), mi = subtrie.End(); i != mi; ++i) { TTrie::TValueType val = *i; @@ -847,7 +847,7 @@ void TCompactTrieTest::TestMergeFromFile() { b.Add("yandex", 12); b.Add("google", 13); b.Add("mail", 14); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru"); b.Save(out); } @@ -856,7 +856,7 @@ void TCompactTrieTest::TestMergeFromFile() { b.Add("yandex", 112); b.Add("google", 113); b.Add("yahoo", 114); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com"); b.Save(out); } @@ -865,7 +865,7 @@ void TCompactTrieTest::TestMergeFromFile() { UNIT_ASSERT(b.AddSubtreeInFile("com.", GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com")); UNIT_ASSERT(b.Add("org.kernel", 22)); UNIT_ASSERT(b.AddSubtreeInFile("ru.", GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru")); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res"); b.Save(out); } @@ -1026,7 +1026,7 @@ public: class TCompactTrieTest::TStrokaPacker: public TCompactTriePacker<TString> { public: - typedef TString TData; + typedef TString TData; static TString Data(const TString& str) { return str; @@ -1104,18 +1104,18 @@ void TCompactTrieTest::TestTrieSet() { // Tests for trie with vector (list, set) values -TVector<TUtf16String> TCompactTrieTest::GetSampleKeys(size_t nKeys) const { +TVector<TUtf16String> TCompactTrieTest::GetSampleKeys(size_t nKeys) const { Y_ASSERT(nKeys <= 10); - TString sampleKeys[] = {"a", "b", "ac", "bd", "abe", "bcf", "deg", "ah", "xy", "abc"}; - TVector<TUtf16String> result; + TString sampleKeys[] = {"a", "b", "ac", "bd", "abe", "bcf", "deg", "ah", "xy", "abc"}; + TVector<TUtf16String> result; for (size_t i = 0; i < nKeys; i++) result.push_back(ASCIIToWide(sampleKeys[i])); return result; } template <class TContainer> -TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { - TVector<TContainer> data; +TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { + TVector<TContainer> data; for (size_t i = 0; i < nValues; i++) { data.push_back(TContainer()); for (size_t j = 0; j < i; j++) @@ -1125,12 +1125,12 @@ TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { } template <class TContainer> -TVector<TContainer> TCompactTrieTest::GetSampleTextVectorData(size_t nValues) { - TVector<TContainer> data; +TVector<TContainer> TCompactTrieTest::GetSampleTextVectorData(size_t nValues) { + TVector<TContainer> data; for (size_t i = 0; i < nValues; i++) { data.push_back(TContainer()); for (size_t j = 0; j < i; j++) - data[i].insert(data[i].end(), TString("abc") + ToString<size_t>(j)); + data[i].insert(data[i].end(), TString("abc") + ToString<size_t>(j)); } return data; } @@ -1148,14 +1148,14 @@ void TCompactTrieTest::CheckEquality<TVector<i64>>(const TVector<i64>& value1, c } template <class TContainer> -void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName) { - TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; +void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName) { + TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; TCompactTrieBuilder<wchar16, TContainer> b; for (size_t i = 0; i < keys.size(); i++) { b.Add(keys[i], sampleData[i]); } - TUnbufferedFileOutput out(fileName); + TUnbufferedFileOutput out(fileName); b.Save(out); TCompactTrie<wchar16, TContainer> trie(TBlob::FromFileSingleThreaded(fileName)); @@ -1174,13 +1174,13 @@ void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, template <> void TCompactTrieTest::TestTrieWithContainers<std::pair<TUtf16String, TVector<i64>>>(const TVector<TUtf16String>& keys, const TVector<std::pair<TUtf16String, TVector<i64>>>& sampleData, TString methodName) { typedef std::pair<TUtf16String, TVector<i64>> TContainer; - TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; + TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; TCompactTrieBuilder<wchar16, TContainer> b; for (size_t i = 0; i < keys.size(); i++) { b.Add(keys[i], sampleData[i]); } - TUnbufferedFileOutput out(fileName); + TUnbufferedFileOutput out(fileName); b.Save(out); TCompactTrie<wchar16, TContainer> trie(TBlob::FromFileSingleThreaded(fileName)); @@ -1221,7 +1221,7 @@ void TCompactTrieTest::TestTrieForVectorWtroka() { TVector<TVector<TString>> data = GetSampleTextVectorData<TVector<TString>>(10); TVector<TVector<TUtf16String>> wData; for (size_t i = 0; i < data.size(); i++) { - wData.push_back(TVector<TUtf16String>()); + wData.push_back(TVector<TUtf16String>()); for (size_t j = 0; j < data[i].size(); j++) wData[i].push_back(UTF8ToWide(data[i][j])); } @@ -1237,7 +1237,7 @@ void TCompactTrieTest::TestTrieForVectorDouble() { } void TCompactTrieTest::TestTrieForListVectorInt64() { - TVector<i64> tmp; + TVector<i64> tmp; tmp.push_back(0); TList<TVector<i64>> dataElement(5, tmp); TVector<TList<TVector<i64>>> data(10, dataElement); @@ -1245,7 +1245,7 @@ void TCompactTrieTest::TestTrieForListVectorInt64() { } void TCompactTrieTest::TestTrieForPairWtrokaVectorInt64() { - TVector<TUtf16String> keys = GetSampleKeys(10); + TVector<TUtf16String> keys = GetSampleKeys(10); TVector<TVector<i64>> values = GetSampleVectorData<TVector<i64>>(10); TVector<std::pair<TUtf16String, TVector<i64>>> data; for (size_t i = 0; i < 10; i++) @@ -1295,14 +1295,14 @@ void TCompactTrieTest::TestFindLongestPrefixWithEmptyValue() { template <typename TChar> struct TConvertKey { - static inline TString Convert(const TStringBuf& key) { + static inline TString Convert(const TStringBuf& key) { return ToString(key); } }; template <> struct TConvertKey<wchar16> { - static inline TUtf16String Convert(const TStringBuf& key) { + static inline TUtf16String Convert(const TStringBuf& key) { return UTF8ToWide(key); } }; @@ -1436,8 +1436,8 @@ void TCompactTrieTest::TestFirstSymbolIteratorChar32() { void TCompactTrieTest::TestArrayPacker() { using TDataInt = std::array<int, 2>; - const std::pair<TString, TDataInt> dataXxx{"xxx", {{15, 16}}}; - const std::pair<TString, TDataInt> dataYyy{"yyy", {{20, 30}}}; + const std::pair<TString, TDataInt> dataXxx{"xxx", {{15, 16}}}; + const std::pair<TString, TDataInt> dataYyy{"yyy", {{20, 30}}}; TCompactTrieBuilder<char, TDataInt> trieBuilderOne; trieBuilderOne.Add(dataXxx.first, dataXxx.second); @@ -1450,9 +1450,9 @@ void TCompactTrieTest::TestArrayPacker() { UNIT_ASSERT_VALUES_EQUAL(dataXxx.second, trieOne.Get(dataXxx.first)); UNIT_ASSERT_VALUES_EQUAL(dataYyy.second, trieOne.Get(dataYyy.first)); - using TDataStroka = std::array<TString, 2>; - const std::pair<TString, TDataStroka> dataZzz{"zzz", {{"hello", "there"}}}; - const std::pair<TString, TDataStroka> dataWww{"www", {{"half", "life"}}}; + using TDataStroka = std::array<TString, 2>; + const std::pair<TString, TDataStroka> dataZzz{"zzz", {{"hello", "there"}}}; + const std::pair<TString, TDataStroka> dataWww{"www", {{"half", "life"}}}; TCompactTrieBuilder<char, TDataStroka> trieBuilderTwo; trieBuilderTwo.Add(dataZzz.first, dataZzz.second); @@ -1480,8 +1480,8 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix() { } void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double branchProbability, bool isPrefixGrouped, bool hasEmptyKey) { - TVector<TString> keys; - TString keyToAdd; + TVector<TString> keys; + TString keyToAdd; for (size_t i = 0; i < keysCount; ++i) { const size_t prevKeyLen = keyToAdd.Size(); // add two random chars to prev key @@ -1500,16 +1500,16 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra else Shuffle(keys.begin(), keys.end()); - TCompactTrieBuilder<char, TString> builder(isPrefixGrouped ? CTBF_PREFIX_GROUPED : CTBF_NONE); - const TString EMPTY_VALUE = "empty"; + TCompactTrieBuilder<char, TString> builder(isPrefixGrouped ? CTBF_PREFIX_GROUPED : CTBF_NONE); + const TString EMPTY_VALUE = "empty"; if (hasEmptyKey) builder.Add(nullptr, 0, EMPTY_VALUE); for (size_t i = 0; i < keysCount; ++i) { - const TString& key = keys[i]; + const TString& key = keys[i]; for (size_t j = 0; j < keysCount; ++j) { - const TString& otherKey = keys[j]; + const TString& otherKey = keys[j]; const bool exists = j < i; size_t expectedSize = 0; if (exists) { @@ -1523,7 +1523,7 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra } size_t prefixSize = 0xfcfcfc; - TString value = "abcd"; + 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)); if (expectedResult) { @@ -1539,10 +1539,10 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra } for (int c = 0; c < 10; ++c) { - TString extendedKey = otherKey; + TString extendedKey = otherKey; extendedKey += RandChar(); size_t extendedPrefixSize = 0xdddddd; - TString extendedValue = "dcba"; + TString extendedValue = "dcba"; UNIT_ASSERT_VALUES_EQUAL(expectedResult, builder.FindLongestPrefix(extendedKey.data(), extendedKey.size(), &extendedPrefixSize, &extendedValue)); if (expectedResult) { UNIT_ASSERT_VALUES_EQUAL(value, extendedValue); diff --git a/library/cpp/containers/comptrie/key_selector.h b/library/cpp/containers/comptrie/key_selector.h index 60466cef71..c4339d5a23 100644 --- a/library/cpp/containers/comptrie/key_selector.h +++ b/library/cpp/containers/comptrie/key_selector.h @@ -1,13 +1,13 @@ #pragma once #include <util/generic/vector.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> template <class T> struct TCompactTrieKeySelector { - typedef TVector<T> TKey; - typedef TVector<T> TKeyBuf; + typedef TVector<T> TKey; + typedef TVector<T> TKeyBuf; }; template <class TChar> diff --git a/library/cpp/containers/comptrie/loader/loader.h b/library/cpp/containers/comptrie/loader/loader.h index ee10e9b451..3c1efb79bb 100644 --- a/library/cpp/containers/comptrie/loader/loader.h +++ b/library/cpp/containers/comptrie/loader/loader.h @@ -1,13 +1,13 @@ #pragma once #include <library/cpp/archive/yarchive.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> #include <util/generic/yexception.h> #include <util/memory/blob.h> template <class TrieType, size_t N> -TrieType LoadTrieFromArchive(const TString& key, +TrieType LoadTrieFromArchive(const TString& key, const unsigned char (&data)[N], bool ignoreErrors = false) { TArchiveReader archive(TBlob::NoCopy(data, sizeof(data))); diff --git a/library/cpp/containers/comptrie/prefix_iterator.h b/library/cpp/containers/comptrie/prefix_iterator.h index b369bb4f42..7157d54dc1 100644 --- a/library/cpp/containers/comptrie/prefix_iterator.h +++ b/library/cpp/containers/comptrie/prefix_iterator.h @@ -26,11 +26,11 @@ private: bool Next(); public: - TPrefixIterator(const TTrie& trie, const TSymbol* aKey, size_t aKeylen) + TPrefixIterator(const TTrie& trie, const TSymbol* aKey, size_t aKeylen) : Trie(trie) - , key(aKey) - , keylen(aKeylen) - , keyend(aKey + aKeylen) + , key(aKey) + , keylen(aKeylen) + , keyend(aKey + aKeylen) , prefixLen(0) , valuepos(nullptr) , datapos(trie.DataHolder.AsCharPtr()) diff --git a/library/cpp/containers/comptrie/write_trie_backwards.h b/library/cpp/containers/comptrie/write_trie_backwards.h index 634e6b811a..84f69f078f 100644 --- a/library/cpp/containers/comptrie/write_trie_backwards.h +++ b/library/cpp/containers/comptrie/write_trie_backwards.h @@ -2,7 +2,7 @@ #include "minimize.h" -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/stream/output.h> #include <cstddef> diff --git a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp index cab2365cce..8aef3cd5b9 100644 --- a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp +++ b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp @@ -14,7 +14,7 @@ private: class TIt; struct TItCompare { - static inline bool Compare(const TIt& l, const TIt& r) noexcept; + static inline bool Compare(const TIt& l, const TIt& r) noexcept; }; class TIt: public TAvlTreeItem<TIt, TItCompare> { @@ -30,7 +30,7 @@ private: using TIts = TAvlTree<TIt, TItCompare>; }; -inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { +inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { return l.Val < r.Val; } @@ -80,12 +80,12 @@ void TAvlTreeTest::TestIterator() { its.Insert(&it6); its.Insert(&it2); - TVector<int> res; + TVector<int> res; for (const TIt& i : its) { res.push_back(i.Val); } - TVector<int> expected{1, 2, 3, 4, 5, 6, 7}; + TVector<int> expected{1, 2, 3, 4, 5, 6, 7}; UNIT_ASSERT_EQUAL(res, expected); res.clear(); diff --git a/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp b/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp index 92370760b5..9eeac01d2f 100644 --- a/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp +++ b/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp @@ -34,7 +34,7 @@ public: using TTree = TRbTree<TNode, TCmp>; extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { - TDeque<TNode> records; + TDeque<TNode> records; const ui8 half = 128u; TTree tree; for (size_t i = 0; i < size; ++i) { diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree.h b/library/cpp/containers/intrusive_rb_tree/rb_tree.h index 0259452a14..9ed6edaf1b 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree.h +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree.h @@ -18,11 +18,11 @@ struct TRbTreeNodeBase { TBasePtr Right_; size_t Children_; - inline TRbTreeNodeBase() noexcept { + inline TRbTreeNodeBase() noexcept { ReInitNode(); } - inline void ReInitNode() noexcept { + inline void ReInitNode() noexcept { Color_ = RBTreeBlack; Parent_ = nullptr; Left_ = nullptr; @@ -82,7 +82,7 @@ struct TRbTreeBaseIterator { using TBasePtr = TRbTreeNodeBase*; TBasePtr Node_; - inline TRbTreeBaseIterator(TBasePtr x = nullptr) noexcept + inline TRbTreeBaseIterator(TBasePtr x = nullptr) noexcept : Node_(x) { } @@ -98,48 +98,48 @@ struct TRbTreeIterator: public TRbTreeBaseIterator { inline TRbTreeIterator() noexcept = default; template <class T1> - inline TRbTreeIterator(const T1& x) noexcept + inline TRbTreeIterator(const T1& x) noexcept : TRbTreeBaseIterator(x) { } - inline TReference operator*() const noexcept { + inline TReference operator*() const noexcept { return *static_cast<TValue*>(Node_); } - inline TPointer operator->() const noexcept { + inline TPointer operator->() const noexcept { return static_cast<TValue*>(Node_); } - inline TSelf& operator++() noexcept { + inline TSelf& operator++() noexcept { Node_ = TRbGlobalInst::IncrementNode(Node_); return *this; } - inline TSelf operator++(int) noexcept { + inline TSelf operator++(int) noexcept { TSelf tmp = *this; ++(*this); return tmp; } - inline TSelf& operator--() noexcept { + inline TSelf& operator--() noexcept { Node_ = TRbGlobalInst::DecrementNode(Node_); return *this; } - inline TSelf operator--(int) noexcept { + inline TSelf operator--(int) noexcept { TSelf tmp = *this; --(*this); return tmp; } template <class T1> - inline bool operator==(const T1& rhs) const noexcept { + inline bool operator==(const T1& rhs) const noexcept { return Node_ == rhs.Node_; } template <class T1> - inline bool operator!=(const T1& rhs) const noexcept { + inline bool operator!=(const T1& rhs) const noexcept { return Node_ != rhs.Node_; } }; @@ -149,7 +149,7 @@ class TRbTree { struct TCmpAdaptor: public TCmp { inline TCmpAdaptor() noexcept = default; - inline TCmpAdaptor(const TCmp& cmp) noexcept + inline TCmpAdaptor(const TCmp& cmp) noexcept : TCmp(cmp) { } @@ -182,11 +182,11 @@ public: { } - inline ~TRealNode() { + inline ~TRealNode() { UnLink(); } - inline void UnLink() noexcept { + inline void UnLink() noexcept { if (Tree_) { Tree_->EraseImpl(this); ReInitNode(); @@ -194,11 +194,11 @@ public: } } - inline void SetRbTreeParent(TRbTree* parent) noexcept { + inline void SetRbTreeParent(TRbTree* parent) noexcept { Tree_ = parent; } - inline TRbTree* ParentTree() const noexcept { + inline TRbTree* ParentTree() const noexcept { return Tree_; } @@ -209,17 +209,17 @@ public: using TIterator = TRbTreeIterator<TValue, TNonConstTraits>; using TConstIterator = TRbTreeIterator<TValue, TConstTraits>; - inline TRbTree() noexcept { + inline TRbTree() noexcept { Init(); } - inline TRbTree(const TCmp& cmp) noexcept + inline TRbTree(const TCmp& cmp) noexcept : KeyCompare_(cmp) { Init(); } - inline void Init() noexcept { + inline void Init() noexcept { Data_.Color_ = RBTreeRed; Data_.Parent_ = nullptr; Data_.Left_ = &Data_; @@ -228,17 +228,17 @@ public: } struct TDestroy { - inline void operator()(TValue& v) const noexcept { + inline void operator()(TValue& v) const noexcept { v.SetRbTreeParent(nullptr); v.ReInitNode(); } }; - inline ~TRbTree() { + inline ~TRbTree() { ForEachNoOrder(TDestroy()); } - inline void Clear() noexcept { + inline void Clear() noexcept { ForEachNoOrder(TDestroy()); Init(); } @@ -257,27 +257,27 @@ public: } } - inline TIterator Begin() noexcept { + inline TIterator Begin() noexcept { return LeftMost(); } - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return LeftMost(); } - inline TIterator End() noexcept { + inline TIterator End() noexcept { return &this->Data_; } - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return const_cast<TBasePtr>(&this->Data_); } - inline bool Empty() const noexcept { + inline bool Empty() const noexcept { return this->Begin() == this->End(); } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return !this->Empty(); } @@ -314,19 +314,19 @@ public: } } - inline void Erase(TValue& val) noexcept { + inline void Erase(TValue& val) noexcept { val.UnLink(); } - inline void Erase(TValue* val) noexcept { + inline void Erase(TValue* val) noexcept { Erase(*val); } - inline void Erase(TIterator pos) noexcept { + inline void Erase(TIterator pos) noexcept { Erase(*pos); } - inline void EraseImpl(TNodeBase* val) noexcept { + inline void EraseImpl(TNodeBase* val) noexcept { TRbGlobalInst::RebalanceForErase(val, this->Data_.Parent_, this->Data_.Left_, this->Data_.Right_); } diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp index c34ed1fd9b..b1fb8d4a59 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp @@ -26,7 +26,7 @@ class TRedBlackTreeTest: public TTestBase { class TNode: public TRbTreeItem<TNode, TCmp> { public: - inline TNode(int n) noexcept + inline TNode(int n) noexcept : N(n) { } @@ -51,7 +51,7 @@ class TRedBlackTreeTest: public TTestBase { private: inline void TestStress() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; for (int i = 0; i < 1000; ++i) { nodes.push_back(new TNode(i)); @@ -78,7 +78,7 @@ private: } inline void TestGettingIndexWithDifferentValues() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -105,7 +105,7 @@ private: } inline void TestCheckChildrenAfterErase() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -138,7 +138,7 @@ private: } inline void TestGettingIndexWithDifferentValuesAfterErase() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -176,7 +176,7 @@ private: } inline void TestGettingIndexWithEqualValues() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { diff --git a/library/cpp/containers/ring_buffer/ring_buffer.h b/library/cpp/containers/ring_buffer/ring_buffer.h index 41220dcf6b..a7e694b17c 100644 --- a/library/cpp/containers/ring_buffer/ring_buffer.h +++ b/library/cpp/containers/ring_buffer/ring_buffer.h @@ -68,7 +68,7 @@ private: private: size_t MaxSize; size_t Begin = 0; - TVector<T> Items; + TVector<T> Items; }; template <typename T, size_t maxSize> diff --git a/library/cpp/containers/sorted_vector/sorted_vector.h b/library/cpp/containers/sorted_vector/sorted_vector.h index 123539af9e..d9a242ab59 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector.h +++ b/library/cpp/containers/sorted_vector/sorted_vector.h @@ -50,9 +50,9 @@ namespace NSorted { // Sorted vector, which is order by the key. The key is extracted from the value by the provided key-extractor template <typename TValueType, typename TKeyType = TValueType, class TKeyExtractor = TIdentity, class TPredicate = TLess<TKeyType>, class A = std::allocator<TValueType>> - class TSortedVector: public TVector<TValueType, A> { + class TSortedVector: public TVector<TValueType, A> { private: - typedef TVector<TValueType, A> TBase; + typedef TVector<TValueType, A> TBase; typedef NPrivate::TKeyCompare<TValueType, TPredicate, TKeyExtractor> TKeyCompare; typedef NPrivate::TEqual<TKeyCompare> TValueEqual; typedef NPrivate::TEqual<TPredicate> TKeyEqual; @@ -364,7 +364,7 @@ namespace NSorted { inline TValueType& Get(const TKeyType& key) { typename TBase::iterator i = TBase::LowerBound(key); if (i == TBase::end() || key != i->first) - return TVector<std::pair<TKeyType, TValueType>, A>::insert(i, std::make_pair(key, TValueType()))->second; + return TVector<std::pair<TKeyType, TValueType>, A>::insert(i, std::make_pair(key, TValueType()))->second; else return i->second; } @@ -437,7 +437,7 @@ namespace NSorted { inline TValueType& Get(const TKeyType& key) { typename TBase::iterator i = TBase::LowerBound(key); if (i == TBase::end() || !TKeyEqual()(TKeyExtractor()(*i), key)) - i = TVector<TValueType, A>::insert(i, TValueType(key)); + i = TVector<TValueType, A>::insert(i, TValueType(key)); return *i; } diff --git a/library/cpp/containers/stack_array/range_ops.h b/library/cpp/containers/stack_array/range_ops.h index 1d40341aa1..7b61b15758 100644 --- a/library/cpp/containers/stack_array/range_ops.h +++ b/library/cpp/containers/stack_array/range_ops.h @@ -7,7 +7,7 @@ namespace NRangeOps { template <class T, bool isTrivial> struct TRangeOpsBase { - static inline void DestroyRange(T* b, T* e) noexcept { + static inline void DestroyRange(T* b, T* e) noexcept { while (e > b) { (--e)->~T(); } @@ -30,10 +30,10 @@ namespace NRangeOps { template <class T> struct TRangeOpsBase<T, true> { - static inline void DestroyRange(T*, T*) noexcept { + static inline void DestroyRange(T*, T*) noexcept { } - static inline void InitializeRange(T*, T*) noexcept { + static inline void InitializeRange(T*, T*) noexcept { } }; @@ -41,7 +41,7 @@ namespace NRangeOps { using TRangeOps = TRangeOpsBase<T, TTypeTraits<T>::IsPod>; template <class T> - static inline void DestroyRange(T* b, T* e) noexcept { + static inline void DestroyRange(T* b, T* e) noexcept { TRangeOps<T>::DestroyRange(b, e); } diff --git a/library/cpp/containers/stack_array/stack_array.h b/library/cpp/containers/stack_array/stack_array.h index 28e49bfc3c..9f097da72c 100644 --- a/library/cpp/containers/stack_array/stack_array.h +++ b/library/cpp/containers/stack_array/stack_array.h @@ -2,12 +2,12 @@ #include "range_ops.h" -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/system/defaults.h> /* For alloca. */ namespace NStackArray { /** - * A stack-allocated array. Should be used instead of � variable length + * A stack-allocated array. Should be used instead of � variable length * arrays that are not part of C++ standard. * * Example usage: @@ -31,7 +31,7 @@ namespace NStackArray { NRangeOps::InitializeRange(this->begin(), this->end()); } - inline ~TStackArray() { + inline ~TStackArray() { NRangeOps::DestroyRange(this->begin(), this->end()); } }; diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h index fcc5d9a2a5..bb90c55381 100644 --- a/library/cpp/containers/stack_vector/stack_vec.h +++ b/library/cpp/containers/stack_vector/stack_vec.h @@ -7,7 +7,7 @@ // A vector preallocated on the stack. // After exceeding the preconfigured stack space falls back to the heap. -// Publicly inherits TVector, but disallows swap (and hence shrink_to_fit, also operator= is reimplemented via copying). +// Publicly inherits TVector, but disallows swap (and hence shrink_to_fit, also operator= is reimplemented via copying). // // Inspired by: http://qt-project.org/doc/qt-4.8/qvarlengtharray.html#details diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h index 31b00d1b99..0be25902e6 100644 --- a/library/cpp/containers/str_map/str_map.h +++ b/library/cpp/containers/str_map/str_map.h @@ -35,12 +35,12 @@ pool_insert(Map* m, const char* key, const typename Map::mapped_type& data, TBuf #define AVERAGEWORD_BUF 10 template <class T, class HashFcn, class EqualTo, class Alloc> -class string_hash: public THashMap<const char*, T, HashFcn, EqualTo, Alloc> { +class string_hash: public THashMap<const char*, T, HashFcn, EqualTo, Alloc> { protected: TBuffer pool; public: - using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>; + using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>; using iterator = typename yh::iterator; using const_iterator = typename yh::const_iterator; using mapped_type = typename yh::mapped_type; @@ -50,7 +50,7 @@ public: pool.Reserve(HASH_SIZE_DEFAULT * AVERAGEWORD_BUF); // reserve here } string_hash(size_type hash_size, pool_size_type pool_size) - : THashMap<const char*, T, HashFcn, EqualTo, Alloc>(hash_size) + : THashMap<const char*, T, HashFcn, EqualTo, Alloc>(hash_size) { pool.Reserve(pool_size); // reserve here } @@ -68,14 +68,14 @@ public: } string_hash(const string_hash& sh) - : THashMap<const char*, T, HashFcn, EqualTo, Alloc>() + : THashMap<const char*, T, HashFcn, EqualTo, Alloc>() { for (const_iterator i = sh.begin(); i != sh.end(); ++i) insert_copy((*i).first, (*i).second); } /* May be faster? string_hash(const string_hash& sh) - : THashMap<const char *, T, HashFcn, EqualTo>(sh) + : THashMap<const char *, T, HashFcn, EqualTo>(sh) { pool = sh.pool; size_t delta = pool.begin() - sh.pool.begin(); @@ -101,12 +101,12 @@ public: }; template <class C, class T, class HashFcn, class EqualTo> -class THashWithSegmentedPoolForKeys: protected THashMap<const C*, T, HashFcn, EqualTo>, TNonCopyable { +class THashWithSegmentedPoolForKeys: protected THashMap<const C*, T, HashFcn, EqualTo>, TNonCopyable { protected: segmented_pool<C> pool; public: - using yh = THashMap<const C*, T, HashFcn, EqualTo>; + using yh = THashMap<const C*, T, HashFcn, EqualTo>; using iterator = typename yh::iterator; using const_iterator = typename yh::const_iterator; using mapped_type = typename yh::mapped_type; @@ -170,7 +170,7 @@ public: return yh::find(key); } - const yh& get_THashMap() const { + const yh& get_THashMap() const { return static_cast<const yh&>(*this); } }; diff --git a/library/cpp/containers/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper.h index 2f282b5a9e..d25adb079f 100644 --- a/library/cpp/containers/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper.h @@ -10,7 +10,7 @@ class TTopKeeper { private: class TVectorWithMin { private: - TVector<T, Alloc> Internal; + TVector<T, Alloc> Internal; size_t HalfMaxSize; TComparator Comparer; size_t MinElementIndex; diff --git a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h index 2f282b5a9e..d25adb079f 100644 --- a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h @@ -10,7 +10,7 @@ class TTopKeeper { private: class TVectorWithMin { private: - TVector<T, Alloc> Internal; + TVector<T, Alloc> Internal; size_t HalfMaxSize; TComparator Comparer; size_t MinElementIndex; diff --git a/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp b/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp index a938279025..724132aed9 100644 --- a/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp +++ b/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp @@ -163,14 +163,14 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { typedef std::pair<float, unsigned int> TElementType; const size_t randomTriesCount = 128; - for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { + for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { const size_t desiredElementsCount = RandomNumber<size_t>(5) + 1; TLimitedHeap<TElementType> h1(desiredElementsCount); TTopKeeper<TElementType> h2(desiredElementsCount); const size_t elementsToInsert = RandomNumber<size_t>(10) + desiredElementsCount; UNIT_ASSERT_C(desiredElementsCount <= elementsToInsert, "Test internal invariant is broken"); - for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { + for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { const auto f = RandomNumber<float>(); const auto id = RandomNumber<unsigned int>(); @@ -185,7 +185,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { UNIT_ASSERT_EQUAL(h2.GetSize(), desiredElementsCount); const auto n = h2.GetSize(); - for (size_t i3 = 0; i3 < n; ++i3) { + for (size_t i3 = 0; i3 < n; ++i3) { UNIT_ASSERT_EQUAL(h1.GetMin(), h2.GetNext()); h1.PopMin(); h2.Pop(); @@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { Y_UNIT_TEST(CopyKeeperRegressionCase) { using TKeeper = TTopKeeper<float>; - TVector<TKeeper> v(2, TKeeper(200)); + TVector<TKeeper> v(2, TKeeper(200)); auto& k = v[1]; for (size_t i = 0; i < 100; ++i) { k.Insert(RandomNumber<float>()); diff --git a/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp b/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp index a938279025..724132aed9 100644 --- a/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp +++ b/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp @@ -163,14 +163,14 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { typedef std::pair<float, unsigned int> TElementType; const size_t randomTriesCount = 128; - for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { + for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { const size_t desiredElementsCount = RandomNumber<size_t>(5) + 1; TLimitedHeap<TElementType> h1(desiredElementsCount); TTopKeeper<TElementType> h2(desiredElementsCount); const size_t elementsToInsert = RandomNumber<size_t>(10) + desiredElementsCount; UNIT_ASSERT_C(desiredElementsCount <= elementsToInsert, "Test internal invariant is broken"); - for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { + for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { const auto f = RandomNumber<float>(); const auto id = RandomNumber<unsigned int>(); @@ -185,7 +185,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { UNIT_ASSERT_EQUAL(h2.GetSize(), desiredElementsCount); const auto n = h2.GetSize(); - for (size_t i3 = 0; i3 < n; ++i3) { + for (size_t i3 = 0; i3 < n; ++i3) { UNIT_ASSERT_EQUAL(h1.GetMin(), h2.GetNext()); h1.PopMin(); h2.Pop(); @@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { Y_UNIT_TEST(CopyKeeperRegressionCase) { using TKeeper = TTopKeeper<float>; - TVector<TKeeper> v(2, TKeeper(200)); + TVector<TKeeper> v(2, TKeeper(200)); auto& k = v[1]; for (size_t i = 0; i < 100; ++i) { k.Insert(RandomNumber<float>()); |