How about a "static foreach"?

Mehrdad wfunction at hotmail.com
Sat Jun 16 18:17:57 PDT 2012


On Sunday, 17 June 2012 at 01:09:12 UTC, Andrej Mitrovic wrote:
> 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.

lol sorry, bad example. They aren't always so easy to fix. :-)


More information about the Digitalmars-d mailing list