diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/containers/comptrie/array_with_size.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/comptrie/array_with_size.h')
-rw-r--r-- | library/cpp/containers/comptrie/array_with_size.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/library/cpp/containers/comptrie/array_with_size.h b/library/cpp/containers/comptrie/array_with_size.h index 148200fe6a..36e61c7410 100644 --- a/library/cpp/containers/comptrie/array_with_size.h +++ b/library/cpp/containers/comptrie/array_with_size.h @@ -3,19 +3,19 @@ #include <util/generic/ptr.h> #include <util/generic/noncopyable.h> #include <util/generic/utility.h> -#include <util/system/sys_alloc.h> +#include <util/system/sys_alloc.h> template <typename T> -class TArrayWithSizeHolder : TNonCopyable { +class TArrayWithSizeHolder : TNonCopyable { typedef TArrayWithSizeHolder<T> TThis; T* Data; public: - TArrayWithSizeHolder() - : Data(nullptr) - { - } + TArrayWithSizeHolder() + : Data(nullptr) + { + } ~TArrayWithSizeHolder() { if (!Data) @@ -26,7 +26,7 @@ public: } catch (...) { } } - y_deallocate(((size_t*)Data) - 1); + y_deallocate(((size_t*)Data) - 1); } void Swap(TThis& copy) { @@ -37,7 +37,7 @@ public: if (newSize == Size()) return; TThis copy; - copy.Data = (T*)(((size_t*)y_allocate(sizeof(size_t) + sizeof(T) * newSize)) + 1); + copy.Data = (T*)(((size_t*)y_allocate(sizeof(size_t) + sizeof(T) * newSize)) + 1); // does not handle constructor exceptions properly for (size_t i = 0; i < Min(Size(), newSize); ++i) { new (copy.Data + i) T(Data[i]); @@ -45,12 +45,12 @@ public: for (size_t i = Min(Size(), newSize); i < newSize; ++i) { new (copy.Data + i) T; } - ((size_t*)copy.Data)[-1] = newSize; + ((size_t*)copy.Data)[-1] = newSize; Swap(copy); } size_t Size() const { - return Data ? ((size_t*)Data)[-1] : 0; + return Data ? ((size_t*)Data)[-1] : 0; } bool Empty() const { |