Setting defaults to variadic template args

Jacob Carlborg doob at me.com
Tue Oct 2 06:19:29 PDT 2012


On 2012-10-02 15:15, Manu wrote:
> Is it possible?
>
> Eg:
>    struct Event(T... = (int, float))
>    {
>      void F(T...); // <- should default to F(int, float)
>    }
>
> Does anyone have any clever tricks that will work in this scenario? Some
> magic tuple syntax?

struct Event
{
     static if (T.length == 0)
         void F(int, float);

     else
         void F(T);
}

Perhaps?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list