Andrzej Krzemienski вроте:
vector
os (20); // no value or error to assign yet for (auto const& e : some_collection) if (cond(e)) os[i].set_value(); else os[i].set_exception();
.set_error presumably. (Incidentally, result<> is documented to have set_exception, which makes no sense to me.)
And in some cases, you cannot immediately rewrite the code in order to avoid default construction. You do not want to return an "empty" object, but you need this value temporarily, end there may be no good value of `E` to use.
The argument that it's better to default-construct to some kind of a valueless state instead of T{} is legitimate, but even if I grant all the premises of that example (which is a stretch), I still don't see why default-constructing to make_error_code( outcome_errc::uninitiaized ) isn't better than special-casing the empty state.