On Thursday, March 31, 2016 03:12:34 Sean Campbell via Digitalmars-d wrote: > Why doesn't reverse iteration of lockstep work? It does for zip. > Is this intended or is it a bug?
Glancing over the code quickly, it looks like lockstep doesn't actually generate a range but an object that defines opApply so that it can be used in a foreach loop but not in general range-based algorithms. IIRC, it used to be that opApply worked with foreach_reverse but did exactly the same thing as foreach, so it was made an error to use it with foreach_reverse rather than having the buggy behavior persist and confuse folks (you'd need some sort of opApplyReverse function to go with foreach_reverse, and no such thing exists). zip, on the other hand, generates an actual range, and if the ranges that it's given are bidirectional ranges, then it too will be a bidirectional range, and it'll work with foreach_reverse via the back and popBack functions. - Jonathan M Davis