Why is there no range iteration with index by the language?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jun 10 00:03:55 UTC 2020


On Tue, Jun 09, 2020 at 11:53:16PM +0000, Q. Schroll via Digitalmars-d-learn wrote:
> Is there any particular reason why std.range : enumerate is a thing
> and
> 
>     foreach (i, e; range) { ... }
> 
> doesn't work from the get-go?
[...]

std.range.indexed is your friend. ;-)


T

-- 
Let's eat some disquits while we format the biskettes.


More information about the Digitalmars-d-learn mailing list