linbox
1
|
Subvector iterator class provides striding iterators.A Subiterator steps by a fixed stride thru the underlying container. Subiter<Iterator> requires that Iterator be a random access iterator class and then itself provides the full functionality of a random access iterator class. See STL documentation for that functionality. Documented here is only the constructor from (1) an iterator of an underlying container and (2) a stride amount. More...
#include <subiterator.h>
Public Member Functions | |
Subiterator (const Iterator &iter, const difference_type &stride=1) |
Subvector iterator class provides striding iterators.
A Subiterator steps by a fixed stride thru the underlying container. Subiter<Iterator> requires that Iterator be a random access iterator class and then itself provides the full functionality of a random access iterator class. See STL documentation for that functionality. Documented here is only the constructor from (1) an iterator of an underlying container and (2) a stride amount.
Subiterator | ( | const Iterator & | iter, |
const difference_type & | stride = 1 |
||
) | [inline] |
Subiterator p (pp, 3) provides an iterator which initially has the same reference, but for which increments and offsets step by the amount stride rather than 1. Thus p+k is equivalent to pp+(stride*k).
Striding iterators are easily positioned beyond the bounds of the underlying container. It is up to the user to dereference the iterator only when it has a valid reference.