diff options
author | babenko <babenko@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
commit | cec37806d8847aa3db53bafc9e251d4aaf325c12 (patch) | |
tree | 4a61c191e93e31d9ab423e258c71ab43550ee3d2 /library/cpp/yt/memory/leaky_singleton-inl.h | |
parent | 58cd0b86ed99a72df22479e26a20bc1c1e57e65e (diff) | |
download | ydb-cec37806d8847aa3db53bafc9e251d4aaf325c12.tar.gz |
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yt/memory/leaky_singleton-inl.h')
-rw-r--r-- | library/cpp/yt/memory/leaky_singleton-inl.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/yt/memory/leaky_singleton-inl.h b/library/cpp/yt/memory/leaky_singleton-inl.h index 932747c921..4c7212e1be 100644 --- a/library/cpp/yt/memory/leaky_singleton-inl.h +++ b/library/cpp/yt/memory/leaky_singleton-inl.h @@ -1,34 +1,34 @@ -#ifndef LEAKY_SINGLETON_INL_H_ -#error "Direct inclusion of this file is not allowed, include leaky_singleton.h" -// For the sake of sane code completion. -#include "leaky_singleton.h" -#endif - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -template <class T> -TLeakyStorage<T>::TLeakyStorage() -{ - new (Get()) T(); -} - -template <class T> -T* TLeakyStorage<T>::Get() -{ - return reinterpret_cast<T*>(Buffer_); -} - -//////////////////////////////////////////////////////////////////////////////// - -template <class T> -T* LeakySingleton() -{ - static TLeakyStorage<T> Storage; - return Storage.Get(); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT +#ifndef LEAKY_SINGLETON_INL_H_ +#error "Direct inclusion of this file is not allowed, include leaky_singleton.h" +// For the sake of sane code completion. +#include "leaky_singleton.h" +#endif + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +TLeakyStorage<T>::TLeakyStorage() +{ + new (Get()) T(); +} + +template <class T> +T* TLeakyStorage<T>::Get() +{ + return reinterpret_cast<T*>(Buffer_); +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +T* LeakySingleton() +{ + static TLeakyStorage<T> Storage; + return Storage.Get(); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT |