27 May
2017
27 May
'17
11:27 p.m.
Andrzej Krzemienski wrote:
``` expected
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.