Iterating a typle tuple of templates

Simen kjaeraas simen.kjaras at gmail.com
Fri Mar 4 08:43:56 PST 2011


bearophile <bearophileHUGS at lycos.com> wrote:

> 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?

Yes.

-- 
Simen


More information about the Digitalmars-d-learn mailing list