aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers
diff options
context:
space:
mode:
authorfinder <finder@yandex-team.ru>2022-02-10 16:49:24 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:24 +0300
commit2ab6bab688484680d3ebc5c4a7e9cd3ff04fda04 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/containers
parentabbbaf4075fbaa0ff4ce9faa1188089466a21dbe (diff)
downloadydb-2ab6bab688484680d3ebc5c4a7e9cd3ff04fda04.tar.gz
Restoring authorship annotation for <finder@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers')
-rw-r--r--library/cpp/containers/2d_array/2d_array.h38
-rw-r--r--library/cpp/containers/comptrie/comptrie_ut.cpp44
2 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/containers/2d_array/2d_array.h b/library/cpp/containers/2d_array/2d_array.h
index d5ca68d8f0..9e24650637 100644
--- a/library/cpp/containers/2d_array/2d_array.h
+++ b/library/cpp/containers/2d_array/2d_array.h
@@ -1,8 +1,8 @@
-#pragma once
+#pragma once
#include <util/system/yassert.h>
#include <util/generic/algorithm.h>
-
+
#ifdef _DEBUG
template <class T>
struct TBoundCheck {
@@ -16,10 +16,10 @@ struct TBoundCheck {
Y_ASSERT(i >= 0 && i < Size);
return Data[i];
}
-};
+};
#endif
-
-template <class T>
+
+template <class T>
class TArray2D {
private:
typedef T* PT;
@@ -47,7 +47,7 @@ private:
PData[i] = Data + i * XSize;
}
-public:
+public:
TArray2D(size_t xsize = 1, size_t ysize = 1) {
XSize = xsize;
YSize = ysize;
@@ -75,17 +75,17 @@ public:
void Clear() {
SetSizes(1, 1);
}
-#ifdef _DEBUG
+#ifdef _DEBUG
TBoundCheck<T> operator[](size_t i) const {
Y_ASSERT(i < YSize);
return TBoundCheck<T>(PData[i], XSize);
}
-#else
+#else
T* operator[](size_t i) const {
Y_ASSERT(i < YSize);
return PData[i];
}
-#endif
+#endif
size_t GetXSize() const {
return XSize;
}
@@ -105,20 +105,20 @@ public:
std::swap(XSize, a.XSize);
std::swap(YSize, a.YSize);
}
-};
-
+};
+
template <class T>
inline bool operator==(const TArray2D<T>& a, const TArray2D<T>& b) {
- if (a.GetXSize() != b.GetXSize() || a.GetYSize() != b.GetYSize())
- return false;
+ if (a.GetXSize() != b.GetXSize() || a.GetYSize() != b.GetYSize())
+ return false;
for (size_t y = 0; y < a.GetYSize(); ++y) {
for (size_t x = 0; x < a.GetXSize(); ++x)
- if (a[y][x] != b[y][x])
- return false;
- }
- return true;
-}
-
+ if (a[y][x] != b[y][x])
+ return false;
+ }
+ return true;
+}
+
template <class T>
inline bool operator!=(const TArray2D<T>& a, const TArray2D<T>& b) {
return !(a == b);
diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp
index 0b95128191..74bee09b5d 100644
--- a/library/cpp/containers/comptrie/comptrie_ut.cpp
+++ b/library/cpp/containers/comptrie/comptrie_ut.cpp
@@ -70,9 +70,9 @@ private:
UNIT_TEST(TestUnique);
UNIT_TEST(TestAddRetValue);
UNIT_TEST(TestClear);
-
+
UNIT_TEST(TestIterateEmptyKey);
-
+
UNIT_TEST(TestTrieSet);
UNIT_TEST(TestTrieForVectorInt64);
@@ -207,8 +207,8 @@ public:
void TestUnique();
void TestAddRetValue();
void TestClear();
-
- void TestIterateEmptyKey();
+
+ void TestIterateEmptyKey();
void TestTrieSet();
@@ -1042,24 +1042,24 @@ public:
return RandomNumber<std::make_unsigned_t<T>>();
}
};
-
-void TCompactTrieTest::TestIterateEmptyKey() {
- TBuffer trieBuffer;
- {
- TCompactTrieBuilder<char, ui32> builder;
- UNIT_ASSERT(builder.Add("", 1));
- TBufferStream trieBufferO(trieBuffer);
- builder.Save(trieBufferO);
- }
- TCompactTrie<char, ui32> trie(TBlob::FromBuffer(trieBuffer));
- ui32 val;
- UNIT_ASSERT(trie.Find("", &val));
- UNIT_ASSERT(val == 1);
- TCompactTrie<char, ui32>::TConstIterator it = trie.Begin();
- UNIT_ASSERT(it.GetKey().empty());
- UNIT_ASSERT(it.GetValue() == 1);
-}
-
+
+void TCompactTrieTest::TestIterateEmptyKey() {
+ TBuffer trieBuffer;
+ {
+ TCompactTrieBuilder<char, ui32> builder;
+ UNIT_ASSERT(builder.Add("", 1));
+ TBufferStream trieBufferO(trieBuffer);
+ builder.Save(trieBufferO);
+ }
+ TCompactTrie<char, ui32> trie(TBlob::FromBuffer(trieBuffer));
+ ui32 val;
+ UNIT_ASSERT(trie.Find("", &val));
+ UNIT_ASSERT(val == 1);
+ TCompactTrie<char, ui32>::TConstIterator it = trie.Begin();
+ UNIT_ASSERT(it.GetKey().empty());
+ UNIT_ASSERT(it.GetValue() == 1);
+}
+
void TCompactTrieTest::TestTrieSet() {
TBuffer buffer;
{