![]() |
R-Type
2
Doom but in better
|
Iterator for traversing multiple zipped containers simultaneously. More...
#include <ZipperIterator.hpp>
Public Types | |
using | value_type = std::tuple<it_reference_t<Containers>...> |
Type alias for the value type returned by the iterator. | |
using | reference = value_type& |
using | pointer = void |
using | difference_type = std::size_t |
using | iterator_category = std::input_iterator_tag |
using | iterator_tuple = std::tuple<iterator_t<Containers>...> |
Type alias for the tuple of iterators used in the zipped containers. | |
Public Member Functions | |
ZipperIterator (iterator_tuple const &it_tuple, std::size_t max, std::size_t idx=0) | |
Constructs a ZipperIterator with the provided iterator tuple and maximum iteration count. | |
ZipperIterator (const ZipperIterator &z) | |
Copy constructor. | |
ZipperIterator & | operator++ () |
Pre-increment operator. | |
ZipperIterator | operator++ (int) |
Post-increment operator. | |
value_type | operator* () |
Dereference operator. | |
value_type * | operator-> () |
Member access operator. | |
Friends | |
bool | operator== (const ZipperIterator< Containers... > &lhs, const ZipperIterator< Containers... > &rhs) |
Equality operator. | |
bool | operator!= (const ZipperIterator< Containers... > &lhs, const ZipperIterator< Containers... > &rhs) |
Inequality operator. | |
Iterator for traversing multiple zipped containers simultaneously.
The ZipperIterator
class enables simultaneous iteration over multiple containers. It returns a tuple containing references to the elements at the same position in the zipped containers.
Containers | Variadic template parameter for the types of containers being iterated over. |
Definition at line 20 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::difference_type = std::size_t |
Difference type for iterator arithmetic.
Definition at line 34 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::iterator_category = std::input_iterator_tag |
Iterator category.
Definition at line 35 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::iterator_tuple = std::tuple<iterator_t<Containers>...> |
Type alias for the tuple of iterators used in the zipped containers.
Definition at line 38 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::pointer = void |
Pointer type (not applicable for this iterator).
Definition at line 33 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::reference = value_type& |
Reference type for the value.
Definition at line 32 of file ZipperIterator.hpp.
using ZipperIterator< Containers >::value_type = std::tuple<it_reference_t<Containers>...> |
Type alias for the value type returned by the iterator.
Definition at line 31 of file ZipperIterator.hpp.
|
inline |
Constructs a ZipperIterator
with the provided iterator tuple and maximum iteration count.
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 46 of file ZipperIterator.hpp.
|
inline |
Copy constructor.
z | The ZipperIterator to copy. |
Definition at line 53 of file ZipperIterator.hpp.
|
inline |
Dereference operator.
Returns a tuple containing references to the elements of the containers at the current position.
Definition at line 87 of file ZipperIterator.hpp.
|
inline |
Pre-increment operator.
Advances the iterator to the next position in all containers.
Definition at line 62 of file ZipperIterator.hpp.
|
inline |
Post-increment operator.
Advances the iterator to the next position in all containers.
Definition at line 74 of file ZipperIterator.hpp.
|
inline |
Member access operator.
Provides a pointer-like interface to the iterator's value.
Definition at line 98 of file ZipperIterator.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 124 of file ZipperIterator.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 111 of file ZipperIterator.hpp.