aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authormowgli <mowgli@yandex-team.ru>2022-02-10 16:49:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:25 +0300
commit56c39b3cf908e7202b1f7551a1653681e8015607 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic
parent89afbbe4ca0e02e386dd4df08f7945f190dc1b84 (diff)
downloadydb-56c39b3cf908e7202b1f7551a1653681e8015607.tar.gz
Restoring authorship annotation for <mowgli@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/algorithm.h38
-rw-r--r--util/generic/buffer.cpp14
-rw-r--r--util/generic/buffer.h4
-rw-r--r--util/generic/buffer_ut.cpp22
-rw-r--r--util/generic/deque.h4
-rw-r--r--util/generic/deque_ut.cpp8
-rw-r--r--util/generic/hash_ut.cpp22
-rw-r--r--util/generic/map.h14
-rw-r--r--util/generic/map_ut.cpp6
-rw-r--r--util/generic/ptr.h92
-rw-r--r--util/generic/ptr_ut.cpp300
-rw-r--r--util/generic/queue.h16
-rw-r--r--util/generic/queue_ut.cpp8
-rw-r--r--util/generic/set.h14
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/strbuf.h72
-rw-r--r--util/generic/strbuf_ut.cpp98
-rw-r--r--util/generic/string.cpp8
-rw-r--r--util/generic/string.h4
-rw-r--r--util/generic/string_transparent_hash_ut.cpp2
-rw-r--r--util/generic/string_ut.cpp90
-rw-r--r--util/generic/string_ut.h2
-rw-r--r--util/generic/vector.h6
23 files changed, 423 insertions, 423 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index 92fd66b8fb..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -637,7 +637,7 @@ template <class T, class V>
inline typename std::iterator_traits<T>::difference_type Count(T first, T last, const V& value) {
return std::count(first, last, value);
}
-
+
template <class TContainer, class TValue>
static inline auto Count(const TContainer& container, const TValue& value) {
return Count(std::cbegin(container), std::cend(container), value);
@@ -658,13 +658,13 @@ static inline auto CountIf(const C& c, P pred) {
template <class I1, class I2>
static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2) {
return std::mismatch(b1, e1, b2);
-}
-
+}
+
template <class I1, class I2, class P>
static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, P p) {
return std::mismatch(b1, e1, b2, p);
-}
-
+}
+
template <class RandomIterator>
static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIterator end) {
std::nth_element(begin, nth, end);
@@ -675,30 +675,30 @@ static inline void NthElement(RandomIterator begin, RandomIterator nth, RandomIt
std::nth_element(begin, nth, end, compare);
}
-// no standard implementation until C++14
+// no standard implementation until C++14
template <class I1, class I2>
static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2) {
- while (b1 != e1 && b2 != e2 && *b1 == *b2) {
- ++b1;
- ++b2;
- }
+ while (b1 != e1 && b2 != e2 && *b1 == *b2) {
+ ++b1;
+ ++b2;
+ }
return std::make_pair(b1, b2);
-}
-
+}
+
template <class I1, class I2, class P>
static inline std::pair<I1, I2> Mismatch(I1 b1, I1 e1, I2 b2, I2 e2, P p) {
- while (b1 != e1 && b2 != e2 && p(*b1, *b2)) {
- ++b1;
- ++b2;
- }
+ while (b1 != e1 && b2 != e2 && p(*b1, *b2)) {
+ ++b1;
+ ++b2;
+ }
return std::make_pair(b1, b2);
-}
-
+}
+
template <class It, class Val>
static inline bool BinarySearch(It begin, It end, const Val& val) {
return std::binary_search(begin, end, val);
}
-
+
template <class It, class Val, class Comp>
static inline bool BinarySearch(It begin, It end, const Val& val, Comp comp) {
return std::binary_search(begin, end, val, comp);
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index f8d5d840fb..b92697e1d0 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -73,18 +73,18 @@ void TBuffer::Fill(char ch, size_t len) {
}
void TBuffer::DoReserve(size_t realLen) {
- // FastClp2<T>(x) returns 0 on x from [Max<T>/2 + 2, Max<T>]
- const size_t len = Max<size_t>(FastClp2(realLen), realLen);
+ // FastClp2<T>(x) returns 0 on x from [Max<T>/2 + 2, Max<T>]
+ const size_t len = Max<size_t>(FastClp2(realLen), realLen);
Y_ASSERT(realLen > Len_);
Y_ASSERT(len >= realLen);
- Realloc(len);
-}
-
-void TBuffer::Realloc(size_t len) {
+ Realloc(len);
+}
+
+void TBuffer::Realloc(size_t len) {
Y_ASSERT(Pos_ <= len);
-
+
Data_ = (char*)y_reallocate(Data_, len);
Len_ = len;
}
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 358566feda..9576467404 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -154,9 +154,9 @@ public:
inline void ShrinkToFit() {
if (Pos_ < Len_) {
Realloc(Pos_);
- }
+ }
}
-
+
inline void Resize(size_t len) {
Reserve(len);
Pos_ = len;
diff --git a/util/generic/buffer_ut.cpp b/util/generic/buffer_ut.cpp
index af77143215..437d7122ec 100644
--- a/util/generic/buffer_ut.cpp
+++ b/util/generic/buffer_ut.cpp
@@ -74,46 +74,46 @@ Y_UNIT_TEST_SUITE(TBufferTest) {
buf.Reserve(4);
UNIT_ASSERT_EQUAL(buf.Capacity(), 4);
-
+
buf.Reserve(6);
UNIT_ASSERT_EQUAL(buf.Capacity(), 8);
-
+
buf.Reserve(32);
UNIT_ASSERT_EQUAL(buf.Capacity(), 32);
-
+
buf.Reserve(33);
UNIT_ASSERT_EQUAL(buf.Capacity(), 64);
buf.Reserve(64);
UNIT_ASSERT_EQUAL(buf.Capacity(), 64);
-
+
buf.Resize(128);
UNIT_ASSERT_EQUAL(buf.Capacity(), 128);
-
+
buf.Append('a');
UNIT_ASSERT_EQUAL(buf.Capacity(), 256);
TString tmp1 = "abcdef";
buf.Append(tmp1.data(), tmp1.size());
UNIT_ASSERT_EQUAL(buf.Capacity(), 256);
-
+
TString tmp2 = "30498290sfokdsflj2308w";
buf.Resize(1020);
buf.Append(tmp2.data(), tmp2.size());
UNIT_ASSERT_EQUAL(buf.Capacity(), 2048);
}
-
+
Y_UNIT_TEST(TestShrinkToFit) {
TBuffer buf;
-
+
TString content = "some text";
buf.Append(content.data(), content.size());
UNIT_ASSERT_EQUAL(buf.Size(), 9);
UNIT_ASSERT_EQUAL(buf.Capacity(), 16);
-
+
buf.ShrinkToFit();
UNIT_ASSERT_EQUAL(buf.Size(), 9);
UNIT_ASSERT_EQUAL(buf.Capacity(), 9);
UNIT_ASSERT_EQUAL(TString(buf.data(), buf.size()), content);
-
+
const size_t MB = 1024 * 1024;
buf.Resize(MB);
UNIT_ASSERT_EQUAL(buf.Capacity(), MB);
@@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(TBufferTest) {
buf.ShrinkToFit();
UNIT_ASSERT_EQUAL(buf.Capacity(), MB + 100);
}
-
+
#if 0
Y_UNIT_TEST(TestAlignUp) {
char content[] = "some text";
diff --git a/util/generic/deque.h b/util/generic/deque.h
index 52d9219c7b..2dabaf3177 100644
--- a/util/generic/deque.h
+++ b/util/generic/deque.h
@@ -20,6 +20,6 @@ public:
}
inline explicit operator bool() const noexcept {
- return !this->empty();
- }
+ return !this->empty();
+ }
};
diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp
index 5ec55c31fc..93bf50fa92 100644
--- a/util/generic/deque_ut.cpp
+++ b/util/generic/deque_ut.cpp
@@ -67,15 +67,15 @@ void TDequeTest::TestConstructorsAndAssignments() {
void TDequeTest::TestDeque1() {
TDeque<int> d;
- UNIT_ASSERT(!d);
-
+ UNIT_ASSERT(!d);
+
d.push_back(4);
d.push_back(9);
d.push_back(16);
d.push_front(1);
- UNIT_ASSERT(d);
-
+ UNIT_ASSERT(d);
+
UNIT_ASSERT(d[0] == 1);
UNIT_ASSERT(d[1] == 4);
UNIT_ASSERT(d[2] == 9);
diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp
index ad71298e8a..0551d58770 100644
--- a/util/generic/hash_ut.cpp
+++ b/util/generic/hash_ut.cpp
@@ -691,20 +691,20 @@ void THashTest::TestResizeOnInsertSmartPtrBug() {
UNIT_ASSERT_EQUAL(item.Key, "key8");
UNIT_ASSERT_EQUAL(item.Value, "value8");
}
-
-template <typename T>
-static void EmptyAndInsertTest(typename T::value_type v) {
- T c;
- UNIT_ASSERT(!c);
- c.insert(v);
- UNIT_ASSERT(c);
-}
-
-void THashTest::TestEmpty() {
+
+template <typename T>
+static void EmptyAndInsertTest(typename T::value_type v) {
+ T c;
+ UNIT_ASSERT(!c);
+ c.insert(v);
+ UNIT_ASSERT(c);
+}
+
+void THashTest::TestEmpty() {
EmptyAndInsertTest<THashSet<int>>(1);
EmptyAndInsertTest<THashMap<int, int>>(std::pair<int, int>(1, 2));
EmptyAndInsertTest<THashMultiMap<int, int>>(std::pair<int, int>(1, 2));
-}
+}
void THashTest::TestDefaultConstructor() {
THashSet<int> set;
diff --git a/util/generic/map.h b/util/generic/map.h
index 56449b442a..b5001b56c0 100644
--- a/util/generic/map.h
+++ b/util/generic/map.h
@@ -18,10 +18,10 @@ class TMap: public std::map<K, V, Less, TReboundAllocator<A, std::pair<const K,
public:
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
-
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
+
inline bool contains(const K& key) const {
return this->find(key) != this->end();
}
@@ -34,9 +34,9 @@ class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair
public:
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
inline bool contains(const K& key) const {
return this->find(key) != this->end();
diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp
index 6d57f61600..79e832b024 100644
--- a/util/generic/map_ut.cpp
+++ b/util/generic/map_ut.cpp
@@ -389,7 +389,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
UNIT_ASSERT(ccont.equal_range(2) != std::make_pair(ccont.begin(), ccont.end()));
}
}
-
+
template <typename T>
static void EmptyAndInsertTest(typename T::value_type v) {
T c;
@@ -397,7 +397,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
c.insert(v);
UNIT_ASSERT(c);
}
-
+
Y_UNIT_TEST(TestEmpty) {
EmptyAndInsertTest<TMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1));
EmptyAndInsertTest<TMultiMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1));
@@ -493,4 +493,4 @@ Y_UNIT_TEST_SUITE(TYMapTest) {
UNIT_ASSERT(movedM.contains(0));
UNIT_ASSERT_VALUES_EQUAL(1, movedM[0]);
}
-}
+}
diff --git a/util/generic/ptr.h b/util/generic/ptr.h
index 731930a2ed..19db0e3ec5 100644
--- a/util/generic/ptr.h
+++ b/util/generic/ptr.h
@@ -294,7 +294,7 @@ public:
inline void Reset(TAutoPtr<T, D> t) noexcept {
Reset(t.Release());
}
-
+
inline void Reset() noexcept {
Destroy();
}
@@ -1054,50 +1054,50 @@ private:
T* T_;
};
-// Copy-on-write pointer
+// Copy-on-write pointer
template <class TPtr, class TCopy>
-class TCowPtr: public TPointerBase<TCowPtr<TPtr, TCopy>, const typename TPtr::TValueType> {
+class TCowPtr: public TPointerBase<TCowPtr<TPtr, TCopy>, const typename TPtr::TValueType> {
using T = typename TPtr::TValueType;
-public:
+public:
inline TCowPtr() = default;
-
- inline TCowPtr(const TPtr& p)
- : T_(p)
- {
- }
-
- inline TCowPtr(T* p)
- : T_(p)
- {
- }
-
+
+ inline TCowPtr(const TPtr& p)
+ : T_(p)
+ {
+ }
+
+ inline TCowPtr(T* p)
+ : T_(p)
+ {
+ }
+
inline const T* Get() const noexcept {
- return Const();
- }
-
+ return Const();
+ }
+
inline const T* Const() const noexcept {
- return T_.Get();
- }
-
+ return T_.Get();
+ }
+
inline T* Mutable() {
- Unshare();
-
- return T_.Get();
- }
-
+ Unshare();
+
+ return T_.Get();
+ }
+
inline bool Shared() const noexcept {
- return T_.RefCount() > 1;
- }
-
+ return T_.RefCount() > 1;
+ }
+
inline void Swap(TCowPtr& r) noexcept {
- T_.Swap(r.T_);
- }
-
- inline void Reset(TCowPtr p) {
- p.Swap(*this);
- }
-
+ T_.Swap(r.T_);
+ }
+
+ inline void Reset(TCowPtr p) {
+ p.Swap(*this);
+ }
+
inline void Reset() {
T_.Reset();
}
@@ -1108,17 +1108,17 @@ public:
return (p == Get());
}
#endif
-private:
+private:
inline void Unshare() {
- if (Shared()) {
- Reset(TCopy::Copy(T_.Get()));
- }
- }
-
-private:
- TPtr T_;
-};
-
+ if (Shared()) {
+ Reset(TCopy::Copy(T_.Get()));
+ }
+ }
+
+private:
+ TPtr T_;
+};
+
// saves .Get() on argument passing. Intended usage: Func(TPtrArg<X> p); ... TIntrusivePtr<X> p2; Func(p2);
template <class T>
class TPtrArg {
diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp
index 3997527746..c2dcff23f6 100644
--- a/util/generic/ptr_ut.cpp
+++ b/util/generic/ptr_ut.cpp
@@ -363,7 +363,7 @@ void TPointerTest::TestIntrPtr() {
}
UNIT_ASSERT_VALUES_EQUAL(TOp::Cnt, 0);
}
-
+
namespace NTestIntrusiveConvertion {
struct TA: public TSimpleRefCount<TA> {
};
@@ -429,197 +429,197 @@ void TPointerTest::TestMakeIntrusive() {
void TPointerTest::TestCopyOnWritePtr1() {
using TPtr = TCowPtr<TSimpleSharedPtr<int>>;
- TPtr p1;
- UNIT_ASSERT(!p1.Shared());
-
- p1.Reset(new int(123));
- UNIT_ASSERT(!p1.Shared());
-
- {
- TPtr pTmp = p1;
-
- UNIT_ASSERT(p1.Shared());
- UNIT_ASSERT(pTmp.Shared());
- UNIT_ASSERT_EQUAL(p1.Get(), pTmp.Get());
- }
-
- UNIT_ASSERT(!p1.Shared());
-
- TPtr p2 = p1;
- TPtr p3;
- p3 = p2;
-
- UNIT_ASSERT(p2.Shared());
- UNIT_ASSERT(p3.Shared());
- UNIT_ASSERT_EQUAL(p1.Get(), p2.Get());
- UNIT_ASSERT_EQUAL(p1.Get(), p3.Get());
-
- *(p1.Mutable()) = 456;
-
- UNIT_ASSERT(!p1.Shared());
- UNIT_ASSERT(p2.Shared());
- UNIT_ASSERT(p3.Shared());
- UNIT_ASSERT_EQUAL(*p1, 456);
- UNIT_ASSERT_EQUAL(*p2, 123);
- UNIT_ASSERT_EQUAL(*p3, 123);
- UNIT_ASSERT_UNEQUAL(p1.Get(), p2.Get());
- UNIT_ASSERT_EQUAL(p2.Get(), p3.Get());
-
- p2.Mutable();
-
- UNIT_ASSERT(!p2.Shared());
- UNIT_ASSERT(!p3.Shared());
- UNIT_ASSERT_EQUAL(*p2, 123);
- UNIT_ASSERT_EQUAL(*p3, 123);
- UNIT_ASSERT_UNEQUAL(p2.Get(), p3.Get());
-}
-
+ TPtr p1;
+ UNIT_ASSERT(!p1.Shared());
+
+ p1.Reset(new int(123));
+ UNIT_ASSERT(!p1.Shared());
+
+ {
+ TPtr pTmp = p1;
+
+ UNIT_ASSERT(p1.Shared());
+ UNIT_ASSERT(pTmp.Shared());
+ UNIT_ASSERT_EQUAL(p1.Get(), pTmp.Get());
+ }
+
+ UNIT_ASSERT(!p1.Shared());
+
+ TPtr p2 = p1;
+ TPtr p3;
+ p3 = p2;
+
+ UNIT_ASSERT(p2.Shared());
+ UNIT_ASSERT(p3.Shared());
+ UNIT_ASSERT_EQUAL(p1.Get(), p2.Get());
+ UNIT_ASSERT_EQUAL(p1.Get(), p3.Get());
+
+ *(p1.Mutable()) = 456;
+
+ UNIT_ASSERT(!p1.Shared());
+ UNIT_ASSERT(p2.Shared());
+ UNIT_ASSERT(p3.Shared());
+ UNIT_ASSERT_EQUAL(*p1, 456);
+ UNIT_ASSERT_EQUAL(*p2, 123);
+ UNIT_ASSERT_EQUAL(*p3, 123);
+ UNIT_ASSERT_UNEQUAL(p1.Get(), p2.Get());
+ UNIT_ASSERT_EQUAL(p2.Get(), p3.Get());
+
+ p2.Mutable();
+
+ UNIT_ASSERT(!p2.Shared());
+ UNIT_ASSERT(!p3.Shared());
+ UNIT_ASSERT_EQUAL(*p2, 123);
+ UNIT_ASSERT_EQUAL(*p3, 123);
+ UNIT_ASSERT_UNEQUAL(p2.Get(), p3.Get());
+}
+
struct X: public TSimpleRefCount<X> {
- inline X(int v = 0)
- : V(v)
- {
- }
-
- int V;
-};
-
+ inline X(int v = 0)
+ : V(v)
+ {
+ }
+
+ int V;
+};
+
void TPointerTest::TestCopyOnWritePtr2() {
using TPtr = TCowPtr<TIntrusivePtr<X>>;
- TPtr p1;
- UNIT_ASSERT(!p1.Shared());
-
- p1.Reset(new X(123));
- UNIT_ASSERT(!p1.Shared());
-
- {
- TPtr pTmp = p1;
-
- UNIT_ASSERT(p1.Shared());
- UNIT_ASSERT(pTmp.Shared());
- UNIT_ASSERT_EQUAL(p1.Get(), pTmp.Get());
- }
-
- UNIT_ASSERT(!p1.Shared());
-
- TPtr p2 = p1;
- TPtr p3;
- p3 = p2;
-
- UNIT_ASSERT(p2.Shared());
- UNIT_ASSERT(p3.Shared());
- UNIT_ASSERT_EQUAL(p1.Get(), p2.Get());
- UNIT_ASSERT_EQUAL(p1.Get(), p3.Get());
-
- p1.Mutable()->V = 456;
-
- UNIT_ASSERT(!p1.Shared());
- UNIT_ASSERT(p2.Shared());
- UNIT_ASSERT(p3.Shared());
- UNIT_ASSERT_EQUAL(p1->V, 456);
- UNIT_ASSERT_EQUAL(p2->V, 123);
- UNIT_ASSERT_EQUAL(p3->V, 123);
- UNIT_ASSERT_UNEQUAL(p1.Get(), p2.Get());
- UNIT_ASSERT_EQUAL(p2.Get(), p3.Get());
-
- p2.Mutable();
-
- UNIT_ASSERT(!p2.Shared());
- UNIT_ASSERT(!p3.Shared());
- UNIT_ASSERT_EQUAL(p2->V, 123);
- UNIT_ASSERT_EQUAL(p3->V, 123);
- UNIT_ASSERT_UNEQUAL(p2.Get(), p3.Get());
-}
-
-namespace {
+ TPtr p1;
+ UNIT_ASSERT(!p1.Shared());
+
+ p1.Reset(new X(123));
+ UNIT_ASSERT(!p1.Shared());
+
+ {
+ TPtr pTmp = p1;
+
+ UNIT_ASSERT(p1.Shared());
+ UNIT_ASSERT(pTmp.Shared());
+ UNIT_ASSERT_EQUAL(p1.Get(), pTmp.Get());
+ }
+
+ UNIT_ASSERT(!p1.Shared());
+
+ TPtr p2 = p1;
+ TPtr p3;
+ p3 = p2;
+
+ UNIT_ASSERT(p2.Shared());
+ UNIT_ASSERT(p3.Shared());
+ UNIT_ASSERT_EQUAL(p1.Get(), p2.Get());
+ UNIT_ASSERT_EQUAL(p1.Get(), p3.Get());
+
+ p1.Mutable()->V = 456;
+
+ UNIT_ASSERT(!p1.Shared());
+ UNIT_ASSERT(p2.Shared());
+ UNIT_ASSERT(p3.Shared());
+ UNIT_ASSERT_EQUAL(p1->V, 456);
+ UNIT_ASSERT_EQUAL(p2->V, 123);
+ UNIT_ASSERT_EQUAL(p3->V, 123);
+ UNIT_ASSERT_UNEQUAL(p1.Get(), p2.Get());
+ UNIT_ASSERT_EQUAL(p2.Get(), p3.Get());
+
+ p2.Mutable();
+
+ UNIT_ASSERT(!p2.Shared());
+ UNIT_ASSERT(!p3.Shared());
+ UNIT_ASSERT_EQUAL(p2->V, 123);
+ UNIT_ASSERT_EQUAL(p3->V, 123);
+ UNIT_ASSERT_UNEQUAL(p2.Get(), p3.Get());
+}
+
+namespace {
template <class TFrom, class TTo>
struct TImplicitlyCastable {
struct RTYes {
char t[2];
};
-
+
using RTNo = char;
-
+
static RTYes Func(TTo);
static RTNo Func(...);
static TFrom Get();
-
+
/*
- * Result == (TFrom could be converted to TTo implicitly)
- */
+ * Result == (TFrom could be converted to TTo implicitly)
+ */
enum {
Result = (sizeof(Func(Get())) != sizeof(RTNo))
};
- };
-
+ };
+
struct TImplicitlyCastableToBool {
inline operator bool() const {
return true;
}
};
-
+
}
-
+
void TPointerTest::TestOperatorBool() {
using TVec = TVector<ui32>;
-
- // to be sure TImplicitlyCastable works as expected
- UNIT_ASSERT((TImplicitlyCastable<int, bool>::Result));
- UNIT_ASSERT((TImplicitlyCastable<double, int>::Result));
- UNIT_ASSERT((TImplicitlyCastable<int*, void*>::Result));
- UNIT_ASSERT(!(TImplicitlyCastable<void*, int*>::Result));
- UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, bool>::Result));
- UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, int>::Result));
- UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, ui64>::Result));
- UNIT_ASSERT(!(TImplicitlyCastable<TImplicitlyCastableToBool, void*>::Result));
-
- // pointers
+
+ // to be sure TImplicitlyCastable works as expected
+ UNIT_ASSERT((TImplicitlyCastable<int, bool>::Result));
+ UNIT_ASSERT((TImplicitlyCastable<double, int>::Result));
+ UNIT_ASSERT((TImplicitlyCastable<int*, void*>::Result));
+ UNIT_ASSERT(!(TImplicitlyCastable<void*, int*>::Result));
+ UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, bool>::Result));
+ UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, int>::Result));
+ UNIT_ASSERT((TImplicitlyCastable<TImplicitlyCastableToBool, ui64>::Result));
+ UNIT_ASSERT(!(TImplicitlyCastable<TImplicitlyCastableToBool, void*>::Result));
+
+ // pointers
UNIT_ASSERT(!(TImplicitlyCastable<TSimpleSharedPtr<TVec>, int>::Result));
- UNIT_ASSERT(!(TImplicitlyCastable<TAutoPtr<ui64>, ui64>::Result));
+ UNIT_ASSERT(!(TImplicitlyCastable<TAutoPtr<ui64>, ui64>::Result));
UNIT_ASSERT(!(TImplicitlyCastable<THolder<TVec>, bool>::Result)); // even this
-
- {
- // mostly a compilability test
-
- THolder<TVec> a;
- UNIT_ASSERT(!a);
- UNIT_ASSERT(!bool(a));
+
+ {
+ // mostly a compilability test
+
+ THolder<TVec> a;
+ UNIT_ASSERT(!a);
+ UNIT_ASSERT(!bool(a));
if (a) {
- UNIT_ASSERT(false);
+ UNIT_ASSERT(false);
}
if (!a) {
- UNIT_ASSERT(true);
+ UNIT_ASSERT(true);
}
-
- a.Reset(new TVec);
- UNIT_ASSERT(a);
- UNIT_ASSERT(bool(a));
+
+ a.Reset(new TVec);
+ UNIT_ASSERT(a);
+ UNIT_ASSERT(bool(a));
if (a) {
- UNIT_ASSERT(true);
+ UNIT_ASSERT(true);
}
if (!a) {
- UNIT_ASSERT(false);
+ UNIT_ASSERT(false);
}
-
- THolder<TVec> b(new TVec);
- UNIT_ASSERT(a.Get() != b.Get());
- UNIT_ASSERT(a != b);
+
+ THolder<TVec> b(new TVec);
+ UNIT_ASSERT(a.Get() != b.Get());
+ UNIT_ASSERT(a != b);
if (a == b) {
- UNIT_ASSERT(false);
+ UNIT_ASSERT(false);
}
if (a != b) {
- UNIT_ASSERT(true);
+ UNIT_ASSERT(true);
}
if (!(a && b)) {
- UNIT_ASSERT(false);
+ UNIT_ASSERT(false);
}
if (a && b) {
- UNIT_ASSERT(true);
+ UNIT_ASSERT(true);
}
-
- // int i = a; // does not compile
- // bool c = (a < b); // does not compile
- }
-}
+
+ // int i = a; // does not compile
+ // bool c = (a < b); // does not compile
+ }
+}
void TPointerTest::TestMakeShared() {
{
diff --git a/util/generic/queue.h b/util/generic/queue.h
index 570d8d915d..f5959f68f2 100644
--- a/util/generic/queue.h
+++ b/util/generic/queue.h
@@ -16,10 +16,10 @@ class TQueue: public std::queue<T, S> {
public:
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
-
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
+
inline void clear() {
this->c.clear();
}
@@ -40,10 +40,10 @@ class TPriorityQueue: public std::priority_queue<T, S, C> {
public:
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
-
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
+
inline void clear() {
this->c.clear();
}
diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp
index 122d4eabd6..a33399e104 100644
--- a/util/generic/queue_ut.cpp
+++ b/util/generic/queue_ut.cpp
@@ -12,10 +12,10 @@ Y_UNIT_TEST_SUITE(TYQueueTest) {
using container = TQueue<int>;
container c1;
- UNIT_ASSERT(!c1);
+ UNIT_ASSERT(!c1);
c1.push(100);
c1.push(200);
- UNIT_ASSERT(c1);
+ UNIT_ASSERT(c1);
container c2(c1);
@@ -44,10 +44,10 @@ Y_UNIT_TEST_SUITE(TYQueueTest) {
using container = TPriorityQueue<int>;
container c1;
- UNIT_ASSERT(!c1);
+ UNIT_ASSERT(!c1);
c1.push(100);
c1.push(200);
- UNIT_ASSERT(c1);
+ UNIT_ASSERT(c1);
container c2(c1);
diff --git a/util/generic/set.h b/util/generic/set.h
index c8acd6fbb8..4c437ca26f 100644
--- a/util/generic/set.h
+++ b/util/generic/set.h
@@ -15,10 +15,10 @@ public:
using TBase = std::set<K, L, TReboundAllocator<A, K>>;
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
-
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
+
template <class TheKey>
inline bool contains(const TheKey& key) const {
return this->find(key) != this->end();
@@ -31,9 +31,9 @@ public:
using TBase = std::multiset<K, L, TReboundAllocator<A, K>>;
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
template <class TheKey>
inline bool contains(const TheKey& key) const {
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index 56a759548d..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -194,7 +194,7 @@ public:
}
constexpr inline explicit operator bool() const noexcept {
- return !empty();
+ return !empty();
}
public: // style-guide compliant methods
diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h
index 4e6956bd7e..70b9360d58 100644
--- a/util/generic/strbuf.h
+++ b/util/generic/strbuf.h
@@ -248,76 +248,76 @@ public:
RSplitTemplate(delim, l, r);
}
-private:
+private:
// splits on a delimiter at a given position; delimiter is excluded
void DoSplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len) const noexcept {
- Y_ASSERT(pos != TBase::npos);
-
+ Y_ASSERT(pos != TBase::npos);
+
// make a copy in case one of l/r is really *this
const TdSelf tok = SubStr(pos + len);
l = Head(pos);
r = tok;
}
-public:
- // In all methods below with @pos parameter, @pos is supposed to be
- // a result of string find()/rfind()/find_first() or other similiar functions,
+public:
+ // In all methods below with @pos parameter, @pos is supposed to be
+ // a result of string find()/rfind()/find_first() or other similiar functions,
// returning either position within string length [0..size()) or npos.
- // For all other @pos values (out of string index range) the behaviour isn't well defined
- // For example, for TStringBuf s("abc"):
- // s.TrySplitOn(s.find('z'), ...) is false, but s.TrySplitOn(100500, ...) is true.
-
+ // For all other @pos values (out of string index range) the behaviour isn't well defined
+ // For example, for TStringBuf s("abc"):
+ // s.TrySplitOn(s.find('z'), ...) is false, but s.TrySplitOn(100500, ...) is true.
+
bool TrySplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept {
if (TBase::npos == pos)
return false;
-
+
DoSplitOn(pos, l, r, len);
return true;
}
void SplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept {
- if (!TrySplitOn(pos, l, r, len)) {
+ if (!TrySplitOn(pos, l, r, len)) {
l = *this;
r = TdSelf();
}
}
bool TrySplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept {
- return TrySplitOn(pos, l, r, 0);
+ return TrySplitOn(pos, l, r, 0);
}
void SplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept {
- SplitOn(pos, l, r, 0);
+ SplitOn(pos, l, r, 0);
}
/*
- // Not implemented intentionally, use TrySplitOn() instead
+ // Not implemented intentionally, use TrySplitOn() instead
void RSplitOn(size_t pos, TdSelf& l, TdSelf& r) const noexcept;
void RSplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept;
-*/
+*/
-public:
+public:
Y_PURE_FUNCTION inline TdSelf After(TCharType c) const noexcept {
TdSelf l, r;
- return TrySplit(c, l, r) ? r : *this;
+ return TrySplit(c, l, r) ? r : *this;
}
Y_PURE_FUNCTION inline TdSelf Before(TCharType c) const noexcept {
TdSelf l, r;
- return TrySplit(c, l, r) ? l : *this;
- }
+ return TrySplit(c, l, r) ? l : *this;
+ }
Y_PURE_FUNCTION inline TdSelf RAfter(TCharType c) const noexcept {
TdSelf l, r;
- return TryRSplit(c, l, r) ? r : *this;
+ return TryRSplit(c, l, r) ? r : *this;
}
Y_PURE_FUNCTION inline TdSelf RBefore(TCharType c) const noexcept {
TdSelf l, r;
- return TryRSplit(c, l, r) ? l : *this;
+ return TryRSplit(c, l, r) ? l : *this;
}
-public:
+public:
inline bool AfterPrefix(const TdSelf& prefix, TdSelf& result) const noexcept {
if (this->StartsWith(prefix)) {
result = Tail(prefix.size());
@@ -336,15 +336,15 @@ public:
// returns true if string started with `prefix`, false otherwise
inline bool SkipPrefix(const TdSelf& prefix) noexcept {
- return AfterPrefix(prefix, *this);
- }
-
+ return AfterPrefix(prefix, *this);
+ }
+
// returns true if string ended with `suffix`, false otherwise
inline bool ChopSuffix(const TdSelf& suffix) noexcept {
- return BeforeSuffix(suffix, *this);
- }
-
-public:
+ return BeforeSuffix(suffix, *this);
+ }
+
+public:
// returns tail, including pos
TdSelf SplitOffAt(size_t pos) {
const TdSelf tok = SubStr(pos);
@@ -371,12 +371,12 @@ public:
return tok;
}
/*
- // See comment on RSplitOn() above
- TdSelf RSplitOffOn(size_t pos);
- TdSelf RNextTokOn(size_t pos);
-*/
+ // See comment on RSplitOn() above
+ TdSelf RSplitOffOn(size_t pos);
+ TdSelf RNextTokOn(size_t pos);
+*/
-public:
+public:
TdSelf SplitOff(TCharType delim) {
TdSelf tok;
Split(delim, *this, tok);
@@ -513,7 +513,7 @@ private:
template <typename TDelimiterType>
bool RNextTokTemplate(TDelimiterType delim, TdSelf& tok) {
if (!empty()) {
- tok = RNextTokTemplate(delim);
+ tok = RNextTokTemplate(delim);
return true;
}
return false;
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index b26a18e470..69cde785af 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -95,17 +95,17 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
if (str.AfterPrefix("http://", r)) {
UNIT_ASSERT_EQUAL(r, "ya.ru");
}
-
- // SkipPrefix()
- TStringBuf a = "abcdef";
+
+ // SkipPrefix()
+ TStringBuf a = "abcdef";
UNIT_ASSERT(a.SkipPrefix("a") && a == "bcdef");
UNIT_ASSERT(a.SkipPrefix("bc") && a == "def");
UNIT_ASSERT(a.SkipPrefix("") && a == "def");
- UNIT_ASSERT(!a.SkipPrefix("xyz") && a == "def");
- UNIT_ASSERT(!a.SkipPrefix("defg") && a == "def");
+ UNIT_ASSERT(!a.SkipPrefix("xyz") && a == "def");
+ UNIT_ASSERT(!a.SkipPrefix("defg") && a == "def");
UNIT_ASSERT(a.SkipPrefix("def") && a == "");
UNIT_ASSERT(a.SkipPrefix("") && a == "");
- UNIT_ASSERT(!a.SkipPrefix("def") && a == "");
+ UNIT_ASSERT(!a.SkipPrefix("def") && a == "");
}
Y_UNIT_TEST(TestBeforeSuffix) {
@@ -122,17 +122,17 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
if (str.BeforeSuffix(".ru", r)) {
UNIT_ASSERT_EQUAL(r, "maps.yandex");
}
-
- // ChopSuffix()
- TStringBuf a = "abcdef";
+
+ // ChopSuffix()
+ TStringBuf a = "abcdef";
UNIT_ASSERT(a.ChopSuffix("f") && a == "abcde");
UNIT_ASSERT(a.ChopSuffix("de") && a == "abc");
UNIT_ASSERT(a.ChopSuffix("") && a == "abc");
- UNIT_ASSERT(!a.ChopSuffix("xyz") && a == "abc");
- UNIT_ASSERT(!a.ChopSuffix("abcd") && a == "abc");
+ UNIT_ASSERT(!a.ChopSuffix("xyz") && a == "abc");
+ UNIT_ASSERT(!a.ChopSuffix("abcd") && a == "abc");
UNIT_ASSERT(a.ChopSuffix("abc") && a == "");
UNIT_ASSERT(a.ChopSuffix("") && a == "");
- UNIT_ASSERT(!a.ChopSuffix("abc") && a == "");
+ UNIT_ASSERT(!a.ChopSuffix("abc") && a == "");
}
Y_UNIT_TEST(TestEmpty) {
@@ -248,12 +248,12 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
TStringBuf buf2("a");
UNIT_ASSERT_EQUAL(buf2.RNextTok('.'), TStringBuf("a"));
UNIT_ASSERT_EQUAL(buf2, TStringBuf());
-
- TStringBuf buf3("ab cd ef"), tok;
- UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "ef" && buf3 == "ab cd");
- UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "cd" && buf3 == "ab");
- UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "ab" && buf3 == "");
- UNIT_ASSERT(!buf3.RNextTok(' ', tok) && tok == "ab" && buf3 == ""); // not modified
+
+ TStringBuf buf3("ab cd ef"), tok;
+ UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "ef" && buf3 == "ab cd");
+ UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "cd" && buf3 == "ab");
+ UNIT_ASSERT(buf3.RNextTok(' ', tok) && tok == "ab" && buf3 == "");
+ UNIT_ASSERT(!buf3.RNextTok(' ', tok) && tok == "ab" && buf3 == ""); // not modified
}
Y_UNIT_TEST(TestRSplitOff) {
@@ -275,50 +275,50 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
UNIT_ASSERT_VALUES_EQUAL(helloThere[index], *it);
}
}
-
+
Y_UNIT_TEST(TestSplitOnAt) {
- TStringBuf s = "abcabc";
- TStringBuf l, r;
-
- size_t pos = s.find('a');
- UNIT_ASSERT(s.TrySplitOn(pos, l, r));
- UNIT_ASSERT(l == "" && r == "bcabc");
- UNIT_ASSERT(s.TrySplitAt(pos, l, r));
- UNIT_ASSERT(l == "" && r == "abcabc");
-
- pos = s.find("ca");
- UNIT_ASSERT(s.TrySplitOn(pos, l, r));
- UNIT_ASSERT(l == "ab" && r == "abc");
- UNIT_ASSERT(s.TrySplitOn(pos, l, r, 2));
- UNIT_ASSERT(l == "ab" && r == "bc");
- UNIT_ASSERT(s.TrySplitAt(pos, l, r));
- UNIT_ASSERT(l == "ab" && r == "cabc");
-
- // out of range
- pos = 100500;
+ TStringBuf s = "abcabc";
+ TStringBuf l, r;
+
+ size_t pos = s.find('a');
+ UNIT_ASSERT(s.TrySplitOn(pos, l, r));
+ UNIT_ASSERT(l == "" && r == "bcabc");
+ UNIT_ASSERT(s.TrySplitAt(pos, l, r));
+ UNIT_ASSERT(l == "" && r == "abcabc");
+
+ pos = s.find("ca");
+ UNIT_ASSERT(s.TrySplitOn(pos, l, r));
+ UNIT_ASSERT(l == "ab" && r == "abc");
+ UNIT_ASSERT(s.TrySplitOn(pos, l, r, 2));
+ UNIT_ASSERT(l == "ab" && r == "bc");
+ UNIT_ASSERT(s.TrySplitAt(pos, l, r));
+ UNIT_ASSERT(l == "ab" && r == "cabc");
+
+ // out of range
+ pos = 100500;
UNIT_ASSERT(s.TrySplitOn(pos, l, r)); // still true
- UNIT_ASSERT(l == "abcabc" && r == "");
+ UNIT_ASSERT(l == "abcabc" && r == "");
l = "111";
r = "222";
UNIT_ASSERT(s.TrySplitAt(pos, l, r)); // still true
- UNIT_ASSERT(l == "abcabc" && r == "");
-
- // npos
- pos = s.find("missing");
+ UNIT_ASSERT(l == "abcabc" && r == "");
+
+ // npos
+ pos = s.find("missing");
l = "111";
r = "222";
- UNIT_ASSERT(!s.TrySplitOn(pos, l, r));
+ UNIT_ASSERT(!s.TrySplitOn(pos, l, r));
UNIT_ASSERT(l == "111" && r == "222"); // not modified
- s.SplitOn(pos, l, r);
+ s.SplitOn(pos, l, r);
UNIT_ASSERT(l == "abcabc" && r == ""); // modified
-
+
l = "111";
r = "222";
- UNIT_ASSERT(!s.TrySplitAt(pos, l, r));
+ UNIT_ASSERT(!s.TrySplitAt(pos, l, r));
UNIT_ASSERT(l == "111" && r == "222"); // not modified
- s.SplitAt(pos, l, r);
+ s.SplitAt(pos, l, r);
UNIT_ASSERT(l == "abcabc" && r == ""); // modified
- }
+ }
template <class T>
void PassByConstReference(const T& val) {
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 167e8ba0f9..3c655f1f66 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -45,12 +45,12 @@ TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf
auto dst = begin() + size() - s.size();
for (const char* src = s.data(); dst != end(); ++dst, ++src) {
- *dst = static_cast<wchar16>(*src);
- }
+ *dst = static_cast<wchar16>(*src);
+ }
return *this;
-}
-
+}
+
template <>
TUtf16String&
TBasicString<wchar16, std::char_traits<wchar16>>::AppendUtf8(const ::TStringBuf& s) {
diff --git a/util/generic/string.h b/util/generic/string.h
index 6b59124803..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -249,7 +249,7 @@ public:
return StdStr();
#endif
}
-
+
inline const_reference operator[](size_t pos) const noexcept {
Y_ASSERT(pos <= length());
@@ -627,7 +627,7 @@ public:
}
TBasicString& assign(const TCharType* pc, size_t pos, size_t n) {
- return assign(pc + pos, n);
+ return assign(pc + pos, n);
}
TBasicString& assign(const TBasicStringBuf<TCharType, TTraits> s) {
diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp
index 85c35f7485..b87fa2843e 100644
--- a/util/generic/string_transparent_hash_ut.cpp
+++ b/util/generic/string_transparent_hash_ut.cpp
@@ -6,7 +6,7 @@
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
#include <util/str_stl.h>
-
+
Y_UNIT_TEST_SUITE(StringHashFunctorTests) {
Y_UNIT_TEST(TestTransparencyWithUnorderedSet) {
// Using Abseil hash set because `std::unordered_set` is transparent only from C++20 (while
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp
index d8ec49cb70..ac82e9091d 100644
--- a/util/generic/string_ut.cpp
+++ b/util/generic/string_ut.cpp
@@ -4,11 +4,11 @@
#include "vector.h"
#include "yexception.h"
-#include <util/charset/wide.h>
+#include <util/charset/wide.h>
#include <util/str_stl.h>
#include <util/stream/output.h>
#include <util/string/subst.h>
-
+
#include <string>
#include <sstream>
#include <algorithm>
@@ -813,74 +813,74 @@ public:
UNIT_TEST(TestReverseIterators);
UNIT_TEST(TestStringLiterals);
UNIT_TEST_SUITE_END();
-
-private:
+
+private:
void TestDecodingMethods() {
UNIT_ASSERT(TUtf16String::FromAscii("").empty());
UNIT_ASSERT(TUtf16String::FromAscii("abc") == ASCIIToWide("abc"));
-
- const char* text = "123kx83abcd ej)#$%ddja&%J&";
+
+ const char* text = "123kx83abcd ej)#$%ddja&%J&";
TUtf16String wtext = ASCIIToWide(text);
UNIT_ASSERT(wtext == TUtf16String::FromAscii(text));
-
+
TString strtext(text);
UNIT_ASSERT(wtext == TUtf16String::FromAscii(strtext));
-
- TStringBuf strbuftext(text);
+
+ TStringBuf strbuftext(text);
UNIT_ASSERT(wtext == TUtf16String::FromAscii(strbuftext));
UNIT_ASSERT(wtext.substr(5) == TUtf16String::FromAscii(text + 5));
-
- const wchar16 wideCyrillicAlphabet[] = {
+
+ const wchar16 wideCyrillicAlphabet[] = {
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x00};
-
+
TUtf16String strWide(wideCyrillicAlphabet);
TString strUtf8 = WideToUTF8(strWide);
-
+
UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8.c_str()));
UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8));
UNIT_ASSERT(strWide == TUtf16String::FromUtf8(TStringBuf(strUtf8)));
-
- // assign
-
+
+ // assign
+
TUtf16String s1;
- s1.AssignAscii("1234");
- UNIT_ASSERT(s1 == ASCIIToWide("1234"));
-
- s1.AssignUtf8(strUtf8);
- UNIT_ASSERT(s1 == strWide);
-
- s1.AssignAscii(text);
- UNIT_ASSERT(s1 == wtext);
-
- // append
+ s1.AssignAscii("1234");
+ UNIT_ASSERT(s1 == ASCIIToWide("1234"));
+
+ s1.AssignUtf8(strUtf8);
+ UNIT_ASSERT(s1 == strWide);
+
+ s1.AssignAscii(text);
+ UNIT_ASSERT(s1 == wtext);
+
+ // append
TUtf16String s2;
TUtf16String testAppend = strWide;
- s2.AppendUtf8(strUtf8);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += ' ';
- s2.AppendAscii(" ");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += '_';
- s2.AppendUtf8("_");
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendAscii(text);
- UNIT_ASSERT(testAppend == s2);
-
- testAppend += wtext;
- s2.AppendUtf8(text);
- UNIT_ASSERT(testAppend == s2);
- }
+ s2.AppendUtf8(strUtf8);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += ' ';
+ s2.AppendAscii(" ");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += '_';
+ s2.AppendUtf8("_");
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendAscii(text);
+ UNIT_ASSERT(testAppend == s2);
+
+ testAppend += wtext;
+ s2.AppendUtf8(text);
+ UNIT_ASSERT(testAppend == s2);
+ }
void TestLetOperator() {
TUtf16String str;
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index 52f7277e49..44bb10bdeb 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -21,7 +21,7 @@ struct TCharBuffer {
return Data;
}
};
-
+
template <>
struct TCharBuffer<char, 0> {
const char* Data;
diff --git a/util/generic/vector.h b/util/generic/vector.h
index 751fd13577..a5b258955a 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -99,9 +99,9 @@ public:
}
inline explicit operator bool() const noexcept {
- return !this->empty();
- }
-
+ return !this->empty();
+ }
+
Y_PURE_FUNCTION inline bool empty() const noexcept {
return TBase::empty();
}