Setting defaults to variadic template args

Manu turkeyman at gmail.com
Tue Oct 2 06:45:37 PDT 2012


On 2 October 2012 16:24, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:

> On 10/2/12, Manu <turkeyman at gmail.com> wrote:
> > Does anyone have any clever tricks that will work in this scenario? Some
> > magic tuple syntax?
>
> Without resorting to helper templates I only know of using this internal
> trick:
>
> struct Event(Args...)
> {
>     static if (Args.length)
>         alias Args T;
>     else
>         alias TypeTuple!(int, float) T;
>
>     void F(T t) { }
> }
>
> Also there's a somewhat related bug but for variadic template
> functions with default arguments:
> http://d.puremagic.com/issues/show_bug.cgi?id=8687
>

I think this is fine for my needs. Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121002/ba21cbe3/attachment.html>


More information about the Digitalmars-d mailing list