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 /library/cpp/containers/stack_vector/stack_vec.h | |
parent | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff) | |
download | ydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/stack_vector/stack_vec.h')
-rw-r--r-- | library/cpp/containers/stack_vector/stack_vec.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h index 02bd049629..fcc5d9a2a5 100644 --- a/library/cpp/containers/stack_vector/stack_vec.h +++ b/library/cpp/containers/stack_vector/stack_vec.h @@ -57,22 +57,22 @@ namespace NPrivate { : Alloc(std::forward<TArgs>(args)...) {} - T* allocate(size_type n) { + T* allocate(size_type n) { if (!IsStorageUsed && CountOnStack >= n) { IsStorageUsed = true; - return reinterpret_cast<T*>(&StackBasedStorage[0]); + return reinterpret_cast<T*>(&StackBasedStorage[0]); } else { if constexpr (!UseFallbackAlloc) { Y_FAIL( "Stack storage overflow. Capacity: %d, requested: %d", (int)CountOnStack, int(n)); } - return FallbackAllocator().allocate(n); + return FallbackAllocator().allocate(n); } } - void deallocate(T* p, size_type n) { - if (p >= reinterpret_cast<T*>(&StackBasedStorage[0]) && - p < reinterpret_cast<T*>(&StackBasedStorage[CountOnStack])) { + void deallocate(T* p, size_type n) { + if (p >= reinterpret_cast<T*>(&StackBasedStorage[0]) && + p < reinterpret_cast<T*>(&StackBasedStorage[CountOnStack])) { Y_VERIFY(IsStorageUsed); IsStorageUsed = false; } else { @@ -93,10 +93,10 @@ namespace NPrivate { template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc> class TStackVec: public TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>> { -private: - using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>; +private: + using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>; using TAllocator = typename TBase::allocator_type; - + public: using typename TBase::const_iterator; using typename TBase::const_reverse_iterator; @@ -130,7 +130,7 @@ public: TBase::assign(count, val); } - TStackVec(const TStackVec& src) + TStackVec(const TStackVec& src) : TStackVec(src.begin(), src.end()) { } @@ -167,21 +167,21 @@ public: } public: - void swap(TStackVec&) = delete; + void swap(TStackVec&) = delete; void shrink_to_fit() = delete; - TStackVec& operator=(const TStackVec& src) { + TStackVec& operator=(const TStackVec& src) { TBase::assign(src.begin(), src.end()); return *this; } template <class A> - TStackVec& operator=(const TVector<T, A>& src) { + TStackVec& operator=(const TVector<T, A>& src) { TBase::assign(src.begin(), src.end()); return *this; } - TStackVec& operator=(std::initializer_list<T> il) { + TStackVec& operator=(std::initializer_list<T> il) { TBase::assign(il.begin(), il.end()); return *this; } |