aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/generic
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/algorithm.h32
-rw-r--r--util/generic/algorithm_ut.cpp16
-rw-r--r--util/generic/bitmap.h2
-rw-r--r--util/generic/bitops.h2
-rw-r--r--util/generic/buffer.h8
-rw-r--r--util/generic/cast.h2
-rw-r--r--util/generic/deque.h2
-rw-r--r--util/generic/hash.h4
-rw-r--r--util/generic/intrlist.h2
-rw-r--r--util/generic/iterator.h2
-rw-r--r--util/generic/list.h2
-rw-r--r--util/generic/map.h2
-rw-r--r--util/generic/map_ut.cpp16
-rw-r--r--util/generic/maybe.h2
-rw-r--r--util/generic/maybe_ut.cpp20
-rw-r--r--util/generic/noncopyable.h20
-rw-r--r--util/generic/ptr.h8
-rw-r--r--util/generic/refcount.h2
-rw-r--r--util/generic/set.h2
-rw-r--r--util/generic/singleton.h2
-rw-r--r--util/generic/stack.h2
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/strbuf.h6
-rw-r--r--util/generic/strfcpy.h2
-rw-r--r--util/generic/string.h2
-rw-r--r--util/generic/typelist.h2
-rw-r--r--util/generic/typetraits.h2
-rw-r--r--util/generic/utility.h2
-rw-r--r--util/generic/variant.h12
-rw-r--r--util/generic/vector.h2
-rw-r--r--util/generic/yexception.h4
-rw-r--r--util/generic/yexception_ut.h2
-rw-r--r--util/generic/ylimits.h2
-rw-r--r--util/generic/ymath.h2
-rw-r--r--util/generic/ymath_ut.cpp2
35 files changed, 97 insertions, 97 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index 3d73275c31..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "is_in.h"
#include "utility.h"
@@ -308,11 +308,11 @@ static inline T Unique(T f, T l, P p) {
return std::unique(f, l, p);
}
-template <class T, class TGetKey>
-static inline T UniqueBy(T f, T l, const TGetKey& getKey) {
- return Unique(f, l, [&](auto&& left, auto&& right) { return getKey(left) == getKey(right); });
-}
-
+template <class T, class TGetKey>
+static inline T UniqueBy(T f, T l, const TGetKey& getKey) {
+ return Unique(f, l, [&](auto&& left, auto&& right) { return getKey(left) == getKey(right); });
+}
+
template <class C>
void SortUnique(C& c) {
Sort(c.begin(), c.end());
@@ -325,18 +325,18 @@ void SortUnique(C& c, Cmp cmp) {
c.erase(Unique(c.begin(), c.end()), c.end());
}
-template <class C, class TGetKey>
-void SortUniqueBy(C& c, const TGetKey& getKey) {
- SortBy(c, getKey);
+template <class C, class TGetKey>
+void SortUniqueBy(C& c, const TGetKey& getKey) {
+ SortBy(c, getKey);
c.erase(UniqueBy(c.begin(), c.end(), getKey), c.end());
-}
-
-template <class C, class TGetKey>
-void StableSortUniqueBy(C& c, const TGetKey& getKey) {
- StableSortBy(c, getKey);
+}
+
+template <class C, class TGetKey>
+void StableSortUniqueBy(C& c, const TGetKey& getKey) {
+ StableSortBy(c, getKey);
c.erase(UniqueBy(c.begin(), c.end(), getKey), c.end());
-}
-
+}
+
template <class C, class TValue>
void Erase(C& c, const TValue& value) {
c.erase(std::remove(c.begin(), c.end(), value), c.end());
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index a26e70a3d6..8d732fcc0c 100644
--- a/util/generic/algorithm_ut.cpp
+++ b/util/generic/algorithm_ut.cpp
@@ -517,18 +517,18 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {
Y_UNIT_TEST(SortUniqueByTest) {
TVector<int> collection = {404, 101, 101, 203, 101, 203, 404};
- StableSortUniqueBy(collection, [](int x) { return x / 100; });
+ StableSortUniqueBy(collection, [](int x) { return x / 100; });
TVector<int> expected = {101, 203, 404};
- UNIT_ASSERT_VALUES_EQUAL(collection, expected);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(collection, expected);
+ }
+
Y_UNIT_TEST(StableSortUniqueByTest) {
TVector<int> collection = {404, 101, 106, 203, 102, 205, 401};
- StableSortUniqueBy(collection, [](int x) { return x / 100; });
+ StableSortUniqueBy(collection, [](int x) { return x / 100; });
TVector<int> expected = {101, 203, 404};
- UNIT_ASSERT_VALUES_EQUAL(collection, expected);
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(collection, expected);
+ }
+
Y_UNIT_TEST(IotaTest) {
TVector<int> v(10);
diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h
index da5dcbc74d..f77d182460 100644
--- a/util/generic/bitmap.h
+++ b/util/generic/bitmap.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "ptr.h"
diff --git a/util/generic/bitops.h b/util/generic/bitops.h
index cbe342f170..2db15fc59b 100644
--- a/util/generic/bitops.h
+++ b/util/generic/bitops.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "ylimits.h"
#include "typelist.h"
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 7e6c3d3a99..9576467404 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "utility.h"
@@ -8,7 +8,7 @@
#include <cstring>
-class TBuffer {
+class TBuffer {
public:
using TIterator = char*;
using TConstIterator = const char*;
@@ -23,7 +23,7 @@ public:
{
*this = b;
}
-
+
TBuffer(TBuffer&& b) noexcept;
TBuffer& operator=(TBuffer&& b) noexcept;
@@ -34,7 +34,7 @@ public:
}
return *this;
}
-
+
~TBuffer();
inline void Clear() noexcept {
diff --git a/util/generic/cast.h b/util/generic/cast.h
index 0ca257a7a2..0d4a41f385 100644
--- a/util/generic/cast.h
+++ b/util/generic/cast.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "typetraits.h"
#include "yexception.h"
diff --git a/util/generic/deque.h b/util/generic/deque.h
index 2079c70ba5..2dabaf3177 100644
--- a/util/generic/deque.h
+++ b/util/generic/deque.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
diff --git a/util/generic/hash.h b/util/generic/hash.h
index 69ba84dec6..e46db21fa9 100644
--- a/util/generic/hash.h
+++ b/util/generic/hash.h
@@ -701,7 +701,7 @@ public:
*ins = tmp;
++num_elements;
return iterator(tmp);
- }
+ }
template <typename... Args>
std::pair<iterator, bool> emplace_unique(Args&&... args) {
@@ -1616,7 +1616,7 @@ public:
const_iterator find(const TheKey& key) const {
return rep.find(key);
}
-
+
template <class TheKey>
iterator find(const TheKey& key, insert_ctx& ins) {
return rep.find_i(key, ins);
diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h
index becab74c4f..b5d3f2051b 100644
--- a/util/generic/intrlist.h
+++ b/util/generic/intrlist.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "utility.h"
diff --git a/util/generic/iterator.h b/util/generic/iterator.h
index 1a9a856132..19e9d20976 100644
--- a/util/generic/iterator.h
+++ b/util/generic/iterator.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <iterator>
#include <utility>
diff --git a/util/generic/list.h b/util/generic/list.h
index df16951531..7b0b8ffc72 100644
--- a/util/generic/list.h
+++ b/util/generic/list.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
diff --git a/util/generic/map.h b/util/generic/map.h
index 3a8f4bc2a9..b5001b56c0 100644
--- a/util/generic/map.h
+++ b/util/generic/map.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "mapfindptr.h"
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index e6bce5ebab..79e832b024 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -1,40 +1,40 @@
#include "map.h"
#include <library/cpp/testing/unittest/registar.h>
-#include <util/memory/pool.h>
+#include <util/memory/pool.h>
#include <algorithm>
Y_UNIT_TEST_SUITE(TYMapTest) {
template <typename TAlloc>
void DoTestMap1(TMap<char, int, TLess<char>, TAlloc>& m);
-
+
template <typename TAlloc>
void DoTestMMap1(TMultiMap<char, int, TLess<char>, TAlloc>& mm);
-
+
Y_UNIT_TEST(TestMap1) {
{
TMap<char, int, TLess<char>> m;
DoTestMap1(m);
- }
+ }
{
TMemoryPool p(100);
TMap<char, int, TLess<char>, TPoolAllocator> m(&p);
DoTestMap1(m);
}
}
-
+
Y_UNIT_TEST(TestMMap1) {
{
TMultiMap<char, int, TLess<char>> mm;
DoTestMMap1(mm);
- }
+ }
{
TMemoryPool p(100);
TMultiMap<char, int, TLess<char>, TPoolAllocator> mm(&p);
DoTestMMap1(mm);
}
}
-
+
template <typename TAlloc>
void DoTestMap1(TMap<char, int, TLess<char>, TAlloc>& m) {
using maptype = TMap<char, int, TLess<char>, TAlloc>;
@@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
template <typename TAlloc>
void DoTestMMap1(TMultiMap<char, int, TLess<char>, TAlloc>& m) {
using mmap = TMultiMap<char, int, TLess<char>, TAlloc>;
-
+
UNIT_ASSERT(m.count('X') == 0);
m.insert(std::pair<const char, int>('X', 10)); // Standard way.
diff --git a/util/generic/maybe.h b/util/generic/maybe.h
index a897490ca6..34d21aebcd 100644
--- a/util/generic/maybe.h
+++ b/util/generic/maybe.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <utility>
diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp
index f11bdcb730..2c1a425c5e 100644
--- a/util/generic/maybe_ut.cpp
+++ b/util/generic/maybe_ut.cpp
@@ -225,20 +225,20 @@ Y_UNIT_TEST_SUITE(TMaybeTest) {
Y_UNIT_TEST(TestGetOr) {
UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse("xxx"), TString("xxx"));
UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse("xxx"), TString("yyy"));
-
- {
+
+ {
TString xxx = "xxx";
UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse(xxx).append('x'), TString("xxxx"));
- UNIT_ASSERT_VALUES_EQUAL(xxx, "xxxx");
- }
-
- {
+ UNIT_ASSERT_VALUES_EQUAL(xxx, "xxxx");
+ }
+
+ {
TString xxx = "xxx";
UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse(xxx).append('x'), TString("yyyx"));
- UNIT_ASSERT_VALUES_EQUAL(xxx, "xxx");
- }
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(xxx, "xxx");
+ }
+ }
+
/*
==
!=
diff --git a/util/generic/noncopyable.h b/util/generic/noncopyable.h
index a50961b7b6..c007934133 100644
--- a/util/generic/noncopyable.h
+++ b/util/generic/noncopyable.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
/**
* @class TNonCopyable
@@ -21,18 +21,18 @@ namespace NNonCopyable { // protection from unintended ADL
TNonCopyable() = default;
~TNonCopyable() = default;
};
-
+
struct TMoveOnly {
TMoveOnly(TMoveOnly&&) noexcept = default;
TMoveOnly& operator=(TMoveOnly&&) noexcept = default;
-
- TMoveOnly(const TMoveOnly&) = delete;
- TMoveOnly& operator=(const TMoveOnly&) = delete;
-
- TMoveOnly() = default;
- ~TMoveOnly() = default;
- };
+
+ TMoveOnly(const TMoveOnly&) = delete;
+ TMoveOnly& operator=(const TMoveOnly&) = delete;
+
+ TMoveOnly() = default;
+ ~TMoveOnly() = default;
+ };
}
using TNonCopyable = NNonCopyable::TNonCopyable;
-using TMoveOnly = NNonCopyable::TMoveOnly;
+using TMoveOnly = NNonCopyable::TMoveOnly;
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 043d264316..19db0e3ec5 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "utility.h"
@@ -41,13 +41,13 @@ inline void CheckedArrayDelete(T* t) {
delete[] t;
}
-class TNoAction {
+class TNoAction {
public:
template <class T>
static inline void Destroy(T*) noexcept {
}
-};
-
+};
+
class TDelete {
public:
template <class T>
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 10460ad632..966e853b77 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/guard.h>
#include <util/system/atomic.h>
diff --git a/util/generic/set.h b/util/generic/set.h
index 373f42f984..4c437ca26f 100644
--- a/util/generic/set.h
+++ b/util/generic/set.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
diff --git a/util/generic/singleton.h b/util/generic/singleton.h
index bedfa7adbe..f5fa047f5c 100644
--- a/util/generic/singleton.h
+++ b/util/generic/singleton.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/atexit.h>
#include <util/system/atomic.h>
diff --git a/util/generic/stack.h b/util/generic/stack.h
index c07c58faa2..dbcbf2b5c9 100644
--- a/util/generic/stack.h
+++ b/util/generic/stack.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "deque.h"
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index 050a32bfb4..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// Some of these includes are just a legacy from previous implementation.
// We don't need them here, but removing them is tricky because it breaks all
diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h
index 18576be409..70b9360d58 100644
--- a/util/generic/strbuf.h
+++ b/util/generic/strbuf.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "strbase.h"
@@ -345,14 +345,14 @@ public:
}
public:
- // returns tail, including pos
+ // returns tail, including pos
TdSelf SplitOffAt(size_t pos) {
const TdSelf tok = SubStr(pos);
Trunc(pos);
return tok;
}
- // returns head, tail includes pos
+ // returns head, tail includes pos
TdSelf NextTokAt(size_t pos) {
const TdSelf tok = Head(pos);
Skip(pos);
diff --git a/util/generic/strfcpy.h b/util/generic/strfcpy.h
index b44f797185..8a95bc3df2 100644
--- a/util/generic/strfcpy.h
+++ b/util/generic/strfcpy.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
/*
* strfcpy is a faster version of strlcpy().
diff --git a/util/generic/string.h b/util/generic/string.h
index 9375f5a3d6..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <cstddef>
#include <cstring>
diff --git a/util/generic/typelist.h b/util/generic/typelist.h
index a964fa3071..5ce26ab97c 100644
--- a/util/generic/typelist.h
+++ b/util/generic/typelist.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/types.h>
diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h
index 2811cf81ab..d165bd1a06 100644
--- a/util/generic/typetraits.h
+++ b/util/generic/typetraits.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "va_args.h"
diff --git a/util/generic/utility.h b/util/generic/utility.h
index bb0534d297..43b98eeafc 100644
--- a/util/generic/utility.h
+++ b/util/generic/utility.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "typetraits.h"
diff --git a/util/generic/variant.h b/util/generic/variant.h
index 9c88969623..749fc75090 100644
--- a/util/generic/variant.h
+++ b/util/generic/variant.h
@@ -1,18 +1,18 @@
#pragma once
#include "hash.h"
-
+
#include <variant>
-
-template <class... Ts>
+
+template <class... Ts>
struct THash<std::variant<Ts...>> {
-public:
+public:
size_t operator()(const std::variant<Ts...>& v) const noexcept {
return CombineHashes(
IntHash(v.index()),
v.valueless_by_exception() ? 0 : std::visit([](const auto& value) { return ComputeHash(value); }, v));
- }
-};
+ }
+};
template <>
struct THash<std::monostate> {
diff --git a/util/generic/vector.h b/util/generic/vector.h
index d635ad773d..a5b258955a 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "fwd.h"
#include "reserve.h"
diff --git a/util/generic/yexception.h b/util/generic/yexception.h
index cde2c87c7b..b0c604e8c4 100644
--- a/util/generic/yexception.h
+++ b/util/generic/yexception.h
@@ -1,7 +1,7 @@
-#pragma once
+#pragma once
#include "bt_exception.h"
-#include "strbuf.h"
+#include "strbuf.h"
#include "string.h"
#include "utility.h"
#include "va_args.h"
diff --git a/util/generic/yexception_ut.h b/util/generic/yexception_ut.h
index ce5546cda4..acf6f27e99 100644
--- a/util/generic/yexception_ut.h
+++ b/util/generic/yexception_ut.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#ifdef __cplusplus
extern "C" {
diff --git a/util/generic/ylimits.h b/util/generic/ylimits.h
index 5f02998c56..fe42b4dfc0 100644
--- a/util/generic/ylimits.h
+++ b/util/generic/ylimits.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <limits>
diff --git a/util/generic/ymath.h b/util/generic/ymath.h
index 3a9078e6a6..9ff9ae2abe 100644
--- a/util/generic/ymath.h
+++ b/util/generic/ymath.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/yassert.h>
#include <util/system/defaults.h>
diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp
index 87fd0ad0fa..29190b55eb 100644
--- a/util/generic/ymath_ut.cpp
+++ b/util/generic/ymath_ut.cpp
@@ -1,4 +1,4 @@
-#include "bitops.h"
+#include "bitops.h"
#include "ymath.h"
#include <library/cpp/testing/unittest/registar.h>