Niall Douglas wrote:
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. In our case, there are only two alternatives and they have known semantics. This both allows us to use named tags instead of generic type/index based ones, and it also makes it possible for a human to perform overload resolution in his mind (due to there being only two options) when faced with { x, y, z }.
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.