<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature">On Tue, Sep 5, 2017 at 7:09 PM, Davide Italiano <span dir="ltr"><<a href="mailto:dccitaliano@gmail.com" target="_blank">dccitaliano@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Tue, Sep 5, 2017 at 6:32 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Tue, Sep 5, 2017 at 5:26 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>
>><br>
>> Oh yea, I forgot about that issue.<br>
>><br>
>> I know it is possible to have a parameter pack not be the last argument,<br>
>> so maybe it would work?  e.g.<br>
>><br>
>> template<typename... Args><br>
>> StringSwitch &Cases(Args &&... args, T value)<br>
><br>
><br>
> I think that's possible but doesn't deduce the varargs (only works if the<br>
> template parameters ar explicitly specified) - I could be wrong, though.<br>
><br>
> The other way to do this is to SFINAE things (probably want to SFINAE all<br>
> the args to be Cases anyway).<br>
><br>
<br>
</span>Michael suggested the following, but it works only for C++14 (and beyond).<br>
<a href="https://godbolt.org/g/TLonbG" rel="noreferrer" target="_blank">https://godbolt.org/g/TLonbG</a><br>
<br>
I'll see if I can adapt to work with C++11.<br>
<br>
Thanks,<br>
<br>
--<br>
Davide<br>
</blockquote></div><br></div><div class="gmail_extra">And here's a non n^2 version with less recursion.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://godbolt.org/g/fT8RYu">https://godbolt.org/g/fT8RYu</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">- Michael Spencer<br></div></div>