Boost logo

Boost :

Subject: Re: [boost] Outcome v2 is feature complete
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-07-11 14:59:17

On 11/07/2017 15:41, Peter Dimov via Boost wrote:
> Andrzej Krzemienski wrote:
>> maybe result<int, int> indeed looks suspicious, but using
>> result<error_code, error_code> might come as quite natural:

An excellent example of what we want to strongly discourage.

I really strongly believe that for result and outcome, you must avoid
choosing types for success and failure which are not very obviously

> Re the multi-arg constructor, one obvious use case is this:
> return { errno, std::generic_category() };
> or
> return { GetLastError(), std::system_category() };
> although the main purpose is to forward arguments to custom ECs.
> I'm working on a prototype that showcases these but it's not ready yet.

That you showed above was my biggest motivator in favour of multi-arg
converting constructors.

But countering it, the syntax is unfortunately similar to aggregate
initialisation which is probably why std::variant doesn't allow it. I'd
be interested if someone from WG21 could tell us actually.

And besides, just prefixing the braces with 'std::error_code' means your
code compiles as intended on Outcome v2. I'm all for eliminating
boilerplate, but it does depend at what cost.


ned Productions Limited Consulting

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