How about a "static foreach"?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Jun 16 18:09:01 PDT 2012


On 6/17/12, Mehrdad <wfunction at hotmail.com> wrote:
> This doesn't work:
>
> 	foreach (i; 0 .. T.tupleof.length)
> 		static if (is(typeof(T.tupleof[i]) == int))  // error!

foreach (i, type; T.tupleof)
    static if (is(typeof(T.tupleof[i]) == int))

But I agree, we should have a way to force a static foreach loop.


More information about the Digitalmars-d mailing list