|
LiteFX 0.4.1.2025
Computer Graphics Engine
|
Wraps an iterator and returns covariants of type T of the iterated value. More...
#include <containers.hpp>
Public Types | |
| using | value_type = std::remove_cvref_t<T> |
| The type of the value that is iterated. | |
| using | iterator_category = std::forward_iterator_tag |
| The category of the iterator. | |
| using | difference_type = std::ptrdiff_t |
| The type that expresses the difference between two iterators. | |
| using | pointer = std::remove_reference_t<T>* |
| The type of a pointer returned by the iterator. | |
Public Member Functions | |
| CovariantIterator () | |
| Initializes a new iterator instance. Always throws a RuntimeException. | |
| template<typename TIterator > | |
| CovariantIterator (const TIterator &it) | |
| Initializes a new iterator instance. | |
| CovariantIterator (const CovariantIterator &_other) | |
| Copies another iterator instance. | |
| CovariantIterator (CovariantIterator &&_other) noexcept=default | |
| Takes ownership over another iterator instances. | |
| CovariantIterator & | operator= (const CovariantIterator &_other) |
| Copies another iterator instance. | |
| CovariantIterator & | operator= (CovariantIterator &&_other)=default |
| Takes ownership over another iterator instances. | |
| ~CovariantIterator () noexcept=default | |
| Releases the iterator. | |
| T | operator* () const |
| Returns a reference of the value at the current iterator position. | |
| pointer | operator-> () |
| Returns a pointer to the value at the current iterator position. | |
| CovariantIterator & | operator++ () |
| Increments the iterator position by one. | |
| CovariantIterator | operator++ (int) |
| Increments the iterator position by one and returns the previous iterator. | |
| bool | operator== (const CovariantIterator &_other) const |
| Checks if two iterators are equal, i.e. they are pointing to the same value. | |
Wraps an iterator and returns covariants of type T of the iterated value.
This iterator uses type erasure to hide the actual iterated types from the interface. This allows to iterate a range of class instances as a range of base class instances. However, due to the type erasure, each iteration requires a virtual indirection, resulting in slightly lower performance. Limit the use of this iterator to base class interfaces and return a reference to the actual underlying range in child classes instead for most performance.
| T | The type returned by the iterator, that is covariant to the actual iterated type. |
| using LiteFX::CovariantIterator< T >::difference_type = std::ptrdiff_t |
The type that expresses the difference between two iterators.
| using LiteFX::CovariantIterator< T >::iterator_category = std::forward_iterator_tag |
The category of the iterator.
| using LiteFX::CovariantIterator< T >::pointer = std::remove_reference_t<T>* |
The type of a pointer returned by the iterator.
| using LiteFX::CovariantIterator< T >::value_type = std::remove_cvref_t<T> |
The type of the value that is iterated.
|
inlineexplicit |
Initializes a new iterator instance. Always throws a RuntimeException.
This constructor is only defined to satisfy the std::ranges::range constraint for ranges that return this iterator. Attempting to default-initialize a CovariantInterator will result in a runtime error.
|
inline |
Initializes a new iterator instance.
| TIterator | The type of the iterator that returns the value instances. |
| it | The iterator to wrap within the iterator instance. |
|
inline |
Copies another iterator instance.
| _other | The iterator to copy. |
|
inlinedefaultnoexcept |
Takes ownership over another iterator instances.
| _other | The iterator instance to take over. |
|
defaultnoexcept |
Releases the iterator.
|
inline |
Returns a reference of the value at the current iterator position.
|
inline |
Increments the iterator position by one.
|
inline |
Increments the iterator position by one and returns the previous iterator.
|
inline |
Returns a pointer to the value at the current iterator position.
This operator is only available, if the iterated type is a lvalue reference.
|
inline |
Copies another iterator instance.
| _other |
|
inlinedefault |
Takes ownership over another iterator instances.
| _other | The iterator instance to take over. |
|
inline |
Checks if two iterators are equal, i.e. they are pointing to the same value.
| _other | The iterator to check against. |
true, if the iterators are pointing to the same value.