diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/containers/stack_array/range_ops.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers/stack_array/range_ops.h')
-rw-r--r-- | library/cpp/containers/stack_array/range_ops.h | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/library/cpp/containers/stack_array/range_ops.h b/library/cpp/containers/stack_array/range_ops.h index 1d40341aa1..dfb95ab401 100644 --- a/library/cpp/containers/stack_array/range_ops.h +++ b/library/cpp/containers/stack_array/range_ops.h @@ -1,52 +1,52 @@ -#pragma once - -#include <util/generic/typetraits.h> - -#include <new> - -namespace NRangeOps { - template <class T, bool isTrivial> - struct TRangeOpsBase { +#pragma once + +#include <util/generic/typetraits.h> + +#include <new> + +namespace NRangeOps { + template <class T, bool isTrivial> + struct TRangeOpsBase { static inline void DestroyRange(T* b, T* e) noexcept { - while (e > b) { - (--e)->~T(); - } - } - - static inline void InitializeRange(T* b, T* e) { - T* c = b; - - try { - for (; c < e; ++c) { - new (c) T(); - } - } catch (...) { - DestroyRange(b, c); - - throw; - } - } - }; - - template <class T> - struct TRangeOpsBase<T, true> { + while (e > b) { + (--e)->~T(); + } + } + + static inline void InitializeRange(T* b, T* e) { + T* c = b; + + try { + for (; c < e; ++c) { + new (c) T(); + } + } catch (...) { + DestroyRange(b, c); + + throw; + } + } + }; + + template <class T> + struct TRangeOpsBase<T, true> { static inline void DestroyRange(T*, T*) noexcept { - } - + } + static inline void InitializeRange(T*, T*) noexcept { - } - }; - - template <class T> - using TRangeOps = TRangeOpsBase<T, TTypeTraits<T>::IsPod>; - - template <class T> + } + }; + + template <class T> + using TRangeOps = TRangeOpsBase<T, TTypeTraits<T>::IsPod>; + + template <class T> static inline void DestroyRange(T* b, T* e) noexcept { - TRangeOps<T>::DestroyRange(b, e); - } - - template <class T> - static inline void InitializeRange(T* b, T* e) { - TRangeOps<T>::InitializeRange(b, e); - } -} + TRangeOps<T>::DestroyRange(b, e); + } + + template <class T> + static inline void InitializeRange(T* b, T* e) { + TRangeOps<T>::InitializeRange(b, e); + } +} |