rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMathArrayIterator< T > Class Template Reference
[Math Collections]

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

#include <rw/math/mtharray.h>

Inheritance diagram for RWMathArrayIterator< T >:
RWMathArrayIteratorBase< T >

List of all members.

Public Types

typedef RWMathArray< T >
::difference_type 
difference_type
typedef RWMathArray< T >
::value_type 
value_type
typedef RWMathArray< T >
::const_pointer 
const_pointer

Public Member Functions

 RWMathArrayIterator ()
 RWMathArrayIterator (const RWMathArrayIterator< T > &x)
RWMathArrayIterator< T > & operator++ ()
RWMathArrayIterator< T > & operator-- ()
RWMathArrayIterator< T > operator++ (int)
RWMathArrayIterator< T > operator-- (int)
RWMathArrayIterator< T > & operator= (const RWMathArrayIterator< T > &x)
RWMathArrayIterator< T > & operator+= (difference_type d)
RWMathArrayIterator< T > & operator-= (difference_type d)
difference_type operator- (const RWMathArrayIteratorBase< T > &i) const
RWMathArrayIterator< T > operator- (difference_type d) const
RWMathArrayIterator< T > operator+ (difference_type d) const
value_typeoperator[] (difference_type n) const
value_typeoperator* () const
pointer operator-> () const

Detailed Description

template<class T>
class RWMathArrayIterator< T >

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

Synopsis

 template <class T>
 class RWMathArray<T>::iterator;

Examples

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

Member Typedef Documentation

template<class T >
typedef RWMathArray<T>::const_pointer RWMathArrayIterator< T >::const_pointer

Typedef for a const pointer to a value in this container.

Reimplemented from RWMathArrayIteratorBase< T >.

template<class T >
typedef RWMathArray<T>::difference_type RWMathArrayIterator< T >::difference_type

Typedef for the type of result from subtracting two iterators obtained from this container.

Reimplemented from RWMathArrayIteratorBase< T >.

template<class T >
typedef RWMathArray<T>::value_type RWMathArrayIterator< T >::value_type

Typedef for the type of elements in this container.

Reimplemented from RWMathArrayIteratorBase< T >.


Constructor & Destructor Documentation

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

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

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

Constructs an RWMathArrayIterator from another RWMathArrayIterator. Initialized iterators can be obtained via the begin() and end() member functions of RWMathArray<T>


Member Function Documentation

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

Returns a reference to the element pointed to by self.

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

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

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

Prefix or postfix increment or decrement operator. The RWMathArrayIterator 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.

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

Prefix or postfix increment or decrement operator. The RWMathArrayIterator 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.

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

Moves the RWMathArrayIterator 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.

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

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

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

If the return value is positive, the RWMathArrayIterator is that many elements past the iterator i. If the return value is negative, the RWMathArrayIterator is that many elements before the iterator i.

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

Prefix or postfix increment or decrement operator. The RWMathArrayIterator 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.

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

Prefix or postfix increment or decrement operator. The RWMathArrayIterator 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.

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

Moves the RWMathArrayIterator 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.

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

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

template<class T >
RWMathArrayIterator<T>& RWMathArrayIterator< T >::operator= ( const RWMathArrayIterator< T > &  x  )  [inline]

Sets the RWMathArrayIterator state to be the same state as i.

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

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.

 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.