Boost logo

Boost :

Subject: Re: [boost] [outcome] Exception safety guarantees
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-27 23:27:32

Andrzej Krzemienski wrote:
> ```
> expected<T, E> o = fun();
> // (*)
> if (o.has_value()) ...
> ```
> Upon the call to has_value() how is it possible that I am experiencing the
> valueless_by_exception state?

It's not possible to experience that state here. It's possible to experience
it in other scenarios. If o is non-local, for example, the assignment
throws, and a catch block either catches the exception and further code
examines o, or if the catch block or a destructor calls a function that
examines o.

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