On 11/07/2017 15:41, Peter Dimov via Boost wrote:
Andrzej Krzemienski wrote:
maybe result
indeed looks suspicious, but using result 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 distinct.
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. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/