Iterating a typle tuple of templates

Jacob Carlborg doob at me.com
Fri Mar 4 06:35:39 PST 2011


On 2011-03-04 13:19, bearophile 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...

Yeah, that's really annoying.

> Is all this Bugzilla-worthy?
>
> Thank you, bye,
> bearophile



-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list