Ref local variables?

Nick Sabalausky a at a.a
Wed Jan 11 14:49:35 PST 2012


"Ben Davis" <entheh at cantab.net> wrote in message 
news:jejkdm$16un$1 at digitalmars.com...
>
> Note that this is already supported (apologies if I've got the syntax 
> slightly wrong):
>
> foreach (i, ref tile; map) { ... }
>
> That's a local variable too. It could have instead been defined such that 
> "tile" is an alias for "map[i]", but that would be a little strange.
>

That's a very good point.

Technically, foreach is implemented such that its body is a function and the 
"i, ref tile" is the parameter list. But I think that's beside the point.




More information about the Digitalmars-d mailing list