golib  0.5
goMath::VectorIterator< T > Class Template Reference

Vector iterator for multi-dimensional array data. More...

#include <gomatrix.h>

Public Member Functions

 VectorIterator (T *ptr, goSize_t len, goPtrdiff_t stride, goPtrdiff_t increment)
 Construct an iterator over data starting at ptr, of length len, using stride to get from one element to the next, and increment to get from one vector to the next. More...
 
 VectorIterator (const VectorIterator< T > &other)
 Copy constructor. More...
 
VectorIterator< T > & operator= (const VectorIterator< T > &other)
 Copy operator. More...
 
goSize_t len () const
 Length of a vector. More...
 
goPtrdiff_t increment () const
 Increment to add to a pointer to get to the next vector. More...
 
VectorIterator< T > & operator++ ()
 Increment the iterator (move to the next vector). More...
 
VectorIterator< T > & operator-- ()
 Decrement the iterator (move to the previous vector). More...
 
Vector< T > & operator* ()
 Dereference operator. More...
 
Vector< T > * operator-> ()
 Pointer operator. More...
 
const Vector< T > & operator* () const
 
const Vector< T > * operator-> () const
 
bool operator== (const VectorIterator< T > &other)
 Compares the actual pointers. More...
 
bool operator!= (const VectorIterator< T > &other)
 Compares the actual pointers. More...
 

Detailed Description

template<class T>
class goMath::VectorIterator< T >

Vector iterator for multi-dimensional array data.

This class is used as goMath::Matrix::vector_iterator. It can be used to iterate over a number of vectors stored e.g. in a matrix.

Parameters
TData type of the data.

Constructor & Destructor Documentation

◆ VectorIterator() [1/2]

template<class T >
goMath::VectorIterator< T >::VectorIterator ( T *  ptr,
goSize_t  len,
goPtrdiff_t  stride,
goPtrdiff_t  increment 
)
inline

Construct an iterator over data starting at ptr, of length len, using stride to get from one element to the next, and increment to get from one vector to the next.

Parameters
ptrStart pointer.
lenLength of a vector.
strideStride within the vector (number of elements to add to the pointer in order to get to the next element).
incrementIncrement to get from one vector to the next, in elements.

◆ VectorIterator() [2/2]

template<class T >
goMath::VectorIterator< T >::VectorIterator ( const VectorIterator< T > &  other)
inline

Copy constructor.

Parameters
otherIterator to be copied.

Member Function Documentation

◆ increment()

template<class T >
goPtrdiff_t goMath::VectorIterator< T >::increment ( ) const
inline

Increment to add to a pointer to get to the next vector.

Returns
Increment to add to a pointer to get to the next vector, in elements.

◆ len()

template<class T >
goSize_t goMath::VectorIterator< T >::len ( ) const
inline

Length of a vector.

Returns
Length of a vector.

◆ operator!=()

template<class T >
bool goMath::VectorIterator< T >::operator!= ( const VectorIterator< T > &  other)
inline

Compares the actual pointers.

Parameters
otherIterator to compare with.
Returns
True if the pointers are unequal, false otherwise.

◆ operator*()

template<class T >
Vector<T>& goMath::VectorIterator< T >::operator* ( )
inline

Dereference operator.

Returns
The current vector.

◆ operator++()

template<class T >
VectorIterator<T>& goMath::VectorIterator< T >::operator++ ( )
inline

Increment the iterator (move to the next vector).

Returns
this.

◆ operator--()

template<class T >
VectorIterator<T>& goMath::VectorIterator< T >::operator-- ( )
inline

Decrement the iterator (move to the previous vector).

Returns
this.

◆ operator->()

template<class T >
Vector<T>* goMath::VectorIterator< T >::operator-> ( )
inline

Pointer operator.

Returns
Pointer to the current vector.

◆ operator=()

template<class T >
VectorIterator<T>& goMath::VectorIterator< T >::operator= ( const VectorIterator< T > &  other)
inline

Copy operator.

Parameters
otherIterator to be copied.
Returns
this.

◆ operator==()

template<class T >
bool goMath::VectorIterator< T >::operator== ( const VectorIterator< T > &  other)
inline

Compares the actual pointers.

Parameters
otherIterator to compare with.
Returns
True if the pointers are equal, false otherwise.

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