Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Member Functions | Private Attributes

SgVectorIterator< T > Class Template Reference

Vector iterator. More...

#include <SgVector.h>

List of all members.

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

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 294 of file SgVector.h.


Constructor & Destructor Documentation

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

Create a vector iterator to iterate through vector.

Definition at line 298 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 307 of file SgVector.h.

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

Definition at line 311 of file SgVector.h.


Member Function Documentation

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 328 of file SgVector.h.

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 321 of file SgVector.h.

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 314 of file SgVector.h.

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]
template<typename T>
const SgVector<T>& SgVectorIterator< T >::m_vec [private]

Definition at line 334 of file SgVector.h.

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


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


Sun Mar 13 2011 Doxygen 1.7.1