28 template<
typename Source,
typename Object>
33 std::optional<Object> Object_;
35 std::function<Object (Source)> Initializer_;
36 std::function<void (Source&)> ClearSource_;
49 template<
typename Init>
51 const Init& initializer,
52 const std::function<
void (Source&)>& clear = [] (Source& src) { src = Source {}; })
54 , Initializer_ { initializer }
55 , ClearSource_ { clear }
76 ClearSource_ (Source_);
106 Object_ = Initializer_ (Source_);
107 ClearSource_ (Source_);