Loading...
Searching...
No Matches
VdfVectorIterator< T > Class Template Reference

A read-only iterator over values held by a VdfVector. More...

#include <vectorIterator.h>

Public Member Functions

 VdfVectorIterator ()=default
 Construct an iterator that is at end and not associated with a vector.
 
 VdfVectorIterator (const VdfVectorIterator &)=delete
 
VdfVectorIteratoroperator= (const VdfVectorIterator &)=delete
 
bool IsAtEnd () const
 Returns true if this does not point to an element in the vector.
 
VdfVectorIteratoroperator++ ()
 Advances the iterator to the next data element.
 
const T & operator* () const
 Returns the data element pointed to by this.
 
bool AdvanceTo (size_t idx)
 Advances this to a data element at or past idx.
 

Friends

class VdfVector
 

Detailed Description

template<typename T>
class VdfVectorIterator< T >

A read-only iterator over values held by a VdfVector.

Definition at line 24 of file vectorIterator.h.

Constructor & Destructor Documentation

◆ VdfVectorIterator()

template<typename T >
VdfVectorIterator ( )
default

Construct an iterator that is at end and not associated with a vector.

Member Function Documentation

◆ AdvanceTo()

template<typename T >
bool AdvanceTo ( size_t idx)
inline

Advances this to a data element at or past idx.

Returns true if this points exactly at idx after advancing. Because compressed vectors have gaps in their indices, a false return value indicates that the iterator advanced past idx, without necessarily having advanced to the end.

As an example, the following code copies every 5th data element if it exists in the source vector:

VdfVectorIterator<T> it = vector.GetIterator<T>();
std::vector<T> result;
for (size_t i=0; !it.IsAtEnd(); i+=5) {
if (it.AdvanceTo(i)) {
result.push_back(*it);
}
}
A read-only iterator over values held by a VdfVector.

Definition at line 121 of file vectorIterator.h.

◆ IsAtEnd()

template<typename T >
bool IsAtEnd ( ) const
inline

Returns true if this does not point to an element in the vector.

Definition at line 37 of file vectorIterator.h.

◆ operator*()

template<typename T >
const T & operator* ( ) const
inline

Returns the data element pointed to by this.

Definition at line 46 of file vectorIterator.h.

◆ operator++()

template<typename T >
VdfVectorIterator< T > & operator++ ( )
inline

Advances the iterator to the next data element.

Definition at line 103 of file vectorIterator.h.

Friends And Related Symbol Documentation

◆ VdfVector

template<typename T >
friend class VdfVector
friend

Definition at line 74 of file vectorIterator.h.


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