![]() |
R-Type
2
Doom but in better
|
Iterator for traversing the elements of multiple zipped containers, paired with their indices. More...
#include <IndexedZipperIterator.hpp>
Public Types | |
using | value = std::tuple<it_reference_t<Containers>...> |
Type alias for the value type returned by the iterator. | |
using | value_type = std::tuple<std::size_t, it_reference_t<Containers>...> |
using | reference = value_type& |
using | pointer = void |
using | difference_type = std::size_t |
using | iterator_category = std::forward_iterator_tag |
using | iterator_tuple = std::tuple<iterator_t<Containers>...> |
Type alias for the tuple of iterators for the containers being iterated. | |
Public Member Functions | |
IndexedZipperIterator (iterator_tuple it_tuple, std::size_t max, std::size_t idx=0) | |
Constructs an IndexedZipperIterator with the current iterator positions and index. | |
IndexedZipperIterator (const IndexedZipperIterator &z) | |
Copy constructor. | |
IndexedZipperIterator & | operator++ () |
Pre-increment operator. | |
IndexedZipperIterator | operator++ (int) |
Post-increment operator. | |
value_type | operator* () |
Dereference operator. | |
value_type * | operator-> () |
Member access operator. | |
Friends | |
bool | operator== (const IndexedZipperIterator< Containers... > &lhs, const IndexedZipperIterator< Containers... > &rhs) |
Inequality operator. | |
bool | operator!= (const IndexedZipperIterator< Containers... > &lhs, const IndexedZipperIterator< Containers... > &rhs) |
Equality operator. | |
Iterator for traversing the elements of multiple zipped containers, paired with their indices.
The IndexedZipperIterator
class facilitates iterating over a collection of containers, returning a tuple of the current index and references to the elements of the containers.
Containers | Variadic template parameter for the types of containers being iterated over. |
Definition at line 20 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::difference_type = std::size_t |
Difference type for iterator arithmetic.
Definition at line 35 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::iterator_category = std::forward_iterator_tag |
Iterator category.
Definition at line 36 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::iterator_tuple = std::tuple<iterator_t<Containers>...> |
Type alias for the tuple of iterators for the containers being iterated.
Definition at line 39 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::pointer = void |
Pointer type (not applicable for this iterator).
Definition at line 34 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::reference = value_type& |
Reference type for the value.
Definition at line 33 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::value = std::tuple<it_reference_t<Containers>...> |
Type alias for the value type returned by the iterator.
Definition at line 31 of file IndexedZipperIterator.hpp.
using IndexedZipperIterator< Containers >::value_type = std::tuple<std::size_t, it_reference_t<Containers>...> |
Definition at line 32 of file IndexedZipperIterator.hpp.
|
inline |
Constructs an IndexedZipperIterator
with the current iterator positions and index.
it_tuple | A tuple of iterators pointing to the current positions in the containers. |
max | The maximum number of elements to iterate over (determined by the smallest container size). |
Definition at line 47 of file IndexedZipperIterator.hpp.
|
inline |
Copy constructor.
z | The IndexedZipperIterator to copy. |
Definition at line 54 of file IndexedZipperIterator.hpp.
|
inline |
Dereference operator.
Returns the current index and references to the elements of the containers.
Definition at line 88 of file IndexedZipperIterator.hpp.
|
inline |
Pre-increment operator.
Advances the iterator to the next element in the containers.
Definition at line 63 of file IndexedZipperIterator.hpp.
|
inline |
Post-increment operator.
Advances the iterator to the next element in the containers.
Definition at line 75 of file IndexedZipperIterator.hpp.
|
inline |
Member access operator.
Provides a pointer-like interface to the iterator's value.
Definition at line 99 of file IndexedZipperIterator.hpp.
|
friend |
Equality operator.
Compares two iterators for equality.
lhs | Left-hand side iterator. |
rhs | Right-hand side iterator. |
true
if the iterators are equal; otherwise false
. Definition at line 125 of file IndexedZipperIterator.hpp.
|
friend |
Inequality operator.
Compares two iterators for inequality.
lhs | Left-hand side iterator. |
rhs | Right-hand side iterator. |
true
if the iterators are not equal; otherwise false
. Definition at line 112 of file IndexedZipperIterator.hpp.