foreach_reverse and lockstep.

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 31 01:30:50 PDT 2016


On Thursday, 31 March 2016 at 03:12:34 UTC, Sean Campbell wrote:
> Why doesn't reverse iteration of lockstep work? It does for 
> zip. Is this intended or is it a bug?

Lockstep is actually not a range. It overloads the opApply[1] 
operator to support foreach. To support foreach_reverse, it would 
also have to override opApplyReverse. I'd say that it's not a bug 
but still a valid enhancement request. BTW the upcomming release 
has better documentation on the differences between lockstep [2] 
and zip [3].

[1]: 
https://github.com/D-Programming-Language/phobos/blob/master/std/range/package.d#L4153

[2]: http://dlang.org/phobos-prerelease/std_range#lockstep

[3]: http://dlang.org/phobos-prerelease/std_range#zip


More information about the Digitalmars-d mailing list