23 Jan
2018
23 Jan
'18
9:33 a.m.
It's not too controversial for result<>, but in outcome<> "!r" will be true if there isn't a value, but "r.error()" might throw or UB in that case if it has an exception without an error code.
So the long-form of that test would be:
if ( r.has_error() && r.error() == condition )
For `outcome` yes, for `result` you are guaranteed this is safe: if(!r && r.error() == condition) And just to remind people, `outcome` has a synthesising `failure()` function which does what `exception()` did in Outcome v1, so this is also guaranteed safe: if(!o) std::rethrow_exception(o.failure()) Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/