rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMathVecIterator< T > Class Template Reference
[Math Collections]

The random access iterator for the RWMathVec<T> collection class. More...

#include <rw/math/mathvec.h>

Inheritance diagram for RWMathVecIterator< T >:
RWMathVecIteratorBase< T >

List of all members.

Public Member Functions

 RWMathVecIterator ()
 RWMathVecIterator (const RWMathVecIterator< T > &x)
RWMathVecIterator< T > & operator++ ()
RWMathVecIterator< T > & operator-- ()
RWMathVecIterator< T > operator++ (int)
RWMathVecIterator< T > operator-- (int)
difference_type operator- (const RWMathVecIteratorBase< T > &i) const
RWMathVecIterator< T > & operator+= (difference_type d)
RWMathVecIterator< T > operator- (difference_type d) const
value_type & operator[] (difference_type n) const
value_type & operator* () const
pointer operator-> () const

Detailed Description

template<class T>
class RWMathVecIterator< T >

Class RWMathVecIterator<T> is the random access iterator for the RWMathVec<T> collection class. The RWMathVecIterator<T> class behaves like a pointer to type T and is used to increment through elements of an RWMathVec<T>.

Note:
This class should be accessed through RWMathVec<T>::iterator.

Examples

 #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;
 }

Constructor & Destructor Documentation

template<class T >
RWMathVecIterator< T >::RWMathVecIterator (  )  [inline]

Constructs an RWMathVecIterator<T> that is in an uninitialized state. The iterator must be initialized before it is dereferenced.

template<class T >
RWMathVecIterator< T >::RWMathVecIterator ( const RWMathVecIterator< T > &  x  )  [inline]

Constructs an RWMathVecIterator<T> from another RWMathVecIterator<T>. Initialized iterators can be obtained via the RWMathVec<T>::begin() and RWMathVec<T>::end() member functions.


Member Function Documentation

template<class T >
value_type& RWMathVecIterator< T >::operator* (  )  const [inline]

Returns a reference to the element pointed to by self.

template<class T >
RWMathVecIterator<T> RWMathVecIterator< T >::operator++ ( int   )  [inline]

Prefix or postfix increment or decrement operator. The RWMathVecIterator<T> points to the next or previous element in the RWMathVec<T> . No error condition is set if the RWMathVecIterator<T> goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the iterator position is valid.

template<class T >
RWMathVecIterator<T>& RWMathVecIterator< T >::operator++ (  )  [inline]

Prefix or postfix increment or decrement operator. The RWMathVecIterator<T> points to the next or previous element in the RWMathVec<T> . No error condition is set if the RWMathVecIterator<T> goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the iterator position is valid.

template<class T >
RWMathVecIterator<T>& RWMathVecIterator< T >::operator+= ( difference_type  d  )  [inline]

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.

template<class T >
RWMathVecIterator<T> RWMathVecIterator< T >::operator- ( difference_type  d  )  const [inline]

Returns an iterator that is d elements past (or before) self.

template<class T >
difference_type RWMathVecIterator< T >::operator- ( const RWMathVecIteratorBase< T > &  i  )  const [inline]

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.

template<class T >
RWMathVecIterator<T> RWMathVecIterator< T >::operator-- ( int   )  [inline]

Prefix or postfix increment or decrement operator. The RWMathVecIterator<T> points to the next or previous element in the RWMathVec<T> . No error condition is set if the RWMathVecIterator<T> goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the iterator position is valid.

template<class T >
RWMathVecIterator<T>& RWMathVecIterator< T >::operator-- (  )  [inline]

Prefix or postfix increment or decrement operator. The RWMathVecIterator<T> points to the next or previous element in the RWMathVec<T> . No error condition is set if the RWMathVecIterator<T> goes past the bounds of the vector. Compare to RWMathVec<T>::begin() and RWMathVec<T>::end() to check that the iterator position is valid.

template<class T >
pointer RWMathVecIterator< T >::operator-> (  )  const [inline]

For iterator a, and identifier m, a->m is equivalent to (*a).m.

template<class T >
value_type& RWMathVecIterator< T >::operator[] ( difference_type  n  )  const [inline]

Returns a reference to the element n elements after self if n is positive, or n elements before self if n is negative.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.