Unexpected behaviour of foreach statement

Arredondo arm.plus at gmail.com
Fri Mar 2 10:49:11 UTC 2018


On Friday, 2 March 2018 at 10:34:31 UTC, bauss wrote:
> You can also call "array" from "std.array".
>
>     auto range = iota(5).array;
>
>     foreach (i, el; range) {
>         writeln(i, ": ", el);
>     }

Thank you. That's how I had it in my original code, I was just 
trying to avoid gratuitous memory allocation.

Arredondo


More information about the Digitalmars-d-learn mailing list