libidx
ebl::idxiter< T > Class Template Reference

#include <idxiter.h>

List of all members.

Public Member Functions

 idxiter ()
 empty constructor;
T * init (const idx< T > &m)
bool notdone ()
 Return true while the loop is not completed.
T * next ()
 Increments idxiter to next element.
T & operator* ()
 dereferencing operator: returns data item.

Protected Attributes

T * data
 pointer to current item
intg i
 number of elements visited so far (loop index)
intg n
 total number of elements in idx
int j
 dimension being looped over
intg d [MAXDIMS]
 loop index array for non-contiguous idx
const idx< T > * iterand
 pointer to idx being looped over.

Detailed Description

template<class T>
class ebl::idxiter< T >

idxiter allows to iterate over all elements of an idx. Although it can be used directly, it is easier to use it with the idx_aloopX macros. Example: idxiter<double> idx; for ( idx.init(m); idx.notdone(); idx.next() ) { printf("%g ",*idx); } Here is an example that uses the aloop macro to fill up an idx with numbers corresponding to the loop index: idxiter<double> idx; idx_aloop_on(idx,m) { *idx = idx.i; } At any point during the loop, the indices of the element being worked on is stored in idx.d[k] for k=0 to idx.order()-1.


Member Function Documentation

template<class T >
T * ebl::idxiter< T >::init ( const idx< T > &  m)

Initialize an idxiter to the start of the idx passed as argument.


The documentation for this class was generated from the following files: