Boost logo

Boost :

Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-31 23:06:54


On 31/05/2017 20:44, Andrzej Krzemienski wrote:
> 2017-05-31 10:26 GMT+02:00 Gavin Lambert:
>> Anyway, the point is that this could actually transport multiple things;
>> in particular as above both an error_code and an exception_ptr; perhaps
>> set(error_code) could construct an exception as well, although I've
>> explained elsewhere why I don't like that option.
>
> In your mental model what is the interpretation of the situation when you
> have both an error_code and an exception_ptr?

Mostly where error() returns the error_code and exception() returns the
system_error(error()), so that the caller could choose to treat it
either way, as you'd expect.

Conceivably there could be cases where someone might want to have a
different type of exception (eg. errc::invalid_argument plus
std::out_of_range or a derived type, which might convey some additional
information), although that could also be a can of worms best left unopened.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk