[Issue 12109] foreach with class alias this range iteration inconsistency

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 8 10:43:45 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12109


Jakob Ovrum <jakobovrum at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakobovrum at gmail.com


--- Comment #1 from Jakob Ovrum <jakobovrum at gmail.com> 2014-02-08 10:43:44 PST ---
(In reply to comment #0)
> Sorry for the title, hard to explain in a few words:

This has nothing to do with AliasThis. All forward ranges behave this way with
foreach (i.e. foreach operates on a `save`'d copy).

When `save` is not necessary (such as in algorithms that have already called
`save`), a for-loop should be used, as seen in many places in Phobos.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list