An s_iterator
is used to represent a general multidimensional strided iterator using a stl style iterator and stride lengths for each dimension.
More...
#include <array.hpp>
An s_iterator
is used to represent a general multidimensional strided iterator using a stl style iterator and stride lengths for each dimension.
The s_iterator
is not actually a separate class or type. It is represented by a lite::pack object. The first element of the pack (element 0) stores a pointer or another type of stl style iterator. The elements 1 to N store the stride values for the dimensions 1 to N respectively. The type of each of the stride elements is:
int
for non-constant size strideslite::constant<int, _stride>
for a constant size stride of lenght _stride
.All the required operations (i.e. at()
, inc()
, dec()
, shift()
) are also defined.
For example:
array<float[3][4][5]> a; // Below is the actual type of the iterator for array a pack<float*, constant<int, 20>, constant<int, 5>, constant<int, 1> > it_a; it_a = a.begin(); at(it_a, 1, 2, 3) = -1; // the previous line is equivalent to: a(1, 2, 3) = -1; array<float[1][1][5]> b(3, 4, 5); // Below is the actual type of the iterator for array b pack<float*, int, constant<int, 5>, constant<int, 1> > it_b = b.begin();