A multi-dimensional iterator Stores the index in each dimension, as well as a global flattened index.
More...
#include <multi_iterator.h>
template<size_t max_dims>
class wxm::multi_iterator< max_dims >
A multi-dimensional iterator Stores the index in each dimension, as well as a global flattened index.
- Template Parameters
-
max_dims | maximum number of dimensions this multi-iterator supports |
|
template<class... Idcs, class = typename std::enable_if< meta::all<std::is_integral<Idcs>::value...>::value>::type> |
| multi_iterator (Idcs... lengths) |
| Construct a multi-iterator from a list of lengths.
|
|
template<class C > |
| multi_iterator (const C &cont) |
| Construct a multi-iterator from a container which contains the lengths.
|
|
const std::array< size_t, max_dims > & | indices () const |
| Gets the multi-dimensional indices.
|
|
size_t | index () const |
| Returns the flattened global index.
|
|
size_t | size () const |
| Total number of elements.
|
|
size_t | ndims () const |
| number of dimensions
|
|
const std::array< size_t, max_dims > & | shape () const |
| Gets the multi-dimensional indices.
|
|
multi_iterator & | operator++ () |
| Increment the multi iterator.
|
|
multi_iterator & | operator+= (size_t val) |
| Increment the multi iterator by val.
|
|
multi_iterator & | advance (size_t dim) |
| Increment the multi iterator in the given dimension.
|
|
multi_iterator & | advance (size_t dim, size_t val) |
| Increment the multi iterator by val in the given dimension.
|
|
◆ multi_iterator() [1/2]
template<size_t max_dims>
template<class... Idcs, class = typename std::enable_if< meta::all<std::is_integral<Idcs>::value...>::value>::type>
Construct a multi-iterator from a list of lengths.
- Parameters
-
lengths | integer sequence which denotes the shape of this multi-iterator |
◆ multi_iterator() [2/2]
template<size_t max_dims>
template<class C >
Construct a multi-iterator from a container which contains the lengths.
- Parameters
-
cont | some sort of ordered container which denote the shape of this multi-iterator. |
◆ advance() [1/2]
template<size_t max_dims>
Increment the multi iterator in the given dimension.
◆ advance() [2/2]
template<size_t max_dims>
Increment the multi iterator by val in the given dimension.
◆ index()
template<size_t max_dims>
Returns the flattened global index.
◆ indices()
template<size_t max_dims>
Gets the multi-dimensional indices.
Note that only the first ndims() entries have any meaning
◆ ndims()
template<size_t max_dims>
◆ operator++()
template<size_t max_dims>
Increment the multi iterator.
◆ operator+=()
template<size_t max_dims>
Increment the multi iterator by val.
◆ shape()
template<size_t max_dims>
Gets the multi-dimensional indices.
Note that only the first ndims() entries have any meaning
◆ size()
template<size_t max_dims>
Total number of elements.
The documentation for this class was generated from the following file: