File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,16 @@ class Lazy {
4545 public:
4646 template <typename ... Args>
4747 requires std::invocable<decltype (InitFunc), Args...> &&
48- std::same_as<std::invoke_result_t <decltype (InitFunc), Args...>,
49- iceberg::Result<T>>
50- iceberg::Result<T*> get (Args&&... args) const {
51- iceberg::Result<T> result;
52- std::call_once (
53- flag, [&result, &args...]() { result = InitFunc (std::forward<Args>(args)...); });
54- ICEBERG_ASSIGN_OR_RAISE (this ->value , result);
48+ std::same_as<std::invoke_result_t <decltype (InitFunc), Args...>, Result<T>>
49+ Result<T*> get (Args&&... args) const {
50+ Result<T> result;
51+ std::call_once (flag, [&result, this , &args...]() {
52+ result = InitFunc (std::forward<Args>(args)...);
53+ if (result) {
54+ this ->value = std::move (result.value ());
55+ }
56+ });
57+ ICEBERG_RETURN_UNEXPECTED (result);
5558 return &value;
5659 }
5760
You can’t perform that action at this time.
0 commit comments