[Issue 4347] foreach over range should save range.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Dec 22 06:56:45 PST 2016


https://issues.dlang.org/show_bug.cgi?id=4347

Mathias Lang <mathias.lang at sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathias.lang at sociomantic.co
                   |                            |m

--- Comment #4 from Mathias Lang <mathias.lang at sociomantic.com> ---
@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.

--


More information about the Digitalmars-d-bugs mailing list