diff options
author | Evgeny Grechnikov <diamondaz@yandex.ru> | 2022-02-10 16:46:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:20 +0300 |
commit | c73494e681a4e497ae191ada07a55a6bf55885ff (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/memory | |
parent | 6e38f52f898d7c077ddd319800b4014967a5ca76 (diff) | |
download | ydb-c73494e681a4e497ae191ada07a55a6bf55885ff.tar.gz |
Restoring authorship annotation for Evgeny Grechnikov <diamondaz@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/memory')
-rw-r--r-- | util/memory/pool.h | 4 | ||||
-rw-r--r-- | util/memory/pool_ut.cpp | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/util/memory/pool.h b/util/memory/pool.h index cc51e96e70..13c8b6b9ed 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -189,8 +189,8 @@ public: return ptr; } - template <typename T, typename... Args> - inline T* New(Args&&... args) { + template <typename T, typename... Args> + inline T* New(Args&&... args) { return new (Allocate<T>()) T(std::forward<Args>(args)...); } diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp index aa4ff9ca6c..1158a8ca42 100644 --- a/util/memory/pool_ut.cpp +++ b/util/memory/pool_ut.cpp @@ -135,9 +135,9 @@ private: } alloc.CheckAtEnd(); - - struct TConstructorTest { - int ConstructorType; + + struct TConstructorTest { + int ConstructorType; TConstructorTest() : ConstructorType(1) { @@ -154,19 +154,19 @@ private: : ConstructorType(4) { } - }; - - { - TMemoryPool pool(123, TMemoryPool::TExpGrow::Instance(), &alloc); + }; + + { + TMemoryPool pool(123, TMemoryPool::TExpGrow::Instance(), &alloc); THolder<TConstructorTest, TDestructor> data1{pool.New<TConstructorTest>()}; THolder<TConstructorTest, TDestructor> data2{pool.New<TConstructorTest>(42)}; THolder<TConstructorTest, TDestructor> data3{pool.New<TConstructorTest>("hello", "world")}; - UNIT_ASSERT_VALUES_EQUAL(data1->ConstructorType, 1); - UNIT_ASSERT_VALUES_EQUAL(data2->ConstructorType, 2); - UNIT_ASSERT_VALUES_EQUAL(data3->ConstructorType, 4); - } - - alloc.CheckAtEnd(); + UNIT_ASSERT_VALUES_EQUAL(data1->ConstructorType, 1); + UNIT_ASSERT_VALUES_EQUAL(data2->ConstructorType, 2); + UNIT_ASSERT_VALUES_EQUAL(data3->ConstructorType, 4); + } + + alloc.CheckAtEnd(); } inline void TestAlign() { |