|
Boost : |
Subject: Re: [boost] Outcome v2 is feature complete
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-07-11 15:06:07
>> And finally, std::variant doesn't implement multiple argument
>> converting constructors. And I figured WG21 know what they're doing.
>
> Some design features translate between similar but different classes,
> and some do not. variant<T...> has no idea what the alternatives are or
> what they represent, which is reflected in the way it treats them. So
> you use in_place_index<3> for the fourth alternative, for example.
I don't understand. variant<...> knows exactly what the alternatives
are. It surely would be straightforward to look at some Arg&&...
sequence and do std::is_constructible<X, Arg&&...> matching against all
possible variant states. The fact they don't do it I surely think is a
deliberate and intentional design choice for some hopefully good reason.
> In our case, there are only two alternatives and they have known
> semantics.
Actually, they don't have known semantics. We don't know anything about
them. The concept pattern matching machinery *may* give them known
semantics, but result/outcome don't know anything about that at the
constructor level.
>> Also variadic templates are slow :(
>
> If that's the problem, you could use
>
> template<class A1, class A2, class... A>
> result( A1&& a1, A2&& a2, A&&... a );
>
> which would be rejected immediately in the one-arg case and hence
> shouldn't affect its compile times. I SFINAE on sizeof...(A) >= 2
> instead, but I might switch.
Oh good idea. Logged to https://github.com/ned14/outcome/issues/56
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk