template <class T> class RWGenMat<T>::iterator;
Class RWGenMat<T>::iterator is the random access iterator for the RWGenMat<T> collection class. The iterator class behaves like a pointer to type T, and is used to increment through elements of an RWGenMat<T>.
#include <rw/math/genmat.h> main() { RWGenMat<int> M(5,5,rwUninitialized); RWGenMat<int>::iterator i = M.begin(); RWGenMat<int>::iterator stop = M.end(); // Assign a unique int value to each element of M for (int j=0; i != stop; ++i, ++j) *i = j; }
RWGenMat<T>::iterator();
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
RWGenMat<T>::iterator(const iterator& i);
Constructs an iterator from another iterator. Initialized iterators can be obtained via the begin() and end() member functions of RWGenMat<T>.
RWGenMat<T>::iterator& operator++(); RWGenMat<T>::iterator& operator--(); RWGenMat<T>::iterator& operator++(int); RWGenMat<T>::iterator& operator--(int);
Prefix or postfix increment or decrement operator. The iterator points to the next or previous element in the RWGenMat<T>. No error condition is set if the iterator goes past the bounds of the matrix. Compare to RWGenMat<T>::begin() and RWGenMat<T>::end() to check that the iterator position is valid.
RWGenMat<T>::iterator& operator+=(RWGenMat<T>::difference_type d); RWGenMat<T>::iterator& operator-=(RWGenMat<T>::difference_type d);
The iterator is moved forward or backward d elements in the RWGenMat<T>. No error condition is set if the iterator goes past the bounds of the matrix. Incrementing by d and then decrementing by d returns the iterator to its original position, even if doing so takes it past the bounds of the matrix.
RWGenMat<T>::iterator&
operator=(const RWGenMat<T>::iterator& i) const;
Sets the iterator state to be the same state as i.
RWGenMat<T>::difference_type operator-(const RWGenMat<T>::iterator& i) const;
If the return value is positive, the iterator is that many elements past the iterator i. If the return value is negative, the iterator is that many elements before the iterator i.
RWGenMat<T>::iterator& operator+(RWGenMat<T>::difference_type d) const; RWGenMat<T>::iterator& operator-(RWGenMat<T>::difference_type d) const;
Returns an iterator that is d elements past or before self.
T& operator[]() const;
Returns a reference to the element n elements after self if n is positive, or n elements before n if n is negative.
T& operator*() const;
Returns a reference to the element pointed to by self.
RWBoolean operator==(const RWGenMat<T>::iterator& i) const; RWBoolean operator!=(const RWGenMat<T>::iterator& i) const; RWBoolean operator<(const RWGenMat<T>::iterator& i) const; RWBoolean operator>(const RWGenMat<T>::iterator& i) const; RWBoolean operator<=(const RWGenMat<T>::iterator& i) const; RWBoolean operator>=(const RWGenMat<T>::iterator& i) const;
Comparison operator. Determines the relative logical position between two iterators, not necessarily the actual relative position of the elements to which they point.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.