37 using InitResult =
typename decltype(std::function{InitFunc})::result_type;
38 using T = ResultValueT<InitResult>;
41 template <
typename... Args>
42 requires std::invocable<
decltype(InitFunc), Args...>
43 Result<std::reference_wrapper<T>> Get(Args&&... args)
const {
45 flag_, [
this, &args...]() { value_ = InitFunc(std::forward<Args>(args)...); });
46 ICEBERG_RETURN_UNEXPECTED(value_);
47 return std::ref(*value_);
51 mutable Result<T> value_ = Invalid(
"Lazy value has not been initialized");
52 mutable std::once_flag flag_;