Why is for() less efficient than foreach?

Bastiaan Veelo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 10 05:33:55 PST 2017


On Friday, 10 February 2017 at 12:58:19 UTC, Stefan Koch wrote:
> If you want it to modify the array you have to use a ref elem.
> If you do you will see that foreach is a little slower.

Thanks, I should have spotted that.

Bastiaan.


More information about the Digitalmars-d-learn mailing list