Vector iterator. More...
#include <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 |
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.
SgVectorIterator< T >::SgVectorIterator | ( | const SgVector< T > & | vec | ) |
Create a vector iterator to iterate through vector.
Definition at line 298 of file SgVector.h.
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.
virtual SgVectorIterator< T >::~SgVectorIterator | ( | ) | [virtual] |
Definition at line 311 of file SgVector.h.
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.
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.
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.
SgVectorIterator& SgVectorIterator< T >::operator= | ( | const SgVectorIterator< T > & | ) | [private] |
not implemented
vector<T>::const_iterator SgVectorIterator< T >::m_it [private] |
Definition at line 336 of file SgVector.h.
Referenced by SgVectorIterator< void * >::operator bool(), SgVectorIterator< void * >::operator*(), and SgVectorIterator< void * >::operator++().
const SgVector<T>& SgVectorIterator< T >::m_vec [private] |
Definition at line 334 of file SgVector.h.
Referenced by SgVectorIterator< void * >::operator bool().