Boost logo

Boost :

Subject: Re: [boost] [outcome] High level summary of review feedback accepted so far
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-30 12:43:17

Gavin Lambert wrote:

> - 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 behavior of returning {errc::no_value} (or, as I called it,
{errc::uninitialized}) on empty incidentally matches that of a never-empty
result that initializes itself to {errc::no_value} on default construction,
as I suggested.

Note how in both cases, error() on a default-constructed result would return
{errc::no_value}, and the behavior of value() and exception() (for outcome)
is the same, too. If you provide empty() for the never-empty that returns
error() == errc::no_value, that will match as well. The only difference
would be that has_error will be false for the empty result and true for the
non-empty one.

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