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