Public Types | Public Member Functions | Protected Member Functions

ElementIterator< T > Class Template Reference

An iterator which allows to access each component element type of an array of vectors, or a vector of arrays. More...

#include <Iterator.hpp>

List of all members.

Public Types

Public Member Functions

Protected Member Functions


Detailed Description

template<class T>
class ElementIterator< T >

An iterator which allows to access each component element type of an array of vectors, or a vector of arrays.

The provided indexing scheme is two-dimensional, for the array index first and then the component.

The iterator works both for arrays of vectors as well as for vectors of arrays. However, manual setup of the right parameters is tedious. The derived Iterator classes provide a more convenient interface to do so.

Note:
No range check is performed here! The caller must ensure that the numerical values of the array and component index are valid.

Member Function Documentation

template<class T>
T& ElementIterator< T >::operator() ( index_t  i,
int  c 
) const [inline]

Element access (no range check!).

Each element of the data array is accessed according to

                data[ (shift + i)*stride + c*offset]

This indexing scheme works both for arrays of vectors and vectors of arrays.

Parameters:
i the array index
c the component index