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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 18:32:57 PDT 2017


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).


>
> On Tue, Sep 5, 2017 at 5:19 PM Rui Ueyama via Phabricator <
> reviews at reviews.llvm.org> wrote:
>
>> ruiu added a comment.
>>
>> IIRC, it is tricky to use a template because all but the last parameter
>> are of the same in `Cases`. If it takes `Value` as the first parameter, it
>> would have been easier to use a template. But I'm not a C++ expert, so
>> there may be a straightforward way of doing it.
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D24882
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170906/f4979b3a/attachment.html>


More information about the llvm-commits mailing list