|
TRIQS/itertools 1.3.0
C++ range library
|
#include <itertools/product.hpp>
Iterator for a itertools::multiplied_vec (cartesian product of homogeneous ranges) range.
Similar to itertools::prod_iter, but works with a vector of homogeneous ranges instead of a tuple of heterogeneous ranges. This allows for a runtime-determined number of ranges.
Incrementing 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 vector containing the results of dereferencing each iterator.
See itertools::product_vec(std::vector<R> const &) for more details.
| Iter | Iterator type of the ranges. |
Definition at line 220 of file product.hpp.
Public Types | |
| using | value_type = typename std::iterator_traits<Iter>::value_type |
| Value type of the dereferenced iterators. | |
Public Member Functions | |
| prod_iter_vec ()=default | |
| Default constructor. | |
| prod_iter_vec (std::vector< Iter > its_begin, std::vector< Iter > its_end) | |
| Construct a product iterator from given begin iterators and end iterators. | |
| std::vector< value_type > | 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_vec const &other) const |
| Equal-to operator for two itertools::prod_iter_vec objects. | |
| template<typename SentinelIter> | |
| bool | operator== (sentinel_t< SentinelIter > const &s) const |
| Equal-to operator for a itertools::prod_iter_vec and an itertools::sentinel_t. | |
|
inline |
Construct a product iterator from given begin iterators and end iterators.
| its_begin | Vector containing begin iterators of the original ranges. |
| its_end | Vector containing end iterators of the original ranges. |
Definition at line 245 of file product.hpp.
|
inlinenodiscard |
Dereference the iterator.
Definition at line 289 of file product.hpp.
|
inlinenodiscard |
Equal-to operator for two itertools::prod_iter_vec objects.
| other | itertools::prod_iter_vec to compare with. |
Definition at line 268 of file product.hpp.
|
inlinenodiscard |
Equal-to operator for a itertools::prod_iter_vec and an itertools::sentinel_t.
We reach the end of the product range, when the first iterator, i.e. its[0], is at its end, or when done=true for empty products.
| SentinelIter | Iterator type of the sentinel. |
| s | itertools::sentinel_t to compare with. |
Definition at line 280 of file product.hpp.