[Issue 4707] auto ref for foreach loops

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 21 20:49:06 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4707



--- Comment #2 from David Simcha <dsimcha at yahoo.com> 2010-08-21 20:49:02 PDT ---
Because if the range didn't support ref iteration, the foreach loop would work
with non-ref iteration rather than producing a compile time error.(In reply to
comment #1)
> How would this be different from the following (which works)?
> 
> void main() {
>     foreach(ref x; [1, 2]) {}
> }

If the range didn't support ref iteration, the foreach loop would work with
non-ref iteration rather than producing a compile time error.

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


More information about the Digitalmars-d-bugs mailing list