Iterating a typle tuple of templates

bearophile bearophileHUGS at lycos.com
Fri Mar 4 04:19:23 PST 2011


Jacob Carlborg:

> Maybe you can try something like typeof(t2) in the foreach.

If you mean code like this:

import std.typetuple;

int foo(T)(T x) {
     return x;
}

void main() {
     alias TypeTuple!(foo, foo) t2;
     foreach (i, t; typeof(t2)) {
         pragma(msg, t);
         assert(t2[i](i) == i); // OK
         //assert(t(i) == i); // Not OK
    }
}

It seems "t" is not useful...

Is all this Bugzilla-worthy?

Thank you, bye,
bearophile


More information about the Digitalmars-d-learn mailing list