aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorpavelgur <pavelgur@yandex-team.ru>2022-02-10 16:50:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:19 +0300
commit173c6a0fa7f439b2c207c2f258e52ccb4ac181cf (patch)
treeccc1431399e20197a8533f3d4bd0eb9a4bb8db62 /util/generic
parentda16e7702d9b0a8a42761ad877f102ef6aa85ec0 (diff)
downloadydb-173c6a0fa7f439b2c207c2f258e52ccb4ac181cf.tar.gz
Restoring authorship annotation for <pavelgur@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/algorithm.h8
-rw-r--r--util/generic/array_ref.h6
-rw-r--r--util/generic/array_ref_ut.cpp18
-rw-r--r--util/generic/hash.h24
-rw-r--r--util/generic/hash_set.h2
-rw-r--r--util/generic/hash_ut.cpp22
-rw-r--r--util/generic/noncopyable.h4
-rw-r--r--util/generic/queue_ut.cpp42
-rw-r--r--util/generic/utility.h24
-rw-r--r--util/generic/utility_ut.cpp4
10 files changed, 77 insertions, 77 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index badfb889933..2d184ee7e08 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -439,10 +439,10 @@ static inline void Fill(I f, I l, const T& v) {
}
template <typename I, typename S, typename T>
-static inline I FillN(I f, S n, const T& v) {
- return std::fill_n(f, n, v);
-}
-
+static inline I FillN(I f, S n, const T& v) {
+ return std::fill_n(f, n, v);
+}
+
template <class T>
static inline void Reverse(T f, T l) {
std::reverse(f, l);
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h
index 1ac60ac7d3c..ddaf6bdceb4 100644
--- a/util/generic/array_ref.h
+++ b/util/generic/array_ref.h
@@ -2,10 +2,10 @@
#include <util/generic/yexception.h>
-#include <algorithm>
+#include <algorithm>
#include <initializer_list>
#include <iterator>
-
+
/**
* `TArrayRef` works pretty much like `std::span` with dynamic extent, presenting
* an array-like interface into a contiguous sequence of objects.
@@ -77,7 +77,7 @@ public:
bool operator==(const TArrayRef<TT>& other) const noexcept {
return (S_ == other.size()) && std::equal(begin(), end(), other.begin());
}
-
+
constexpr inline T* data() const noexcept {
return T_;
}
diff --git a/util/generic/array_ref_ut.cpp b/util/generic/array_ref_ut.cpp
index 4c8eaf7135a..89add6e8d14 100644
--- a/util/generic/array_ref_ut.cpp
+++ b/util/generic/array_ref_ut.cpp
@@ -139,27 +139,27 @@ Y_UNIT_TEST_SUITE(TestArrayRef) {
UNIT_ASSERT_VALUES_EQUAL(autoSizeRef[0], '4');
UNIT_ASSERT_VALUES_EQUAL(autoSizeRef[3], '\0');
}
-
+
Y_UNIT_TEST(TestEqualityOperator) {
- static constexpr size_t size = 5;
+ static constexpr size_t size = 5;
int a[size]{1, 2, 3, 4, 5};
int b[size]{5, 4, 3, 2, 1};
int c[size - 1]{5, 4, 3, 2};
float d[size]{1.f, 2.f, 3.f, 4.f, 5.f};
-
+
TArrayRef<int> aRef(a);
TConstArrayRef<int> aConstRef(a, size);
-
+
TArrayRef<int> bRef(b);
-
+
TArrayRef<int> cRef(c, size - 1);
-
+
TArrayRef<float> dRef(d, size);
TConstArrayRef<float> dConstRef(d, size);
-
+
UNIT_ASSERT_EQUAL(aRef, aConstRef);
UNIT_ASSERT_EQUAL(dRef, dConstRef);
-
+
UNIT_ASSERT_UNEQUAL(aRef, cRef);
UNIT_ASSERT_UNEQUAL(aRef, bRef);
@@ -167,7 +167,7 @@ Y_UNIT_TEST_SUITE(TestArrayRef) {
//Testing if operator== compares values, not pointers
UNIT_ASSERT_EQUAL(cRef, bSubRef);
- }
+ }
Y_UNIT_TEST(TestImplicitConstructionFromContainer) {
/* Just test compilation. */
diff --git a/util/generic/hash.h b/util/generic/hash.h
index e46db21fa97..cb6672cf626 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -1461,7 +1461,7 @@ public:
}
template <class TAllocParam>
explicit THashMap(TAllocParam* allocParam, size_type n = 0)
- : rep(n, hasher(), key_equal(), allocParam)
+ : rep(n, hasher(), key_equal(), allocParam)
{
}
explicit THashMap(size_type n)
@@ -1509,13 +1509,13 @@ public:
}
THashMap(const std::initializer_list<std::pair<Key, T>>& list)
- : rep(list.size(), hasher(), key_equal())
- {
- for (const auto& v : list) {
- rep.insert_unique_noresize(v);
- }
- }
-
+ : rep(list.size(), hasher(), key_equal())
+ {
+ for (const auto& v : list) {
+ rep.insert_unique_noresize(v);
+ }
+ }
+
// THashMap has implicit copy/move constructors and copy-/move-assignment operators
// because its implementation is backed by THashTable.
// See hash_ut.cpp
@@ -1579,10 +1579,10 @@ public:
return rep.insert_unique_noresize(obj);
}
- template <typename... Args>
- std::pair<iterator, bool> emplace_noresize(Args&&... args) {
- return rep.emplace_unique_noresize(std::forward<Args>(args)...);
- }
+ template <typename... Args>
+ std::pair<iterator, bool> emplace_noresize(Args&&... args) {
+ return rep.emplace_unique_noresize(std::forward<Args>(args)...);
+ }
template <class TheObj>
iterator insert_direct(const TheObj& obj, const insert_ctx& ins) {
diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h
index e8088cf23b4..309782304a1 100644
--- a/util/generic/hash_set.h
+++ b/util/generic/hash_set.h
@@ -47,7 +47,7 @@ public:
}
template <class TT>
explicit THashSet(TT* allocParam, size_type n = 0)
- : rep(n, hasher(), key_equal(), allocParam)
+ : rep(n, hasher(), key_equal(), allocParam)
{
}
explicit THashSet(size_type n)
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp
index 0551d587708..873a5ecebcd 100644
--- a/util/generic/hash_ut.cpp
+++ b/util/generic/hash_ut.cpp
@@ -147,19 +147,19 @@ void THashTest::TestHMapConstructorsAndAssignments() {
UNIT_ASSERT_VALUES_EQUAL(0, c2.size());
UNIT_ASSERT_VALUES_EQUAL(4, c3.size());
UNIT_ASSERT_VALUES_EQUAL(4, c3.at("four"));
-
+
const container c4{
{"one", 1},
{"two", 2},
- {"three", 3},
+ {"three", 3},
{"four", 4},
- };
-
- UNIT_ASSERT_VALUES_EQUAL(4, c4.size());
- UNIT_ASSERT_VALUES_EQUAL(1, c4.at("one"));
- UNIT_ASSERT_VALUES_EQUAL(2, c4.at("two"));
- UNIT_ASSERT_VALUES_EQUAL(3, c4.at("three"));
- UNIT_ASSERT_VALUES_EQUAL(4, c4.at("four"));
+ };
+
+ UNIT_ASSERT_VALUES_EQUAL(4, c4.size());
+ UNIT_ASSERT_VALUES_EQUAL(1, c4.at("one"));
+ UNIT_ASSERT_VALUES_EQUAL(2, c4.at("two"));
+ UNIT_ASSERT_VALUES_EQUAL(3, c4.at("three"));
+ UNIT_ASSERT_VALUES_EQUAL(4, c4.at("four"));
// non-existent values must be zero-initialized
UNIT_ASSERT_VALUES_EQUAL(c1["nonexistent"], 0);
@@ -1035,8 +1035,8 @@ void THashTest::TestHSetEmplaceDirect() {
hash.emplace_direct(ins, 1);
UNIT_ASSERT(hash.contains(0));
UNIT_ASSERT(!hash.contains(1));
-}
-
+}
+
void THashTest::TestNonCopyable() {
struct TValue: public TNonCopyable {
int value;
diff --git a/util/generic/noncopyable.h b/util/generic/noncopyable.h
index c007934133b..c4a1143f8b0 100644
--- a/util/generic/noncopyable.h
+++ b/util/generic/noncopyable.h
@@ -23,8 +23,8 @@ namespace NNonCopyable { // protection from unintended ADL
};
struct TMoveOnly {
- TMoveOnly(TMoveOnly&&) noexcept = default;
- TMoveOnly& operator=(TMoveOnly&&) noexcept = default;
+ TMoveOnly(TMoveOnly&&) noexcept = default;
+ TMoveOnly& operator=(TMoveOnly&&) noexcept = default;
TMoveOnly(const TMoveOnly&) = delete;
TMoveOnly& operator=(const TMoveOnly&) = delete;
diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp
index a33399e1048..c747e33ac4f 100644
--- a/util/generic/queue_ut.cpp
+++ b/util/generic/queue_ut.cpp
@@ -130,28 +130,28 @@ Y_UNIT_TEST_SUITE(TYQueueTest) {
Y_UNIT_TEST(pqueue4) {
TDeque<int> c;
- c.push_back(42);
- c.push_back(101);
- c.push_back(69);
-
+ c.push_back(42);
+ c.push_back(101);
+ c.push_back(69);
+
TPriorityQueue<int, TDeque<int>, TLess<int>> q(TLess<int>(), std::move(c));
-
- UNIT_ASSERT(c.empty());
-
- UNIT_ASSERT_EQUAL(q.size(), 3);
-
- UNIT_ASSERT(q.top() == 101);
-
- q.pop();
- UNIT_ASSERT(q.top() == 69);
-
- q.pop();
- UNIT_ASSERT(q.top() == 42);
-
- q.pop();
- UNIT_ASSERT(q.empty());
- }
-
+
+ UNIT_ASSERT(c.empty());
+
+ UNIT_ASSERT_EQUAL(q.size(), 3);
+
+ UNIT_ASSERT(q.top() == 101);
+
+ q.pop();
+ UNIT_ASSERT(q.top() == 69);
+
+ q.pop();
+ UNIT_ASSERT(q.top() == 42);
+
+ q.pop();
+ UNIT_ASSERT(q.empty());
+ }
+
Y_UNIT_TEST(queue1) {
TQueue<int, TList<int>> q;
diff --git a/util/generic/utility.h b/util/generic/utility.h
index 43b98eeafc7..36501499b73 100644
--- a/util/generic/utility.h
+++ b/util/generic/utility.h
@@ -30,18 +30,18 @@ constexpr const T& ClampVal(const T& val, const T& min, const T& max) {
return val < min ? min : (max < val ? max : val);
}
-template <typename T = double, typename... Args>
-static T Mean(const Args&... other) noexcept {
- const auto numArgs = sizeof...(other);
-
- auto sum = T();
- for (const auto& v : {other...}) {
- sum += v;
- }
-
- return sum / numArgs;
-}
-
+template <typename T = double, typename... Args>
+static T Mean(const Args&... other) noexcept {
+ const auto numArgs = sizeof...(other);
+
+ auto sum = T();
+ for (const auto& v : {other...}) {
+ sum += v;
+ }
+
+ return sum / numArgs;
+}
+
template <class T>
static inline void Zero(T& t) noexcept {
memset((void*)&t, 0, sizeof(t));
diff --git a/util/generic/utility_ut.cpp b/util/generic/utility_ut.cpp
index 8e9d5afff9b..c2893dca03c 100644
--- a/util/generic/utility_ut.cpp
+++ b/util/generic/utility_ut.cpp
@@ -1,5 +1,5 @@
#include "utility.h"
-#include "ymath.h"
+#include "ymath.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TUtilityTest) {
UNIT_ASSERT_VALUES_EQUAL(Min(TUnorderedTag{"first"}, TUnorderedTag{"second"}, TUnorderedTag{"third"}).Tag, "first");
UNIT_ASSERT_VALUES_EQUAL(Max(TUnorderedTag{"first"}, TUnorderedTag{"second"}, TUnorderedTag{"third"}).Tag, "first");
}
-
+
Y_UNIT_TEST(TestMean) {
UNIT_ASSERT_EQUAL(Mean(5), 5);
UNIT_ASSERT_EQUAL(Mean(1, 2, 3), 2);