Subject: Re: [boost] Outcome/expected/etc/etc/etc
From: Peter Dimov (lists_at_[hidden])
Date: 2017-06-05 12:06:27


> I see this as a promising direction because it would allow you to store
> both an error and an exception, as per the other thread. Then you can
> fully represent a Filesystem function with an outcome return value,
> because you'll be able to store the error_code return in error() and the
> filesystem_error exception in exception().

To be more precise, you'll be able to represent the exact equivalent of the
two Filesystem overloads with a single function.

    R filesystem_api(); // throws filesystem_error
    R filesystem_api( error_code& ec ) noexcept;

->

    outcome<R> filesystem_api();

Here r.error() is what ec in the second overload above would hold;
r.exception() is what the first overload would throw. (And of course
r.value() is what they would return.)