diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:12 +0300 |
commit | 49116032d905455a7b1c994e4a696afc885c1e71 (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /util/generic/vector_ut.cpp | |
parent | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff) | |
download | ydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/vector_ut.cpp')
-rw-r--r-- | util/generic/vector_ut.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp index 0119ef35c7..0f6b4037a0 100644 --- a/util/generic/vector_ut.cpp +++ b/util/generic/vector_ut.cpp @@ -473,10 +473,10 @@ private: struct TPod { int x; - - operator int() { - return x; - } + + operator int() { + return x; + } }; struct TNonPod { @@ -484,10 +484,10 @@ private: TNonPod() { x = 0; } - - operator int() { - return x; - } + + operator int() { + return x; + } }; template <typename T> @@ -495,8 +495,8 @@ private: public: using TBase = std::allocator<T>; - T* allocate(typename TBase::size_type n) { - auto p = TBase::allocate(n); + T* allocate(typename TBase::size_type n) { + auto p = TBase::allocate(n); for (size_t i = 0; i < n; ++i) { memset(p + i, 0xab, sizeof(T)); } @@ -510,28 +510,28 @@ private: }; template <typename T> - void TestYResize() { -#ifdef _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED - constexpr bool ALLOW_UNINITIALIZED = std::is_pod_v<T>; -#else - constexpr bool ALLOW_UNINITIALIZED = false; -#endif - + void TestYResize() { +#ifdef _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED + constexpr bool ALLOW_UNINITIALIZED = std::is_pod_v<T>; +#else + constexpr bool ALLOW_UNINITIALIZED = false; +#endif + TVector<T, TDebugAlloc<T>> v; v.reserve(5); - auto firstBegin = v.begin(); + auto firstBegin = v.begin(); - v.yresize(5); // No realloc, no initialization if allowed + v.yresize(5); // No realloc, no initialization if allowed UNIT_ASSERT(firstBegin == v.begin()); for (int i = 0; i < 5; ++i) { - UNIT_ASSERT_VALUES_EQUAL(bool(v[i]), ALLOW_UNINITIALIZED); + UNIT_ASSERT_VALUES_EQUAL(bool(v[i]), ALLOW_UNINITIALIZED); } - v.yresize(20); // Realloc, still no initialization + v.yresize(20); // Realloc, still no initialization UNIT_ASSERT(firstBegin != v.begin()); for (int i = 0; i < 20; ++i) { - UNIT_ASSERT_VALUES_EQUAL(bool(v[i]), ALLOW_UNINITIALIZED); + UNIT_ASSERT_VALUES_EQUAL(bool(v[i]), ALLOW_UNINITIALIZED); } } @@ -559,9 +559,9 @@ private: } void TestYResize() { - TestYResize<int>(); - TestYResize<TPod>(); - TestYResize<TNonPod>(); + TestYResize<int>(); + TestYResize<TPod>(); + TestYResize<TNonPod>(); } void CheckInitializeList(const TVector<int>& v) { |