On Thursday, May 17, 2012 13:23:22 Steven Schveighoffer wrote: > On Thu, 17 May 2012 11:42:04 -0400, Jonathan M Davis <jmdavisp...@gmx.com> > > wrote: > > On Thursday, May 17, 2012 11:05:46 Steven Schveighoffer wrote: > >> Hm... proposal: > >> > >> foreach(e; ref r) > >> { > >> } > >> > >> equates to your desired code. Would this help? > > > > Or you could just do > > > > for(; !r.empty; r.popFront()) > > { > > > > auto e = r.front; > > > > } > > > > I really don't think that that's a big deal. I don't think that the > > language > > change would be worth having yet another thing in the language to > > remember, > > particularly when it's so easy to just use for to do the job. > > Probably true. The only one I'd see as being impossible to duplicate is: > > foreach(ref e; ref r)
But that only works if front returns a ref. If it doesn't, the ref would be to a local variable (so I don't know if that even compiles). And if front returns a ref, all you have to do is use front instead of e. So, no it wouldn't be _identical_, but close enough. - Jonathan M Davis