TRIQS/itertools 1.3.0
C++ range library
|
#include <itertools/product.hpp>
Iterator for a itertools::multiplied (cartesian product) range.
It stores three tuples of iterators of the original ranges:
its_begin
contains the begin iterators of all rangesits_end
contains the end iterators of all rangesits
contains the current iterators of all rangesIncrementing is done from right to left, i.e. the iterator of the last range is incremented first. Once an iterator reaches the end of its range, it is reset to the beginning and the iterator of the previous range is incremented once.
Dereferencing returns a tuple containing the results of dereferencing each iterator.
See itertools::product(Rs &&...rgs) for more details.
EndIters | Tuple type containing the end iterators of all ranges. |
Iters | Iterator types. |
Definition at line 56 of file product.hpp.
Public Member Functions | |
prod_iter ()=default | |
Default constructor. | |
prod_iter (std::tuple< Iters... > its_begin, EndIters its_end) | |
Construct a product iterator from given begin iterators and end iterators. | |
decltype(auto) | dereference () const |
Dereference the iterator. | |
void | increment () |
Increment the iterator by incrementing the current iterators starting with the iterator of the last range. | |
bool | operator== (prod_iter const &other) const |
Equal-to operator for two itertools::prod_iter objects. | |
template<typename SentinelIter > | |
bool | operator== (sentinel_t< SentinelIter > const &s) const |
Equal-to operator for a itertools::prod_iter and an itertools::sentinel_t. | |
Public Attributes | |
std::tuple< Iters... > | its = its_begin |
Tuple containing the current iterators of the original ranges. | |
std::tuple< Iters... > | its_begin |
Tuple containing the begin iterators of the original ranges. | |
EndIters | its_end |
Tuple containing the end iterators of the original ranges. | |
Static Public Attributes | |
static constexpr long | Rank = sizeof...(Iters) |
Number of original ranges. | |
|
inline |
Construct a product iterator from given begin iterators and end iterators.
its_begin | Tuple containing begin iterators of the original ranges. |
its_end | Tuple containing end iterators of the original ranges. |
Definition at line 78 of file product.hpp.
|
inlinenodiscard |
Dereference the iterator.
Definition at line 129 of file product.hpp.
|
inlinenodiscard |
Equal-to operator for two itertools::prod_iter objects.
other | itertools::prod_iter to compare with. |
Definition at line 105 of file product.hpp.
|
inlinenodiscard |
Equal-to operator for a itertools::prod_iter and an itertools::sentinel_t.
We reach the end of the product range, when the first iterator, i.e. std::get<0>(its)
, is at its end.
SentinelIter | Iterator type of the sentinel. |
s | itertools::sentinel_t to compare with. |
std::get<0>(its)
, is equal to the iterator of the sentinel. Definition at line 116 of file product.hpp.