diff options
author | the0 <the0@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
commit | b668a9fdd804ac5f20f1596f1c23dbd438d3dfe8 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb /util | |
parent | 6ab3ef1bf61ea8fc15ead03026798320e25c5455 (diff) | |
download | ydb-b668a9fdd804ac5f20f1596f1c23dbd438d3dfe8.tar.gz |
Restoring authorship annotation for <the0@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/generic/lazy_value.h | 6 | ||||
-rw-r--r-- | util/generic/lazy_value_ut.cpp | 90 | ||||
-rw-r--r-- | util/system/thread.h | 2 |
3 files changed, 49 insertions, 49 deletions
diff --git a/util/generic/lazy_value.h b/util/generic/lazy_value.h index 447886977b..3c720f76b5 100644 --- a/util/generic/lazy_value.h +++ b/util/generic/lazy_value.h @@ -9,9 +9,9 @@ public: using TInitializer = std::function<T()>; TLazyValueBase() = default; - - TLazyValueBase(TInitializer initializer) - : Initializer(std::move(initializer)) + + TLazyValueBase(TInitializer initializer) + : Initializer(std::move(initializer)) { } diff --git a/util/generic/lazy_value_ut.cpp b/util/generic/lazy_value_ut.cpp index faca68d03f..f6135880c3 100644 --- a/util/generic/lazy_value_ut.cpp +++ b/util/generic/lazy_value_ut.cpp @@ -42,53 +42,53 @@ Y_UNIT_TEST_SUITE(TLazyValueTestSuite) { UNIT_ASSERT_EQUAL(*notEmptyCopy, 5); } - struct TCopyCounter { - TCopyCounter(size_t& numCopies) - : NumCopies(&numCopies) - { - } - - TCopyCounter() = default; - - TCopyCounter(const TCopyCounter& other) - : NumCopies(other.NumCopies) - { - ++(*NumCopies); - } - - TCopyCounter(TCopyCounter&&) = default; - - TCopyCounter& operator=(const TCopyCounter& other) { - if (this == &other) { - return *this; - } - NumCopies = other.NumCopies; - ++(*NumCopies); - return *this; - } - - TCopyCounter& operator=(TCopyCounter&&) = default; - - size_t* NumCopies = nullptr; - }; - - Y_UNIT_TEST(TestLazyValueMoveValueInitialization) { - size_t numCopies = 0; - TCopyCounter counter{numCopies}; + struct TCopyCounter { + TCopyCounter(size_t& numCopies) + : NumCopies(&numCopies) + { + } + + TCopyCounter() = default; + + TCopyCounter(const TCopyCounter& other) + : NumCopies(other.NumCopies) + { + ++(*NumCopies); + } + + TCopyCounter(TCopyCounter&&) = default; + + TCopyCounter& operator=(const TCopyCounter& other) { + if (this == &other) { + return *this; + } + NumCopies = other.NumCopies; + ++(*NumCopies); + return *this; + } + + TCopyCounter& operator=(TCopyCounter&&) = default; + + size_t* NumCopies = nullptr; + }; + + Y_UNIT_TEST(TestLazyValueMoveValueInitialization) { + size_t numCopies = 0; + TCopyCounter counter{numCopies}; TLazyValue<TCopyCounter> value{[v = std::move(counter)]() mutable { return std::move(v); }}; - value.InitDefault(); - UNIT_ASSERT_EQUAL(numCopies, 0); - } - - Y_UNIT_TEST(TestLazyValueCopyValueInitialization) { - size_t numCopies = 0; - TCopyCounter counter{numCopies}; + value.InitDefault(); + UNIT_ASSERT_EQUAL(numCopies, 0); + } + + Y_UNIT_TEST(TestLazyValueCopyValueInitialization) { + size_t numCopies = 0; + TCopyCounter counter{numCopies}; TLazyValue<TCopyCounter> value{[&counter]() { return counter; }}; - UNIT_ASSERT_EQUAL(numCopies, 0); - value.InitDefault(); - UNIT_ASSERT_EQUAL(numCopies, 1); - } - + UNIT_ASSERT_EQUAL(numCopies, 0); + value.InitDefault(); + UNIT_ASSERT_EQUAL(numCopies, 1); + } + class TValueProvider { public: static size_t CountParseDataCalled; diff --git a/util/system/thread.h b/util/system/thread.h index b260108729..a6e8abdb5b 100644 --- a/util/system/thread.h +++ b/util/system/thread.h @@ -153,7 +153,7 @@ private: TThread(TPrivateCtor, THolder<TCallableBase> callable); private: - class TImpl; + class TImpl; THolder<TImpl> Impl_; }; |