
23 Apr
2013
23 Apr
'13
2:18 p.m.
2013/4/23 Pierre T.
Hello, std::expected
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
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