rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMathVecConstIterator< T > Class Template Reference
[Math Collections]

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

#include <rw/math/mathvec.h>

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

List of all members.

Public Member Functions

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

Detailed Description

template<class T>
class RWMathVecConstIterator< T >

Class RWMathVecConstIterator<T> is the const random access iterator for the RWMathVec<T> collection class. The RWMathVecConstIterator<T> class behaves like a pointer to type T and is used to increment through elements of an RWMathVec<T> . The RWMathVecConstIterator<T> differs from RWMathVecIterator<T> in that the value in a dereferenced RWMathVecConstIterator<T> may not be changed.

Note:
This class should be used through RWMathVec<T>::const_iterator.

Examples

 #include <rw/math/mathvec.h>
 
 int 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;
     }
 }

Constructor & Destructor Documentation

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

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

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

Constructs a RWMathVecConstIterator<T> from another RWMathVecIterator<T> . Initialized RWMathVecIterator<T> can be obtained via the RWMathVec<T>::begin() and RWMathVec<T>::end().


Member Function Documentation

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

Returns a reference to the element pointed to by self.

template<class T >
RWMathVecConstIterator<T> RWMathVecConstIterator< T >::operator+ ( difference_type  d  )  const [inline]

Returns a RWMathVecConstIterator<T> that is d elements past self.

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

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

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

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

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

Moves the RWMathVecConstIterator<T> forward or backward d elements in the RWMathVec<T> . No error condition is set if the RWMathVecConstIterator<T> goes past the bounds of the vector. Incrementing by d and then decrementing by d returns the RWMathVecConstIterator<T> to its original position, even if doing so takes it past the bounds of the vector.

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

Returns a RWMathVecConstIterator<T> that is d elements before self.

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

If the return value is positive, sets the RWMathVecConstIterator<T> that many elements past the RWMathVecConstIterator<T> i. If the return value is negative, sets the RWMathVecConstIterator<T> that many elements before the RWMathVecConstIterator<T> i.

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

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

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

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

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

Moves the RWMathVecConstIterator<T> forward or backward d elements in the RWMathVec<T> . No error condition is set if the RWMathVecConstIterator<T> goes past the bounds of the vector. Incrementing by d and then decrementing by d returns the RWMathVecConstIterator<T> to its original position, even if doing so takes it past the bounds of the vector.

template<class T >
const_pointer RWMathVecConstIterator< T >::operator-> (  )  const [inline]

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

template<class T >
const value_type& RWMathVecConstIterator< 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.