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.






Reply via email to