diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
commit | e988f30484abe5fdeedcc7a5d3c226c01a21800c (patch) | |
tree | 0a217b173aabb57b7e51f8a169989b1a3e0309fe /library/cpp/openssl/holders/holder.h | |
parent | 33ee501c05d3f24036ae89766a858930ae66c548 (diff) | |
download | ydb-e988f30484abe5fdeedcc7a5d3c226c01a21800c.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/openssl/holders/holder.h')
-rw-r--r-- | library/cpp/openssl/holders/holder.h | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/openssl/holders/holder.h b/library/cpp/openssl/holders/holder.h index c2a26ce431..f6049ebd02 100644 --- a/library/cpp/openssl/holders/holder.h +++ b/library/cpp/openssl/holders/holder.h @@ -1,32 +1,32 @@ -#pragma once - -#include <util/generic/yexception.h> - -namespace NOpenSSL { - -template <typename TType, auto Create, auto Destroy, class... Args> -class THolder { -public: - inline THolder(Args... args) { - Ptr = Create(args...); - if (!Ptr) { +#pragma once + +#include <util/generic/yexception.h> + +namespace NOpenSSL { + +template <typename TType, auto Create, auto Destroy, class... Args> +class THolder { +public: + inline THolder(Args... args) { + Ptr = Create(args...); + if (!Ptr) { throw std::bad_alloc(); - } - } - - THolder(const THolder&) = delete; - THolder& operator=(const THolder&) = delete; - - inline ~THolder() noexcept { - Destroy(Ptr); - } - - inline operator TType* () noexcept { - return Ptr; - } - -private: - TType* Ptr; -}; - -} + } + } + + THolder(const THolder&) = delete; + THolder& operator=(const THolder&) = delete; + + inline ~THolder() noexcept { + Destroy(Ptr); + } + + inline operator TType* () noexcept { + return Ptr; + } + +private: + TType* Ptr; +}; + +} |