TRIQS/itertools 1.3.0
C++ range library
Loading...
Searching...
No Matches
itertools::zip_iter< Iters >

#include <itertools/zip.hpp>

Detailed Description

template<typename... Iters>
struct itertools::zip_iter< Iters >

Iterator for a itertools::zipped range.

It stores iterators of the original ranges in a tuple. Incrementing simply increments each iterator individually. Dereferencing returns a tuple containing the results of dereferencing each iterator.

See itertools::zip(Rs &&...rgs) for more details.

Template Parameters
ItersIterator types.

Definition at line 47 of file zip.hpp.

Public Member Functions

 zip_iter ()=default
 Default constructor.
 
 zip_iter (std::tuple< Iters... > its)
 Constructs a zipped iterator from given iterators.
 
decltype(auto) dereference () const
 Dereference the iterator.
 
void increment ()
 Increment the iterator by incrementing all original iterators stored in the tuple.
 
template<typename SentinelIter >
bool operator== (sentinel_t< SentinelIter > const &s) const
 Equal-to operator for a itertools::zip_iter and an itertools::sentinel_t.
 
bool operator== (zip_iter const &other) const
 Equal-to operator for two itertools::zip_iter objects.
 

Public Attributes

std::tuple< Iters... > its
 Tuple containing iterators of the original ranges.
 

Constructor & Destructor Documentation

◆ zip_iter()

template<typename... Iters>
itertools::zip_iter< Iters >::zip_iter ( std::tuple< Iters... > its)
inline

Constructs a zipped iterator from given iterators.

Parameters
itsTuple containing iterators of the original ranges.

Definition at line 58 of file zip.hpp.

Member Function Documentation

◆ dereference()

template<typename... Iters>
decltype(auto) itertools::zip_iter< Iters >::dereference ( ) const
inlinenodiscard

Dereference the iterator.

Returns
Tuple containing the dereferenced values of all original iterators.

Definition at line 103 of file zip.hpp.

◆ operator==() [1/2]

template<typename... Iters>
template<typename SentinelIter >
bool itertools::zip_iter< Iters >::operator== ( sentinel_t< SentinelIter > const & s) const
inlinenodiscard

Equal-to operator for a itertools::zip_iter and an itertools::sentinel_t.

Only one of the iterators has to be equal to the corresponding iterator of the sentinel. In case the original ranges have different lengths, the itertools::zipped range should have the length of the shortest range.

Template Parameters
SentinelIterIterator type of the sentinel.
Parameters
sitertools::sentinel_t to compare with.
Returns
True, if one of the original iterators is equal to the corresponding iterator of the sentinel.

Definition at line 86 of file zip.hpp.

◆ operator==() [2/2]

template<typename... Iters>
bool itertools::zip_iter< Iters >::operator== ( zip_iter< Iters > const & other) const
inlinenodiscard

Equal-to operator for two itertools::zip_iter objects.

Parameters
otheritertools::zip_iter to compare with.
Returns
True, if all original iterators are equal.

Definition at line 74 of file zip.hpp.


The documentation for this struct was generated from the following file: