foreach() behavior on ranges
frame
frame86 at live.com
Tue Aug 24 10:00:38 UTC 2021
On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote:
>
> A range should be a struct always and thus its state is copied
> when the foreach loop is created.
This is not conform with the aggregate expression mentioned in
the manual where a class object would be also allowed.
> Which means the state resets every time the loop is initiated.
Yes, it should reset - thus foreach() also needs to handle that
correctly.
More information about the Digitalmars-d-learn
mailing list