orxfun / orx-split-vec

An efficient constant access time vector with dynamic capacity and pinned elements.
https://crates.io/crates/orx-split-vec
MIT License
2 stars 2 forks source link

iter_over_range #60

Closed orxfun closed 4 weeks ago

orxfun commented 4 weeks ago

iter_over_range method is provided.

At one hand, vec.iter_over_range(a..b) is equivalent to vec.iter().skip(a).take(b - a). However, the latter requires a unnecessary next calls. Since all pinned vectors provide random access to elements, the objective of iter_over_range is to directly jump to a and create an iterator from this point on, and hence, avoiding the unnecessary iterations at the beginning.