|
Boost : |
Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-19 00:37:47
On 19/05/2017 11:11, Niall Douglas wrote:
>>> 2. .ensure(empty|value|error|exception) will perform the default actions
>>> of calling the observer function for that state, but not return that state.
>>
>> Weak yes. - I am not sure why you need this fancy syntax.
>
> The constexpr variables are already there. So basically do we prefer:
>
> 1. .ensure_empty(), .ensure_value(), .ensure_error() and .ensure_exception()
>
> 2. Or .ensure(empty), .ensure(value), .ensure(error) and .ensure(exception)
>
> I figure the latter looked nicer. It's same difference to the compiler,
> simple overload matching is constant time.
But why have them at all, rather than just calling value(), error(), etc
and discarding the return value? They're also constexpr.
Also, what code patterns would lead to wanting to do that frequently
anyway? Given that the whole point is to transport a value or an error,
it seems odd to have code paths that want to throw if a value or error
was not produced but then not actually care what the "right" thing was.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk