diff options
author | kzhagorina <kzhagorina@yandex-team.ru> | 2022-02-10 16:52:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:08 +0300 |
commit | d3adae76593c2a6b659badc21bfa262bec99a298 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb /util/generic/lazy_value.h | |
parent | c39389ed2a289ad2298240c5f04d6a17fdac57d9 (diff) | |
download | ydb-d3adae76593c2a6b659badc21bfa262bec99a298.tar.gz |
Restoring authorship annotation for <kzhagorina@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/lazy_value.h')
-rw-r--r-- | util/generic/lazy_value.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/util/generic/lazy_value.h b/util/generic/lazy_value.h index 8c65dafb92..3c720f76b5 100644 --- a/util/generic/lazy_value.h +++ b/util/generic/lazy_value.h @@ -4,11 +4,11 @@ #include "function.h" template <class T> -class TLazyValueBase { +class TLazyValueBase { public: using TInitializer = std::function<T()>; - TLazyValueBase() = default; + TLazyValueBase() = default; TLazyValueBase(TInitializer initializer) : Initializer(std::move(initializer)) @@ -48,18 +48,18 @@ private: TInitializer Initializer; }; -// we need this to get implicit construction TLazyValue from lambda -// and save default copy constructor and operator= for type TLazyValue -template <class T> +// we need this to get implicit construction TLazyValue from lambda +// and save default copy constructor and operator= for type TLazyValue +template <class T> class TLazyValue: public TLazyValueBase<T> { -public: - template <typename... TArgs> - TLazyValue(TArgs&&... args) - : TLazyValueBase<T>(std::forward<TArgs>(args)...) +public: + template <typename... TArgs> + TLazyValue(TArgs&&... args) + : TLazyValueBase<T>(std::forward<TArgs>(args)...) { } -}; - +}; + template <typename F> TLazyValue<TFunctionResult<F>> MakeLazy(F&& f) { return {std::forward<F>(f)}; |