[Issue 4347] foreach over range should save range.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Dec 22 07:05:01 PST 2016
https://issues.dlang.org/show_bug.cgi?id=4347
--- Comment #5 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Mathias Lang from comment #4)
> @Andrei: Actually, there is already a difference in behavior. When iterating
> over a range which is a reference (e.g. class), the range will be advanced
> by foreach.
> However, for value types (structs), the struct is copied, resulting in an
> implict `.save` most of the time.
> See https://issues.dlang.org/show_bug.cgi?id=15413 for example.
I understand that. Still think we should not change behavior.
--
More information about the Digitalmars-d-bugs
mailing list