Subject: Re: [boost] [outcome] Possible extensions/changes to std::experimental::expected
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-29 06:54:22
On 27/05/2017 01:16, Niall Douglas wrote:
>> Outcome uses a different mitigation by restricting the possible types of
>> E, rendering the above case very unlikely (although not impossible,
>> since outcome<error_code> is legal).
> A static assert should prevent construction with a T convertible to or
> from an error_code_extended or a std::exception_ptr. As
> error_code_extended explicitly constructs from error_code,
> outcome<error_code> should not compile.
Sorry, I probably should have said "since *I assume* outcome<error_code>
I can imagine some scenarios where that might be useful (perhaps as part
of some error translation code which wants to return a modified value
but can also fail) but I suppose that would complicate the constructors
a bit so I can understand why it'd be disallowed, and it should be rare
enough not to really bite anyone.
(Although tagged constructors to resolve that ambiguity wouldn't be an
issue if you could only create an errored outcome with a helper like