aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorcerevra <cerevra@yandex-team.ru>2022-02-10 16:45:59 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:59 +0300
commit4f292c7e2fd0a41da93fda51b2d440c979a330b7 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/generic
parentbf41dd01f6c920583e9faae7cd55ed25e547e052 (diff)
downloadydb-4f292c7e2fd0a41da93fda51b2d440c979a330b7.tar.gz
Restoring authorship annotation for <cerevra@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/benchmark/log2/main.cpp2
-rw-r--r--util/generic/benchmark/log2/ya.make2
-rw-r--r--util/generic/ptr.h8
-rw-r--r--util/generic/strbase.h142
-rw-r--r--util/generic/string.h18
-rw-r--r--util/generic/string_transparent_hash_ut.cpp2
-rw-r--r--util/generic/string_ut.h84
-rw-r--r--util/generic/ut/ya.make2
8 files changed, 130 insertions, 130 deletions
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
index c670f24adf..969f09a309 100644
--- a/util/generic/benchmark/log2/main.cpp
+++ b/util/generic/benchmark/log2/main.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/benchmark/bench.h>
-#include <library/cpp/fast_log/fast_log.h>
+#include <library/cpp/fast_log/fast_log.h>
#include <util/generic/singleton.h>
#include <util/generic/vector.h>
diff --git a/util/generic/benchmark/log2/ya.make b/util/generic/benchmark/log2/ya.make
index 3a5d702240..45d751909e 100644
--- a/util/generic/benchmark/log2/ya.make
+++ b/util/generic/benchmark/log2/ya.make
@@ -11,7 +11,7 @@ SRCS(
)
PEERDIR(
- library/cpp/fast_log
+ library/cpp/fast_log
)
END()
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index acd7949767..19db0e3ec5 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -686,10 +686,10 @@ public:
TIntrusiveConstPtr(nullptr).Swap(*this);
}
- inline long RefCount() const noexcept {
- return T_ ? Ops::RefCount(T_) : 0;
- }
-
+ inline long RefCount() const noexcept {
+ return T_ ? Ops::RefCount(T_) : 0;
+ }
+
#ifdef __cpp_impl_three_way_comparison
template <class Other>
inline bool operator==(const Other& p) const noexcept {
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index 2f74e8d898..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -51,61 +51,61 @@ public:
using const_iterator = const TCharType*;
using const_reference = const TCharType&;
- template <typename TBase>
- struct TReverseIteratorBase {
- constexpr TReverseIteratorBase() noexcept = default;
- explicit constexpr TReverseIteratorBase(TBase p)
- : P_(p)
- {
- }
-
- TReverseIteratorBase operator++() noexcept {
- --P_;
- return *this;
- }
-
- TReverseIteratorBase operator++(int) noexcept {
- TReverseIteratorBase old(*this);
- --P_;
- return old;
- }
-
- TReverseIteratorBase& operator--() noexcept {
- ++P_;
- return *this;
- }
-
- TReverseIteratorBase operator--(int) noexcept {
- TReverseIteratorBase old(*this);
- ++P_;
- return old;
- }
-
- constexpr auto operator*() const noexcept -> std::remove_pointer_t<TBase>& {
- return *TBase(*this);
- }
-
- explicit constexpr operator TBase() const noexcept {
- return TBase(P_ - 1);
- }
-
- constexpr auto operator-(const TReverseIteratorBase o) const noexcept {
- return o.P_ - P_;
- }
-
- constexpr bool operator==(const TReverseIteratorBase o) const noexcept {
- return P_ == o.P_;
- }
-
- constexpr bool operator!=(const TReverseIteratorBase o) const noexcept {
- return !(*this == o);
- }
-
- private:
- TBase P_ = nullptr;
- };
- using const_reverse_iterator = TReverseIteratorBase<const_iterator>;
-
+ template <typename TBase>
+ struct TReverseIteratorBase {
+ constexpr TReverseIteratorBase() noexcept = default;
+ explicit constexpr TReverseIteratorBase(TBase p)
+ : P_(p)
+ {
+ }
+
+ TReverseIteratorBase operator++() noexcept {
+ --P_;
+ return *this;
+ }
+
+ TReverseIteratorBase operator++(int) noexcept {
+ TReverseIteratorBase old(*this);
+ --P_;
+ return old;
+ }
+
+ TReverseIteratorBase& operator--() noexcept {
+ ++P_;
+ return *this;
+ }
+
+ TReverseIteratorBase operator--(int) noexcept {
+ TReverseIteratorBase old(*this);
+ ++P_;
+ return old;
+ }
+
+ constexpr auto operator*() const noexcept -> std::remove_pointer_t<TBase>& {
+ return *TBase(*this);
+ }
+
+ explicit constexpr operator TBase() const noexcept {
+ return TBase(P_ - 1);
+ }
+
+ constexpr auto operator-(const TReverseIteratorBase o) const noexcept {
+ return o.P_ - P_;
+ }
+
+ constexpr bool operator==(const TReverseIteratorBase o) const noexcept {
+ return P_ == o.P_;
+ }
+
+ constexpr bool operator!=(const TReverseIteratorBase o) const noexcept {
+ return !(*this == o);
+ }
+
+ private:
+ TBase P_ = nullptr;
+ };
+ using const_reverse_iterator = TReverseIteratorBase<const_iterator>;
+
static constexpr size_t StrLen(const TCharType* s) noexcept {
if (Y_LIKELY(s)) {
return TTraits::length(s);
@@ -151,22 +151,22 @@ public:
return end();
}
- inline const_reverse_iterator rbegin() const noexcept {
- return const_reverse_iterator(Ptr() + size());
- }
-
- inline const_reverse_iterator rend() const noexcept {
- return const_reverse_iterator(Ptr());
- }
-
- inline const_reverse_iterator crbegin() const noexcept {
- return rbegin();
- }
-
- inline const_reverse_iterator crend() const noexcept {
- return rend();
- }
-
+ inline const_reverse_iterator rbegin() const noexcept {
+ return const_reverse_iterator(Ptr() + size());
+ }
+
+ inline const_reverse_iterator rend() const noexcept {
+ return const_reverse_iterator(Ptr());
+ }
+
+ inline const_reverse_iterator crbegin() const noexcept {
+ return rbegin();
+ }
+
+ inline const_reverse_iterator crend() const noexcept {
+ return rend();
+ }
+
inline TCharType back() const noexcept {
Y_ASSERT(!this->empty());
return Ptr()[Len() - 1];
diff --git a/util/generic/string.h b/util/generic/string.h
index aa51327b6f..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -315,22 +315,22 @@ public:
return &*MutRef().end();
}
- reverse_iterator rbegin() {
+ reverse_iterator rbegin() {
return reverse_iterator(vend());
- }
-
- reverse_iterator rend() {
+ }
+
+ reverse_iterator rend() {
return reverse_iterator(begin());
- }
-
+ }
+
using TBase::begin; //!< const_iterator TStringBase::begin() const
using TBase::cbegin; //!< const_iterator TStringBase::cbegin() const
using TBase::cend; //!< const_iterator TStringBase::cend() const
- using TBase::crbegin; //!< const_reverse_iterator TStringBase::crbegin() const
- using TBase::crend; //!< const_reverse_iterator TStringBase::crend() const
+ using TBase::crbegin; //!< const_reverse_iterator TStringBase::crbegin() const
+ using TBase::crend; //!< const_reverse_iterator TStringBase::crend() const
using TBase::end; //!< const_iterator TStringBase::end() const
using TBase::rbegin; //!< const_reverse_iterator TStringBase::rbegin() const
- using TBase::rend; //!< const_reverse_iterator TStringBase::rend() const
+ using TBase::rend; //!< const_reverse_iterator TStringBase::rend() const
inline size_t capacity() const noexcept {
#ifdef TSTRING_IS_STD_STRING
diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp
index 0e0dbf8546..b87fa2843e 100644
--- a/util/generic/string_transparent_hash_ut.cpp
+++ b/util/generic/string_transparent_hash_ut.cpp
@@ -3,7 +3,7 @@
#include "strbuf.h"
#include <library/cpp/testing/unittest/registar.h>
-#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
+#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
#include <util/str_stl.h>
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index b4768cc633..44bb10bdeb 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -1074,83 +1074,83 @@ public:
UNIT_ASSERT_VALUES_EQUAL(constStr.front(), (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(str.front(), (ui8)'r');
}
-
+
void TestIterators() {
- const char_type chars[] = {'f', 'o', 0};
-
- TStringType str = chars;
- const TStringType constStr = str;
-
- typename TStringType::const_iterator itBegin = str.begin();
- typename TStringType::const_iterator itEnd = str.end();
- typename TStringType::const_iterator citBegin = constStr.begin();
- typename TStringType::const_iterator citEnd = constStr.end();
-
+ const char_type chars[] = {'f', 'o', 0};
+
+ TStringType str = chars;
+ const TStringType constStr = str;
+
+ typename TStringType::const_iterator itBegin = str.begin();
+ typename TStringType::const_iterator itEnd = str.end();
+ typename TStringType::const_iterator citBegin = constStr.begin();
+ typename TStringType::const_iterator citEnd = constStr.end();
+
UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
-
- str.front() = 'r';
+
+ str.front() = 'r';
UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
-
- UNIT_ASSERT_VALUES_EQUAL(2, itEnd - itBegin);
- UNIT_ASSERT_VALUES_EQUAL(2, citEnd - citBegin);
-
+
+ UNIT_ASSERT_VALUES_EQUAL(2, itEnd - itBegin);
+ UNIT_ASSERT_VALUES_EQUAL(2, citEnd - citBegin);
+
UNIT_ASSERT_VALUES_EQUAL(*(++itBegin), (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*(++citBegin), (ui8)'o');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(--itBegin), (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*(--citBegin), (ui8)'f');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(itBegin++), (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*(citBegin++), (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'o');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(itBegin--), (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*(citBegin--), (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*itBegin, (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*citBegin, (ui8)'f');
- }
-
+ }
+
void TestReverseIterators() {
- const char_type chars[] = {'f', 'o', 0};
-
- TStringType str = chars;
- const TStringType constStr = str;
-
- typename TStringType::reverse_iterator ritBegin = str.rbegin();
- typename TStringType::reverse_iterator ritEnd = str.rend();
- typename TStringType::const_reverse_iterator critBegin = constStr.rbegin();
- typename TStringType::const_reverse_iterator critEnd = constStr.rend();
-
+ const char_type chars[] = {'f', 'o', 0};
+
+ TStringType str = chars;
+ const TStringType constStr = str;
+
+ typename TStringType::reverse_iterator ritBegin = str.rbegin();
+ typename TStringType::reverse_iterator ritEnd = str.rend();
+ typename TStringType::const_reverse_iterator critBegin = constStr.rbegin();
+ typename TStringType::const_reverse_iterator critEnd = constStr.rend();
+
UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
-
+
str.back() = (ui8)'r';
UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
-
- UNIT_ASSERT_VALUES_EQUAL(2, ritEnd - ritBegin);
- UNIT_ASSERT_VALUES_EQUAL(2, critEnd - critBegin);
-
+
+ UNIT_ASSERT_VALUES_EQUAL(2, ritEnd - ritBegin);
+ UNIT_ASSERT_VALUES_EQUAL(2, critEnd - critBegin);
+
UNIT_ASSERT_VALUES_EQUAL(*(++ritBegin), (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*(++critBegin), (ui8)'f');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(--ritBegin), (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*(--critBegin), (ui8)'o');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(ritBegin++), (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*(critBegin++), (ui8)'o');
UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'f');
-
+
UNIT_ASSERT_VALUES_EQUAL(*(ritBegin--), (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*(critBegin--), (ui8)'f');
UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'r');
UNIT_ASSERT_VALUES_EQUAL(*critBegin, (ui8)'o');
-
+
*ritBegin = (ui8)'e';
UNIT_ASSERT_VALUES_EQUAL(*ritBegin, (ui8)'e');
- }
+ }
};
diff --git a/util/generic/ut/ya.make b/util/generic/ut/ya.make
index 3f451731a0..6eaf24cc5f 100644
--- a/util/generic/ut/ya.make
+++ b/util/generic/ut/ya.make
@@ -62,7 +62,7 @@ IF (NOT OS_IOS AND NOT ARCH_PPC64LE)
# Abseil fails to build (with linkage error) on ios and with compilation error on PowerPC
# (somewhere in unscaledcycleclock.cc).
PEERDIR(
- library/cpp/containers/absl_flat_hash
+ library/cpp/containers/absl_flat_hash
)
SRCS(