diff options
author | kzhagorina <[email protected]> | 2022-02-10 16:52:08 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:52:08 +0300 |
commit | c39389ed2a289ad2298240c5f04d6a17fdac57d9 (patch) | |
tree | 1ec0b7793799ee4ff6de6899107f4aa938c51dd7 /util/generic/lazy_value.h | |
parent | 0cd79982d21be2f97f3801e35c4f9a2045dcefc2 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 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 3c720f76b5a..8c65dafb92f 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)}; |