On Mon, 30 Mar 2015 19:36:49 +0000, matovitch wrote:
>> The index is the problem. Generally, foreach doesn't do automatic
>> indices for ranges. You can use std.range.enumerate or count yourself
>> explicitly.
>>
>> foreach(i, t; myRange.enumerate) {...}
>>
>> size_t i = 0;
>> foreach(t; myRange) {... ++i;}
>
> Is it a compiler problem or a language restriction ?it is by design. `foreach` is not a "fancy for with hidden counter", it's more high-level construct. so if range isn't providing the counter, `foreach` will not guess why, and simply doesn't provide it too.
signature.asc
Description: PGP signature
