Boost logo

Boost :

Subject: Re: [boost] [outcome] comments on Regular ops
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2018-01-23 09:33:22

> 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())


ned Productions Limited Consulting

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