Recursive template

Eric via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 15 10:29:58 PST 2014


Hi -

I've never designed a recursive template before, but I think
that would solve my problem.  What I would like is
someting like this:

class X(V, K...)
{
     // I want to declare a type based on K and V such
     // that for X!(V, int, string, double) the resulting
     // declaration would be:
     SomeType!(int, SomeType!(string, SomeType!(double, V))) var;

     // or put another way:
     SomeType!(K[0], SomeType!(K[1], SomeType(K[2], V))) var;
}

Can anyone give me some ideas on how to set up the declaration?

Thanks,

Eric


More information about the Digitalmars-d-learn mailing list