diff options
author | denplusplus <denplusplus@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
commit | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (patch) | |
tree | cc63639f8e502db19a82c20e2861c6d1edbf9fea /util/generic | |
parent | 464ba3814a83db4f2d5327393b0b6eaf0c86bfd7 (diff) | |
download | ydb-57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a.tar.gz |
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/algorithm.h | 4 | ||||
-rw-r--r-- | util/generic/bitops.h | 2 | ||||
-rw-r--r-- | util/generic/guid.cpp | 4 | ||||
-rw-r--r-- | util/generic/hash.h | 6 | ||||
-rw-r--r-- | util/generic/ptr.cpp | 4 | ||||
-rw-r--r-- | util/generic/strbase.h | 2 | ||||
-rw-r--r-- | util/generic/string.h | 92 | ||||
-rw-r--r-- | util/generic/string_transparent_hash_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/string_ut.cpp | 2 | ||||
-rw-r--r-- | util/generic/string_ut.h | 12 | ||||
-rw-r--r-- | util/generic/ymath.h | 4 |
11 files changed, 67 insertions, 67 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..caf5edc64b 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -452,7 +452,7 @@ template <class T> static inline void Rotate(T f, T m, T l) { std::rotate(f, m, l); } - + template <typename It, typename Val> Val Accumulate(It begin, It end, Val val) { // std::move since C++20 @@ -463,7 +463,7 @@ template <typename It, typename Val, typename BinOp> Val Accumulate(It begin, It end, Val val, BinOp binOp) { // std::move since C++20 return std::accumulate(begin, end, std::move(val), binOp); -} +} template <typename C, typename Val> Val Accumulate(const C& c, Val val) { diff --git a/util/generic/bitops.h b/util/generic/bitops.h index 2db15fc59b..6885624b9a 100644 --- a/util/generic/bitops.h +++ b/util/generic/bitops.h @@ -83,7 +83,7 @@ namespace NBitOps { value >>= 1; ++result; } - + return result; } #endif diff --git a/util/generic/guid.cpp b/util/generic/guid.cpp index 8b907457bc..e4fd0ca177 100644 --- a/util/generic/guid.cpp +++ b/util/generic/guid.cpp @@ -67,8 +67,8 @@ TGUID TGUID::CreateTimebased() { TString GetGuidAsString(const TGUID& g) { return g.AsGuidString(); -} - +} + TString CreateGuidAsString() { return TGUID::Create().AsGuidString(); } diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa9..b02afc0f10 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -606,7 +606,7 @@ public: THashTable& operator=(THashTable&& ht) noexcept { basic_clear(); swap(ht); - + return *this; } @@ -945,8 +945,8 @@ private: void delete_node(node* n) { n->val.~Value(); //n->next = (node*) 0xDeadBeeful; - put_node(n); - } + put_node(n); + } void erase_bucket(const size_type n, node* first, node* last); void erase_bucket(const size_type n, node* last); diff --git a/util/generic/ptr.cpp b/util/generic/ptr.cpp index b29baebc17..d1238fecec 100644 --- a/util/generic/ptr.cpp +++ b/util/generic/ptr.cpp @@ -7,11 +7,11 @@ #include <cstdlib> void TFree::DoDestroy(void* t) noexcept { - free(t); + free(t); } void TDelete::Destroy(void* t) noexcept { - ::operator delete(t); + ::operator delete(t); } TThrRefBase::~TThrRefBase() = default; diff --git a/util/generic/strbase.h b/util/generic/strbase.h index ab39fc7537..973aa2c068 100644 --- a/util/generic/strbase.h +++ b/util/generic/strbase.h @@ -226,7 +226,7 @@ public: TCharType null{0}; return TStringViewWithTraits(p ? p : &null).compare(s2.AsStringView()); } - + static int compare(const TSelf& s1, const TCharType* p) noexcept { TCharType null{0}; return s1.AsStringView().compare(p ? p : &null); diff --git a/util/generic/string.h b/util/generic/string.h index 8cd8aa6917..22d8d3cdae 100644 --- a/util/generic/string.h +++ b/util/generic/string.h @@ -215,7 +215,7 @@ protected: const TStdStr& StdStr() const noexcept { return *S_; - } + } /** * Makes a distinct copy of this string. `IsDetached()` is always true after this call. @@ -238,7 +238,7 @@ public: #else return StdStr(); #endif - } + } inline TStringType& MutRef() { #ifdef TSTRING_IS_STD_STRING @@ -296,7 +296,7 @@ public: inline size_t length() const noexcept { return ConstRef().length(); - } + } inline const TCharType* data() const noexcept { return ConstRef().data(); @@ -309,7 +309,7 @@ public: // ~~~ STL compatible method to obtain data pointer ~~~ iterator begin() { return &*MutRef().begin(); - } + } iterator vend() { return &*MutRef().end(); @@ -342,7 +342,7 @@ public: return S_->capacity(); #endif - } + } TCharType* Detach() { #ifdef TSTRING_IS_STD_STRING @@ -364,7 +364,7 @@ public: #endif } - // ~~~ Size and capacity ~~~ + // ~~~ Size and capacity ~~~ TBasicString& resize(size_t n, TCharType c = ' ') { // remove or append MutRef().resize(n, c); @@ -377,7 +377,7 @@ public: : S_(Construct()) #endif { - } + } inline explicit TBasicString(::NDetail::TReserveTag rt) #ifndef TSTRING_IS_STD_STRING @@ -394,7 +394,7 @@ public: : S_(s.S_) #endif { - } + } inline TBasicString(TBasicString&& s) noexcept #ifdef TSTRING_IS_STD_STRING @@ -573,8 +573,8 @@ public: Construct().Swap(S_); #endif - } - + } + template <typename... R> static inline TBasicString Join(const R&... r) { TBasicString s{TUninitialized{SumLength(r...)}}; @@ -595,15 +595,15 @@ public: TBasicString(s).swap(*this); return *this; - } + } TBasicString& assign(const TBasicString& s, size_t pos, size_t n) { return assign(TBasicString(s, pos, n)); - } + } TBasicString& assign(const TCharType* pc) { return assign(pc, TBase::StrLen(pc)); - } + } TBasicString& assign(TCharType ch) { return assign(&ch, 1); @@ -620,7 +620,7 @@ public: } return *this; - } + } TBasicString& assign(const TCharType* first, const TCharType* last) { return assign(first, last - first); @@ -628,7 +628,7 @@ public: TBasicString& assign(const TCharType* pc, size_t pos, size_t n) { return assign(pc + pos, n); - } + } TBasicString& assign(const TBasicStringBuf<TCharType, TTraits> s) { return assign(s.data(), s.size()); @@ -722,19 +722,19 @@ public: MutRef().append(s.ConstRef()); return *this; - } + } inline TBasicString& append(const TBasicString& s, size_t pos, size_t n) { MutRef().append(s.ConstRef(), pos, n); return *this; - } + } inline TBasicString& append(const TCharType* pc) Y_NOEXCEPT { MutRef().append(pc); return *this; - } + } inline TBasicString& append(TCharType c) { MutRef().push_back(c); @@ -787,7 +787,7 @@ public: TBasicString& append(const TCharType* pc, size_t pos, size_t n, size_t pc_len = TBase::npos) { return append(pc + pos, Min(n, pc_len - pos)); - } + } /** * WARN: @@ -802,26 +802,26 @@ public: inline void push_back(TCharType c) { // TODO - append(c); + append(c); } template <class T> TBasicString& operator+=(const T& s) { return append(s); - } + } - template <class T> + template <class T> friend TBasicString operator*(const TBasicString& s, T count) { TBasicString result; for (T i = 0; i < count; ++i) { - result += s; + result += s; } - return result; - } - - template <class T> + return result; + } + + template <class T> TBasicString& operator*=(T count) { TBasicString temp; @@ -829,10 +829,10 @@ public: temp += *this; } - swap(temp); + swap(temp); return *this; - } + } operator const TStringType&() const noexcept { return this->ConstRef(); @@ -866,7 +866,7 @@ public: friend TBasicString operator+(TBasicString&& s1, const TBasicString& s2) Y_WARN_UNUSED_RESULT { s1 += s2; return std::move(s1); - } + } friend TBasicString operator+(const TBasicString& s1, TBasicString&& s2) Y_WARN_UNUSED_RESULT { s2.prepend(s1); @@ -887,12 +887,12 @@ public: friend TBasicString operator+(TBasicString&& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT { s1 += s2; return std::move(s1); - } + } friend TBasicString operator+(TBasicString&& s1, const TCharType* s2) Y_WARN_UNUSED_RESULT { s1 += s2; return std::move(s1); - } + } friend TBasicString operator+(TBasicString&& s1, TCharType s2) Y_WARN_UNUSED_RESULT { s1 += s2; @@ -950,19 +950,19 @@ public: MutRef().insert(0, s.ConstRef()); return *this; - } + } TBasicString& prepend(const TBasicString& s, size_t pos, size_t n) { MutRef().insert(0, s.ConstRef(), pos, n); return *this; - } + } TBasicString& prepend(const TCharType* pc) { MutRef().insert(0, pc); return *this; - } + } TBasicString& prepend(size_t n, TCharType c) { MutRef().insert(size_t(0), n, c); @@ -974,7 +974,7 @@ public: MutRef().insert(size_t(0), 1, c); return *this; - } + } TBasicString& prepend(const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) { return insert(0, s, spos, sn); @@ -985,19 +985,19 @@ public: MutRef().insert(pos, s.ConstRef()); return *this; - } + } TBasicString& insert(size_t pos, const TBasicString& s, size_t pos1, size_t n1) { MutRef().insert(pos, s.ConstRef(), pos1, n1); return *this; - } + } TBasicString& insert(size_t pos, const TCharType* pc) { MutRef().insert(pos, pc); return *this; - } + } TBasicString& insert(size_t pos, const TCharType* pc, size_t len) { MutRef().insert(pos, pc, len); @@ -1035,14 +1035,14 @@ public: return *this; } - // ~~~ Removing ~~~ + // ~~~ Removing ~~~ TBasicString& remove(size_t pos, size_t n) Y_NOEXCEPT { if (pos < length()) { MutRef().erase(pos, n); } return *this; - } + } TBasicString& remove(size_t pos = 0) Y_NOEXCEPT { if (pos < length()) { @@ -1056,7 +1056,7 @@ public: MutRef().erase(pos, n); return *this; - } + } TBasicString& erase(const_iterator b, const_iterator e) Y_NOEXCEPT { return erase(this->off(b), e - b); @@ -1079,19 +1079,19 @@ public: MutRef().replace(pos, n, s.ConstRef()); return *this; - } + } TBasicString& replace(size_t pos, size_t n, const TBasicString& s, size_t pos1, size_t n1) Y_NOEXCEPT { MutRef().replace(pos, n, s.ConstRef(), pos1, n1); return *this; - } + } TBasicString& replace(size_t pos, size_t n, const TCharType* pc) Y_NOEXCEPT { MutRef().replace(pos, n, pc); return *this; - } + } TBasicString& replace(size_t pos, size_t n, const TCharType* s, size_t len) Y_NOEXCEPT { MutRef().replace(pos, n, s, len); @@ -1115,7 +1115,7 @@ public: MutRef().replace(pos, n, s, spos, sn); return *this; - } + } void swap(TBasicString& s) 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 b87fa2843e..047315a817 100644 --- a/util/generic/string_transparent_hash_ut.cpp +++ b/util/generic/string_transparent_hash_ut.cpp @@ -4,7 +4,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/containers/absl_flat_hash/flat_hash_set.h> - + #include <util/str_stl.h> Y_UNIT_TEST_SUITE(StringHashFunctorTests) { diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index ac82e9091d..de74c080ab 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -19,7 +19,7 @@ static_assert(sizeof(TString) == sizeof(std::string), "expect sizeof(TString) == #else static_assert(sizeof(TString) == sizeof(const char*), "expect sizeof(TString) == sizeof(const char*)"); #endif - + class TStringTestZero: public TTestBase { UNIT_TEST_SUITE(TStringTestZero); UNIT_TEST(TestZero); diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h index 44bb10bdeb..533b48cb44 100644 --- a/util/generic/string_ut.h +++ b/util/generic/string_ut.h @@ -3,7 +3,7 @@ #include "string.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/string/reverse.h> template <typename CharT, size_t N> @@ -38,7 +38,7 @@ struct TCharBuffer<char, 0> { #define DECLARE_AND_RETURN_BUFFER(s) \ static TCharBuffer<CharT, sizeof(s)> buf(s); \ return buf.GetData(); - + //! @attention this class can process characters less than 0x7F only (the low half of ASCII table) template <typename CharT> struct TTestData { @@ -679,7 +679,7 @@ public: void TestFind() { const TStringType s(Data._0123456_12345()); const TStringType s2(Data._0123()); - + UNIT_ASSERT(s.find(Data._345()) == 3); UNIT_ASSERT(s.find(Data._345(), 5) == 10); @@ -843,7 +843,7 @@ public: s2 = Data.asdf1234qwer(); s2.to_upper(); UNIT_ASSERT(s2 == Data.ASDF1234QWER()); - + // to_lower() s2.to_lower(); UNIT_ASSERT(s2 == Data.asdf1234qwer()); @@ -957,14 +957,14 @@ public: data[4] = 1; s.strcpy(data, 4); - + UNIT_ASSERT_EQUAL(data[0], *Data.a()); UNIT_ASSERT_EQUAL(data[1], *Data.b()); UNIT_ASSERT_EQUAL(data[2], *Data.c()); UNIT_ASSERT_EQUAL(data[3], 0); UNIT_ASSERT_EQUAL(data[4], 1); } - + { TStringType s(Data.abcd()); char_type data[5]; diff --git a/util/generic/ymath.h b/util/generic/ymath.h index 9ff9ae2abe..2cb68419cd 100644 --- a/util/generic/ymath.h +++ b/util/generic/ymath.h @@ -3,8 +3,8 @@ #include <util/system/yassert.h> #include <util/system/defaults.h> -#include <cmath> -#include <cfloat> +#include <cmath> +#include <cfloat> #include <cstdlib> #include "typetraits.h" |