Implement a fast(er) skip for RandomAccessIterator


Currently, the RandomAccessIterator provides method to borrow an element at a random Index. But if one want to restart an iterator at a random index, one must use skip(), which is basically O(n), even if the underlying type provides random access.

Either an “seek()” method for mutable RAM iterator, either a iter_at() for Clonable or iter_at_by_ref() could be useful.


I believe the longterm plan is to wait for better specialization support so that skip can be implemented effeciently on all RandomAccessIterators uniformly.


I almost hope RAI isn’t marked stable. It seems like an interface that never materialized – we need to find a better way to do this.

closed #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.