[PATCH] D24882: Add StringSwitch::Cases functions that takes 6, 7 or 8 arguments.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 19:09:17 PDT 2017


On Tue, Sep 5, 2017 at 6:32 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Tue, Sep 5, 2017 at 5:26 PM Zachary Turner <zturner at google.com> wrote:
>>
>> Oh yea, I forgot about that issue.
>>
>> I know it is possible to have a parameter pack not be the last argument,
>> so maybe it would work?  e.g.
>>
>> template<typename... Args>
>> StringSwitch &Cases(Args &&... args, T value)
>
>
> I think that's possible but doesn't deduce the varargs (only works if the
> template parameters ar explicitly specified) - I could be wrong, though.
>
> The other way to do this is to SFINAE things (probably want to SFINAE all
> the args to be Cases anyway).
>

Michael suggested the following, but it works only for C++14 (and beyond).
https://godbolt.org/g/TLonbG

I'll see if I can adapt to work with C++11.

Thanks,

--
Davide


More information about the llvm-commits mailing list