|
Boost : |
Subject: Re: [boost] [review] **NEXT WEEK** Review of Outcome (starts Fri-19-May)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-05-12 18:00:50
2017-05-12 18:26 GMT+02:00 Niall Douglas via Boost <boost_at_[hidden]>:
> On 12/05/2017 14:13, Jarrad Waterloo via Boost wrote:
> > How does expected work in a world of multiple return value, structured
> bindings?
>
> I see no reason that they shouldn't work perfectly. Expected provides
> lvalue, const lvalue, rvalue and const rvalue observers. So it should
> just work.
>
> But I'll admit I haven't tested it. Can you suggest a use case which you
> would like to know if it works with Expected? I can throw together some
> code and see if it works for you.
>
Or maybe what Jarrad was asking was wether one could write code like this:
```
outcome<int> fun();
int main()
{
auto [val, err] = fun();
if (err) ...
}
```
But if this was the question: outcome cannot be used in this way. For the
same reason as variant<> cannot be used here: because outcome<> can store
only one of - value or error code - at a time: never both.
Regards,
&zej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk