Boost logo

Boost :

Subject: Re: [boost] [outcome] High level summary of review feedback accepted so far
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-30 13:18:09

> FWIW, my preferred options would be (which I think were the originals):
> - value() throws if holding error or exception (or empty)
> - error() returns E{} if holding value or E{errc::has_exception} if
> holding exception, or E{errc::no_value} if empty (names made up on the
> spot, doesn't matter)

The current behaviour is "always throw on observing empty". That's what
makes empty special (and it traps unintentional propagation of empty).

> - exception() returns nullptr if holding value or error or empty

The current behaviour is to return null exception_ptr if valued (so
if(eptr) would be false i.e. "no exception here"),
std::make_exception_ptr(std::system_error(error())) if errored, throw on

So an errored state is also an excepted state, but an excepted state is
never an errored state. has_exception() returns true for either errored
or excepted states.

std::make_exception_ptr(std::system_error(error())) is fairly cheap, a
few thousand CPU cycles. std::exception_ptr's are heavy anyway.

> I would prefer that unchecked_* (or whatever) versions did not exist as
> then nobody would accidentally call them and perhaps introduce UB. But
> I'm not strongly opposed to them.

The __built_unreachable() is what convinced me they have merit.


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at