Am 03.02.2012, 03:19 Uhr, schrieb Jonathan M Davis <[email protected]>:
On Friday, February 03, 2012 03:08:05 Marco Leise wrote:
Am 02.02.2012, 18:53 Uhr, schrieb bearophile <[email protected]>:
> Ali:
>> I think foreach_reverse and the associated opApplyReverse member
>> function.
>
> I use it now and then. A possible replacement:
>
> foreach (i; 10 .. 0 : -1) {}
>
> Bye,
> bearophile
I agree. iterating in reverse over an array is common enough
retro makes it very easy.
- Jonathan M Davis
Ok, sometimes I have nested loops and I limit the inner loop by the
counter of the outer loop and then I cannot iterate over the array, but
just want a fast foreach_reverse(i; a .. b). Can retro reproduce that
without any function call overhead? If I think that reverse iteration will
be slower, then I'll not use it in the first place.