← Back to index
|
Original Bugzilla link
Bug 16145 – enumerate can't work with ref foreach
Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-06-09T09:31:09Z
Last change time
2024-12-01T16:27:04Z
Assigned to
No Owner
Creator
John Colvin
Moved to GitHub: phobos#9685 →
Comments
Comment #0
by john.loughran.colvin — 2016-06-09T09:31:09Z
enumerate works by returning a tuple of index and element, so e.g. foreach(i, ref el; r.enumerate) el = 3; compiles fine but will not do anything to el.
Comment #1
by greeenify — 2016-12-27T14:10:43Z
This is due to `front` creating a new tuple on every call:
https://github.com/dlang/phobos/blob/master/std/range/package.d#L7740
Hence not even "refRanging" it works :/
Comment #2
by robert.schadek — 2024-12-01T16:27:04Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/phobos/issues/9685
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB