Subject: Re: [std-proposals] P0323 std::expected - void value type?
From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2020-10-05 10:55:46
On Mon, Oct 5, 2020 at 10:42 AM Emile Cormier via Std-Proposals <
> 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
> 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
STD-PROPOSALS list run by email@example.com
Standard Proposals Archives on Google Groups