Feature request: Templates as template parameters

Simen Kjaeraas simen.kjaras at gmail.com
Sun Mar 23 13:31:05 PDT 2008


struct foo(T = void)
{
     static if (!is(T == void))
     {
         mixin T;
     }
}

I have a struct basically looking like this, and instantiated with T being  
a
template to be mixin'd in the struct (other methods are added via CTFE'd  
string
mixins and a few are inline).

As you an see, the line 'static if (!is(T == void))' is hardly safe, and  
should
be exchanged for 'static if (is(T == template))' or the parameter list with
something like 'foo(T : template)'. Could we get something like this?

--Simen


More information about the Digitalmars-d-learn mailing list