Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgVectorIterator< T > Class Template Reference

#include <SgVector.h>

List of all members.


Detailed Description

template<typename T>
class SgVectorIterator< T >

Vector iterator.

More concise way to iterate (from "Large-Scale C++ Software Design" by John Lakos):

      for (SgVectorIterator<T> it(vector); it; ++it) { ... it() ... }
    
Better performance because every method is inline.

Definition at line 314 of file SgVector.h.

Public Member Functions

 SgVectorIterator (const SgVector< T > &vec)
 Create a vector iterator to iterate through vector.
 SgVectorIterator (const SgVectorIterator &it)
 Copy current state of iterator.
virtual ~SgVectorIterator ()
SgVectorIteratoroperator++ ()
 Advance the state of the iteration to the next element.
const T & operator * () const
 Return the value of the current element.
 operator bool () const
 Return true if iteration is valid, otherwise false.

Private Member Functions

SgVectorIteratoroperator= (const SgVectorIterator &)
 not implemented

Private Attributes

const SgVector< T > & m_vec
vector< T >::const_iterator m_it


Constructor & Destructor Documentation

template<typename T>
SgVectorIterator< T >::SgVectorIterator ( const SgVector< T > &  vec  ) 

Create a vector iterator to iterate through vector.

Definition at line 318 of file SgVector.h.

template<typename T>
SgVectorIterator< T >::SgVectorIterator ( const SgVectorIterator< T > &  it  ) 

Copy current state of iterator.

Useful for creating a new iterator that only runs from the current position to the vector end. See UniqueElements() for an example.

Definition at line 328 of file SgVector.h.

template<typename T>
virtual SgVectorIterator< T >::~SgVectorIterator (  )  [virtual]

Definition at line 332 of file SgVector.h.


Member Function Documentation

template<typename T>
const T& SgVectorIterator< T >::operator * (  )  const

Return the value of the current element.

Reimplemented in SgVectorIteratorOf< T >, and SgVectorIteratorOf< SgProp >.

Definition at line 342 of file SgVector.h.

Referenced by SgVectorIteratorOf< SgProp >::operator *().

template<typename T>
SgVectorIterator< T >::operator bool (  )  const

Return true if iteration is valid, otherwise false.

Reimplemented in SgVectorIteratorOf< T >, and SgVectorIteratorOf< SgProp >.

Definition at line 349 of file SgVector.h.

Referenced by SgVectorIteratorOf< SgProp >::operator bool().

template<typename T>
SgVectorIterator& SgVectorIterator< T >::operator++ (  ) 

Advance the state of the iteration to the next element.

Reimplemented in SgVectorIteratorOf< T >, and SgVectorIteratorOf< SgProp >.

Definition at line 335 of file SgVector.h.

Referenced by SgVectorIteratorOf< SgProp >::operator++().

template<typename T>
SgVectorIterator& SgVectorIterator< T >::operator= ( const SgVectorIterator< T > &   )  [private]

not implemented


Member Data Documentation

template<typename T>
vector<T>::const_iterator SgVectorIterator< T >::m_it [private]

Definition at line 357 of file SgVector.h.

Referenced by SgVectorIterator< void * >::operator *(), SgVectorIterator< void * >::operator bool(), and SgVectorIterator< void * >::operator++().

template<typename T>
const SgVector<T>& SgVectorIterator< T >::m_vec [private]

Definition at line 355 of file SgVector.h.

Referenced by SgVectorIterator< void * >::operator bool().


The documentation for this class was generated from the following file:


17 Jun 2010 Doxygen 1.4.7