28 template<
typename Source,
typename Object>
33 std::optional<Object> Object_;
49 template<
typename Init>
55 , ClearSource_ { clear }
76 ClearSource_ (Source_);
106 Object_ = Initializer_ (Source_);
107 ClearSource_ (Source_);
Provides lazy initialization on first access to an object.
Object & operator->()
Indirection operator, forcing object construction.
LazyInitializer(const Source &source, const Init &initializer, const std::function< void(Source &)> &clear=[](Source &src) { src=Source {};})
Constructs an unevaluated lazy initializer.
LazyInitializer & operator=(const Object &object)
Assigns an object to this lazy (making it evaluated) initializer and clears the source.
LazyInitializer(const Object &object)
Constructs an evaluated initializer from the object.
Container< T > Filter(const Container< T > &c, F f)
constexpr auto Init(List< Args... >)