rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMathArrayConstIterator< 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 RWMathArrayConstIterator< 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

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

Detailed Description

template<class T>
class RWMathArrayConstIterator< T >

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

Synopsis

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

Examples

 #include <rw/math/mtharray.h>
 
 int main()
 {
     RWMathArray<int> A(5,5,5,1); // Create a 5x5x5 array of 1's
     RWMathArray<int>::const_iterator i = A.begin();
     RWMathArray<int>::const_iterator stop = A.end();

 
                                  // Print each element of A
     while(i != stop) {
         cout << *i << endl;
         ++i;
     }
 }

Member Typedef Documentation

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

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

Reimplemented from RWMathArrayIteratorBase< T >.

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 RWMathArrayConstIterator< T >::value_type

Typedef for the type of elements in this container.

Reimplemented from RWMathArrayIteratorBase< T >.


Constructor & Destructor Documentation

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

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

template<class T >
RWMathArrayConstIterator< T >::RWMathArrayConstIterator ( const RWMathArrayIteratorBase< T > &  i  )  [inline]

Constructs a RWMathArrayConstIterator from another RWMathArrayIterator or RWMathArrayConstIterator. Initialized RWMathArrayIterator and RWMathArrayConstIterator instances can be obtained via the RWMathArray<T>::begin() and RWMathArray<T>::end() member functions of RWMathArray<T> .


Member Function Documentation

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

Returns a reference to the element pointed to by self.

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

Returns a RWMathArrayConstIterator that is d elements past (or before) self.

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

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

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

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

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

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

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

Returns a RWMathArrayConstIterator that is d elements past (or before) self.

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

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

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

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

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

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

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

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

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

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

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

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

Reimplemented from RWMathArrayIteratorBase< T >.

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