On Mon, Oct 5, 2020 at 10:42 AM Emile Cormier via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Thanks, Arthur. Thinking of expected as a "wrapper" around a return type makes more sense to me now than thinking of it as a "container of one or error".

If C/C++ had been designed with void being an empty monostate value type, I guess we wouldn't have all this trouble of treating void as a special case in generic programming. Libraries wouldn't have needed to invent their own "nothing" types like nullopt_t or monostate_t.

std::monostate (no _t), yes. But we'd need nullopt anyway in order to properly identify the empty state of the optional, which is why you cannot have an optional<nullopt_t>. Similar to how Haskell/Rust have a proper unit type - spelled () - but nevertheless have Nothing/None to identify the empty state.

Barry