Module: Essential Math Group: Math Collection classes
Does not inherit
template <class T> class RWMathVec<T>::iterator;
Class RWMathVec<T>::iterator is the random access iterator for the RWMathVec<T> collection class. The iterator class behaves like a pointer to type T and is used to increment through elements of an RWMathVec<T>.
#include <rw/math/mathvec.h> int main() { RWMathVec<int> V(5,rwUninitialized); RWMathVec<int>::iterator i = V.begin(); RWMathVec<int>::iterator stop = V.end(); // Assign a unique int value to each element of V for (int j=0; i != stop; ++i, ++j) *i = j; }
RWMathVec<T>::iterator();
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
RWMathVec<T>::iterator(const iterator& i);
Constructs an iterator from another iterator. Initialized iterators can be obtained via the begin() and end() member functions of RWMathVec<T>.
RWMathVec<T>::iterator& operator++(); RWMathVec<T>::iterator& operator--(); RWMathVec<T>::iterator& operator++(int); RWMathVec<T>::iterator& operator--(int);
Prefix or postfix increment or decrement operator. The iterator points to the next or previous element in the RWMathVec<T>. No error condition is set if the iterator goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the iterator position is valid.
RWMathVec<T>::iterator& operator+=(RWMathVec<T>::difference_type d); RWMathVec<T>::iterator& operator-=(RWMathVec<T>::difference_type d);
Moves the iterator forward or backward d elements in the RWMathVec<T>. No error condition is set if the iterator goes past the bounds of the vector. 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 vector.
RWMathVec<T>::iterator& operator=(const RWMathVec<T>::iterator& i) const;
Sets the iterator state to be the same state as i.
RWMathVec<T>::difference_type operator-(const RWMathVec<T>::iterator& i) const;
If the return value is positive, moves the iterator that many elements past the iterator i. If the return value is negative, moves the iterator that many elements before the iterator i.
RWMathVec<T>::iterator
operator+(RWMathVec<T>::difference_type d) const;
RWMathVec<T>::iterator
operator-(RWMathVec<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 self if n is negative.
T& operator*() const;
Returns a reference to the element pointed to by self.
T* operator->() const;
For iterator a, and identifier m, a->m is equivalent to (*a).m.
bool operator==(const RWMathVec<T>::iterator& i) const; bool operator!=(const RWMathVec<T>::iterator& i) const; bool operator<(const RWMathVec<T>::iterator& i) const; bool operator>(const RWMathVec<T>::iterator& i) const; bool operator<=(const RWMathVec<T>::iterator& i) const; bool operator>=(const RWMathVec<T>::iterator& i) const;
Comparison operator. Determines the relative logical position between two iterators, not necessarily the relative memory location of the elements to which they point.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.