template <class T> class RWMathVec<T>::const_iterator;
Class RWMathVec<T>::const_iterator is the random access iterator for the RWMathVec<T> collection class. The const_iterator class behaves like a pointer to type T and is used to increment through elements of an RWMathVec<T>. The const_iterator differs from a plain iterator in that the value in a dereferenced const_iterator may not be changed.
#include <rw/math/mathvec.h> main() { RWMathVec<int> V(5,1); // Create a length 5 vector of 1's RWMathVec<int>::const_iterator i = V.begin(); RWMathVec<int>::const_iterator stop = V.end();
// Print each element of V while(i != stop) { cout << *i << endl; ++i; } }
RWMathVec<T>::const_iterator();
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
RWMathVec<T>::const_iterator(const RWMathVec<T>::const_iterator& i); RWMathVec<T>::const_iterator(const RWMathVec<T>::iterator& i);
Constructs a const_iterator from another iterator or const_iterator. Initialized iterators and const_iterators can be obtained via the begin() and end() member functions of RWMathVec<T>.
RWMathVec<T>::const_iterator& operator++(); RWMathVec<T>::const_iterator& operator--(); RWMathVec<T>::const_iterator& operator++(int); RWMathVec<T>::const_iterator& operator--(int);
Prefix or postfix increment or decrement operator. The const_iterator points to the next or previous element in the RWMathVec<T>. No error condition is set if the const_iterator goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the const_iterator position is valid.
RWMathVec<T>::const_iterator& operator+=(RWMathVec<T>::difference_type d); RWMathVec<T>::const_iterator& operator-=(RWMathVec<T>::difference_type d);
Moves the const_iterator forward or backward d elements in the RWMathVec<T>. No error condition is set if the const_iterator goes past the bounds of the vector. Incrementing by d and then decrementing by d returns the const_iterator to its original position, even if doing so takes it past the bounds of the vector.
RWMathVec<T>::const_iterator& operator=(const RWMathVec<T>::const_iterator& i);
Sets the const_iterator state to be the same state as i.
RWMathVec<T>::difference_type operator-(const RWMathVec<T>::const_iterator& i) const;
If the return value is positive, sets the const_iterator that many elements past the const_iterator i. If the return value is negative, sets the const_iterator that many elements before the const_iterator i.
RWMathVec<T>::const_iterator& operator+(RWMathVec<T>::difference_type d) const; RWMathVec<T>::const_iterator& operator-(RWMathVec<T>::difference_type d) const;
Returns a const_iterator that is d elements past (or before) self.
const T& operator[]() const;
Returns a reference to the element n elements after self if n is positive, or n elements before self if n is negative.
const T& operator*() const;
Returns a reference to the element pointed to by self.
RWBoolean operator==(const RWMathVec<T>::const_iterator& i) const; RWBoolean operator!=(const RWMathVec<T>::const_iterator& i) const; RWBoolean operator<(const RWMathVec<T>::const_iterator& i) const; RWBoolean operator>(const RWMathVec<T>::const_iterator& i) const; RWBoolean operator<=(const RWMathVec<T>::const_iterator& i) const; RWBoolean operator>=(const RWMathVec<T>::const_iterator& i) const;
Comparison operator. Determines the relative logical position between two const_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.