About foreach loops

so so at so.so
Wed Jun 15 08:00:54 PDT 2011


> I think this is a bug.  Either i should be const during loop iteration,  
> or an additional temporary should be manufactured.
>
> It is always possible to get the above behavior using a for loop.   
> foreach should be sane.

I agree, you'd expect it to be passed by value. As mentioned reference  
must be stated explicitly.

foreach(ref i...)


More information about the Digitalmars-d mailing list