![]() |
Dynamic cast iterator for polymorphic pointer vectors.The CastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T. More...
#include <PtrVector.h>
Public Types | |
typedef std::forward_iterator_tag | IteratorCategory |
The iterator category. | |
typedef C * | ValueType |
Type of the underlying pointers. | |
typedef C * | PointerType |
Pointer return type. | |
typedef C *const & | ReferenceType |
Reference return type. | |
typedef ptrdiff_t | DifferenceType |
Difference between two iterators. | |
typedef T *const * | IteratorType |
Type of the internal pointer. | |
typedef IteratorCategory | iterator_category |
The iterator category. | |
typedef ValueType | value_type |
Type of the underlying pointers. | |
typedef PointerType | pointer |
Pointer return type. | |
typedef ReferenceType | reference |
Reference return type. | |
typedef DifferenceType | difference_type |
Difference between two iterators. | |
Public Member Functions | |
Constructors | |
CastIterator () | |
Default constructor for CastIterator. | |
CastIterator (IteratorType begin, IteratorType end) | |
Standard constructor for CastIterator. More... | |
template<typename Other > | |
CastIterator (const CastIterator< Other > &it) | |
Conversion constructor from different CastIterator instances. More... | |
Operators | |
CastIterator & | operator++ () |
Pre-increment operator. More... | |
CastIterator | operator++ (int) |
Post-increment operator. More... | |
Access operators | |
PointerType | operator* () const |
Returns a handle to the element at the current iterator position. More... | |
PointerType | operator-> () const |
Direct access to the element at the current iterator position. More... | |
Utility functions | |
const IteratorType & | base () const |
Direct access to the current memory location of the cast iterator. More... | |
const IteratorType & | stop () const |
Direct access to the final memory location of the cast iterator. More... | |
Private Attributes | |
Member variables | |
IteratorType | cur_ |
Pointer to the current memory location. | |
IteratorType | end_ |
Pointer to the element one past the last element in the element range. | |
Dynamic cast iterator for polymorphic pointer vectors.
The CastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T.
Note: Using a CastIterator is computationally more expensive than using a standard iterator over all elements contained in the vector.
|
inline |
Standard constructor for CastIterator.
begin | The beginning of the element range. |
end | The end of the element range. |
|
inline |
Conversion constructor from different CastIterator instances.
it | The foreign CastIterator instance to be copied. |
|
inline |
Direct access to the current memory location of the cast iterator.
|
inline |
Returns a handle to the element at the current iterator position.
|
inline |
Pre-increment operator.
|
inline |
Post-increment operator.
|
inline |
Direct access to the element at the current iterator position.
|
inline |
Direct access to the final memory location of the cast iterator.