|
Boost : |
Subject: Re: [boost] [gsoc-2013] Boost.Expected
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-04-23 10:18:31
2013/4/23 Pierre T. <ptalbot_at_[hidden]>
> Hello,
> std::expected<int, Exception> exp;
>
>>
>> int x = exp.value(); // has no value - does this throw
>> bad_expected_access,
>> or does it throw Exception()?
>>
>> Actually, expected contains an error and we don't know anything about
> the type of the error so we cannot throw it. It's what I called
> expected_base<T, Error> in my previous mails, the get() on expected_base
> doesn't throw and if expected_base doesn't contain a value, then undefined
> behavior occurs.
>
Hmm, couldn't the original error be thrown anyway (if the wrapping type had
a virtual function that would throw the error)?
Regards,
Kris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk