[SG10] __cpp_variadic_using for p0195r2?
John Spicer
jhs at edg.com
Tue Dec 20 12:51:55 CET 2016
> On Dec 20, 2016, at 2:30 AM, Richard Smith <richard at metafoo.co.uk> wrote:
>
> On 19 December 2016 at 14:48, John Spicer <jhs at edg.com <mailto:jhs at edg.com>> wrote:
>
>> On Dec 19, 2016, at 5:27 PM, Richard Smith <richard at metafoo.co.uk <mailto:richard at metafoo.co.uk>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/features/attachments/20161220/7764119f/attachment.html
More information about the Features
mailing list