aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorkhlebnikov <khlebnikov@yandex-team.ru>2022-02-10 16:50:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:08 +0300
commitdf35d89845ad252e6db1c6adf84da9b15de0e3b3 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic
parent6cffcf9a14a1dd07278bd534c7cca706ec2827b3 (diff)
downloadydb-df35d89845ad252e6db1c6adf84da9b15de0e3b3.tar.gz
Restoring authorship annotation for <khlebnikov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/fwd.h8
-rw-r--r--util/generic/intrlist.h46
-rw-r--r--util/generic/intrlist_ut.cpp60
3 files changed, 57 insertions, 57 deletions
diff --git a/util/generic/fwd.h b/util/generic/fwd.h
index caa854f39f..5cc2da40e5 100644
--- a/util/generic/fwd.h
+++ b/util/generic/fwd.h
@@ -35,14 +35,14 @@ template <class T>
struct THash;
//intrusive containers
-struct TIntrusiveListDefaultTag;
-template <class T, class Tag = TIntrusiveListDefaultTag>
+struct TIntrusiveListDefaultTag;
+template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveList;
-template <class T, class D, class Tag = TIntrusiveListDefaultTag>
+template <class T, class D, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveListWithAutoDelete;
-template <class T, class Tag = TIntrusiveListDefaultTag>
+template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveSList;
template <class T, class C>
diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h
index 53c0838d36..b5d3f2051b 100644
--- a/util/generic/intrlist.h
+++ b/util/generic/intrlist.h
@@ -6,14 +6,14 @@
#include <iterator>
struct TIntrusiveListDefaultTag {};
-
+
/*
* two-way linked list
*/
-template <class T, class Tag = TIntrusiveListDefaultTag>
+template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveListItem {
private:
- using TListItem = TIntrusiveListItem<T, Tag>;
+ using TListItem = TIntrusiveListItem<T, Tag>;
public:
inline TIntrusiveListItem() noexcept
@@ -118,10 +118,10 @@ private:
TListItem* Prev_;
};
-template <class T, class Tag>
+template <class T, class Tag>
class TIntrusiveList {
private:
- using TListItem = TIntrusiveListItem<T, Tag>;
+ using TListItem = TIntrusiveListItem<T, Tag>;
template <class TListItem, class TNode>
class TIteratorBase {
@@ -365,10 +365,10 @@ public:
return std::distance(Begin(), End());
}
- inline void Remove(TListItem* item) noexcept {
- item->Unlink();
- }
-
+ inline void Remove(TListItem* item) noexcept {
+ item->Unlink();
+ }
+
inline void Clear() noexcept {
End_.Unlink();
}
@@ -584,14 +584,14 @@ private:
TListItem End_;
};
-template <class T, class D, class Tag>
-class TIntrusiveListWithAutoDelete: public TIntrusiveList<T, Tag> {
+template <class T, class D, class Tag>
+class TIntrusiveListWithAutoDelete: public TIntrusiveList<T, Tag> {
public:
- using TIterator = typename TIntrusiveList<T, Tag>::TIterator;
- using TConstIterator = typename TIntrusiveList<T, Tag>::TConstIterator;
+ using TIterator = typename TIntrusiveList<T, Tag>::TIterator;
+ using TConstIterator = typename TIntrusiveList<T, Tag>::TConstIterator;
- using TReverseIterator = typename TIntrusiveList<T, Tag>::TReverseIterator;
- using TConstReverseIterator = typename TIntrusiveList<T, Tag>::TConstReverseIterator;
+ using TReverseIterator = typename TIntrusiveList<T, Tag>::TReverseIterator;
+ using TConstReverseIterator = typename TIntrusiveList<T, Tag>::TConstReverseIterator;
using iterator = TIterator;
using const_iterator = TConstIterator;
@@ -603,7 +603,7 @@ public:
inline TIntrusiveListWithAutoDelete() noexcept = default;
inline TIntrusiveListWithAutoDelete(TIntrusiveListWithAutoDelete&& right) noexcept
- : TIntrusiveList<T, Tag>(std::move(right))
+ : TIntrusiveList<T, Tag>(std::move(right))
{
}
@@ -612,7 +612,7 @@ public:
}
TIntrusiveListWithAutoDelete& operator=(TIntrusiveListWithAutoDelete&& rhs) noexcept {
- TIntrusiveList<T, Tag>::operator=(std::move(rhs));
+ TIntrusiveList<T, Tag>::operator=(std::move(rhs));
return *this;
}
@@ -624,22 +624,22 @@ public:
}
inline static void Cut(TIterator begin, TIterator end) noexcept {
- TIntrusiveListWithAutoDelete<T, D, Tag> temp;
+ TIntrusiveListWithAutoDelete<T, D, Tag> temp;
Cut(begin, end, temp.End());
}
inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept {
- TIntrusiveList<T, Tag>::Cut(begin, end, pasteBefore);
+ TIntrusiveList<T, Tag>::Cut(begin, end, pasteBefore);
}
};
/*
* one-way linked list
*/
-template <class T, class Tag = TIntrusiveListDefaultTag>
+template <class T, class Tag = TIntrusiveListDefaultTag>
class TIntrusiveSListItem {
private:
- using TListItem = TIntrusiveSListItem<T, Tag>;
+ using TListItem = TIntrusiveSListItem<T, Tag>;
public:
inline TIntrusiveSListItem() noexcept
@@ -678,10 +678,10 @@ private:
TListItem* Next_;
};
-template <class T, class Tag>
+template <class T, class Tag>
class TIntrusiveSList {
private:
- using TListItem = TIntrusiveSListItem<T, Tag>;
+ using TListItem = TIntrusiveSListItem<T, Tag>;
public:
template <class TListItem, class TNode>
diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp
index 27baadd582..eff7cdf2ee 100644
--- a/util/generic/intrlist_ut.cpp
+++ b/util/generic/intrlist_ut.cpp
@@ -20,7 +20,7 @@ class TListTest: public TTestBase {
UNIT_TEST(TestListWithAutoDeleteMoveCtor);
UNIT_TEST(TestListWithAutoDeleteMoveOpEq);
UNIT_TEST(TestListWithAutoDeleteClear);
- UNIT_TEST(TestSecondTag);
+ UNIT_TEST(TestSecondTag);
UNIT_TEST_SUITE_END();
private:
@@ -38,7 +38,7 @@ private:
void TestListWithAutoDeleteMoveCtor();
void TestListWithAutoDeleteMoveOpEq();
void TestListWithAutoDeleteClear();
- void TestSecondTag();
+ void TestSecondTag();
};
UNIT_TEST_SUITE_REGISTRATION(TListTest);
@@ -475,38 +475,38 @@ void TListTest::TestListWithAutoDeleteClear() {
UNIT_ASSERT_EQUAL(counter, 0);
}
-
+
struct TSecondTag {};
-
-class TDoubleNode
+
+class TDoubleNode
: public TInt,
public TIntrusiveListItem<TDoubleNode, TSecondTag> {
-public:
+public:
TDoubleNode(int value) noexcept
: TInt(value)
{
}
-};
-
-void TListTest::TestSecondTag() {
- TDoubleNode zero(0), one(1);
- TIntrusiveList<TInt> first;
- TIntrusiveList<TDoubleNode, TSecondTag> second;
-
- first.PushFront(&zero);
- first.PushFront(&one);
- second.PushBack(&zero);
- second.PushBack(&one);
-
- UNIT_ASSERT_EQUAL(*first.Front(), 1);
- UNIT_ASSERT_EQUAL(*++first.Begin(), 0);
- UNIT_ASSERT_EQUAL(*first.Back(), 0);
-
- UNIT_ASSERT_EQUAL(*second.Front(), 0);
- UNIT_ASSERT_EQUAL(*++second.Begin(), 1);
- UNIT_ASSERT_EQUAL(*second.Back(), 1);
-
- second.Remove(&zero);
- UNIT_ASSERT_EQUAL(*second.Front(), 1);
- UNIT_ASSERT_EQUAL(*first.Back(), 0);
-}
+};
+
+void TListTest::TestSecondTag() {
+ TDoubleNode zero(0), one(1);
+ TIntrusiveList<TInt> first;
+ TIntrusiveList<TDoubleNode, TSecondTag> second;
+
+ first.PushFront(&zero);
+ first.PushFront(&one);
+ second.PushBack(&zero);
+ second.PushBack(&one);
+
+ UNIT_ASSERT_EQUAL(*first.Front(), 1);
+ UNIT_ASSERT_EQUAL(*++first.Begin(), 0);
+ UNIT_ASSERT_EQUAL(*first.Back(), 0);
+
+ UNIT_ASSERT_EQUAL(*second.Front(), 0);
+ UNIT_ASSERT_EQUAL(*++second.Begin(), 1);
+ UNIT_ASSERT_EQUAL(*second.Back(), 1);
+
+ second.Remove(&zero);
+ UNIT_ASSERT_EQUAL(*second.Front(), 1);
+ UNIT_ASSERT_EQUAL(*first.Back(), 0);
+}