Top 5

bearophile bearophileHUGS at lycos.com
Thu Oct 9 10:27:50 PDT 2008


Matti Niemenmaa:
> Alternatively, since foreach got the ability to take a delegate, arrays should
> have the built-in property .reversed and then you could do foreach (a; b.reversed).

Is that a lazy operation? Another possibility is to add a (lazy) "view" (a struct plus function template), that reverses:

foreach (a; reversed(b))
Of course you can also write that as:
foreach (a; b.reversed())

That's a solution I use in my code.

Bye,
bearophile



More information about the Digitalmars-d mailing list