C++ Logo

SG10

Advanced search

Subject: Re: [SG10] __cpp_variadic_using for p0195r2?
From: John Spicer (jhs_at_[hidden])
Date: 2016-12-20 05:51:55


> On Dec 20, 2016, at 2:30 AM, Richard Smith <richard_at_[hidden]> wrote:
>
> On 19 December 2016 at 14:48, John Spicer <jhs_at_[hidden] <mailto:jhs_at_[hidden]>> wrote:
>
>> On Dec 19, 2016, at 5:27 PM, Richard Smith <richard_at_[hidden] <mailto:richard_at_[hidden]>> wrote:
>>
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0195r2.html <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0195r2.html> suggests a feature test macro of __cpp_variadic_using; the value would presumably be 201611. Does that seem OK to everyone?
>>
>
> I think it is okay.
>
> I think it is slightly odd as the change is to allow multiple names in a using-declaration, but the expected use case is for variadics.
>
> I’d also be okay with something like __cpp_multi_using.
>
> __cpp_variadic_using had more support when it was discussed in core, FWIW.
>
> I don't see any reason you'd want to feature test for the multiple-names-in-one-using-declaration part of the feature -- just don't use them if you want to be compatible with old language modes. But the variadic part does seem like something people would want to feature-test for. I can imagine someone wanting to write:
>
> #if __cpp_variadic_using >= 201611
> template<typename ...T> struct Callable : T... {
> using T::operator() ...;
> };
> #else
> template<typename ...T> struct Callable;
> template<typename T, typename ...U> struct Callable<T, U...> : T, Callable<U...> {
> using T::operator();
> using Callable<U...>::operator();
> };
> template<typename T> struct Callable<T> : T {
> using T::operator();
> };
> template<> struct Callable<> {};
> #endif

I agree with that, and that is probably why core leaned in the direction of the name they did.

I just think of the feature as allowing multiple names in a using, the most useful case for which is variadics.

I’m fine with the variadic name.

John.



SG10 list run by herb.sutter at gmail.com