#include <SgVector.h>
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 () |
SgVectorIterator & | operator++ () |
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 | |
SgVectorIterator & | operator= (const SgVectorIterator &) |
not implemented | |
Private Attributes | |
const SgVector< T > & | m_vec |
vector< T >::const_iterator | m_it |
SgVectorIterator< T >::SgVectorIterator | ( | const SgVector< T > & | vec | ) |
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.
virtual SgVectorIterator< T >::~SgVectorIterator | ( | ) | [virtual] |
Definition at line 332 of file SgVector.h.
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 *().
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().
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++().
SgVectorIterator& SgVectorIterator< T >::operator= | ( | const SgVectorIterator< T > & | ) | [private] |
not implemented
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++().
const SgVector<T>& SgVectorIterator< T >::m_vec [private] |
Definition at line 355 of file SgVector.h.
Referenced by SgVectorIterator< void * >::operator bool().