Multiple template alias parameters

Biotronic via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 8 15:29:27 PDT 2015


On Friday, 8 May 2015 at 21:56:56 UTC, Brian Schott wrote:
> Allowing "template Tem(alias Args ...)" syntax would let me 
> trace multiple variables at once.

Actually, this already works:

void traceVars(alias T, U...)() {
     import std.stdio : writeln;
     writeln(T.stringof, ": ", T);
     static if (U.length > 0) {
         traceVars!(U);
     }
}

void main(string[] args) {
     auto argslength = args.length;
     auto args0 = args[0];

     traceVars!(args, argslength, args0);
}

Sadly, the ... syntax precludes the use of __LINE__ and __FILE__. 
:(


More information about the Digitalmars-d-learn mailing list