ATLAS Offline Software
|
Iterates over all combinations of the provided input iterators. More...
#include <ProductItr.h>
Public Types | |
using | iterator_category = std::input_iterator_tag |
Iterator traits. More... | |
using | value_type = std::vector< Iterator > |
using | reference = const value_type & |
using | pointer = const value_type * |
using | difference_type = std::ptrdiff_t |
Public Member Functions | |
ProductItr ()=default | |
Default constructor creates a generic past-the-end iterator. More... | |
ProductItr (const std::vector< Iterator > &itrs, const std::vector< Iterator > &endItrs) | |
Construct the iterator from an input vector of iterators. More... | |
std::size_t | nItrs () const |
The number of input iterators. More... | |
void | reset () |
Helper function to reset this iterator to its start position. More... | |
bool | exhausted () const |
True if this iterator is past the end. More... | |
reference | operator* () const |
Dereference. More... | |
pointer | operator-> () const |
ProductItr & | operator++ () |
Pre-increment operator. More... | |
ProductItr | operator++ (int) |
Post-increment operator. More... | |
bool | operator== (const ProductItr &other) const |
Iterator comparison functions. More... | |
bool | operator!= (const ProductItr &other) const |
Private Attributes | |
std::vector< Iterator > | m_startItrs |
std::vector< Iterator > | m_endItrs |
std::vector< Iterator > | m_currentItrs |
Iterates over all combinations of the provided input iterators.
Iterator | The type of input iterator |
Dereferencing the iterator gives the states of all the input iterators in the current combination.
Combinations are generated such that the last iterator is the most fastly varying.
std::vector<std::size_t> v1{0, 1, 2}; std::vector<std::size_t> v2{0, 1}; ProductItr<std::vector<std::size_t>::const_iterator> itr( {v1.begin(), v2.begin()}, {v1.end(), v2.end()}); for (; !itr.exhausted(); ++itr) { for (std::vector<std::size_t>::const_iterator itr2 ; *itr) std::cout << *itr2 << ", " std::cout << std::endl; }
Will produce 0, 0, 0, 1, 1, 0, 1, 1, 2, 0, 2, 1,
Definition at line 43 of file ProductItr.h.
using TrigCompositeUtils::ProductItr< Iterator >::difference_type = std::ptrdiff_t |
Definition at line 50 of file ProductItr.h.
using TrigCompositeUtils::ProductItr< Iterator >::iterator_category = std::input_iterator_tag |
Iterator traits.
Definition at line 46 of file ProductItr.h.
using TrigCompositeUtils::ProductItr< Iterator >::pointer = const value_type * |
Definition at line 49 of file ProductItr.h.
using TrigCompositeUtils::ProductItr< Iterator >::reference = const value_type & |
Definition at line 48 of file ProductItr.h.
using TrigCompositeUtils::ProductItr< Iterator >::value_type = std::vector<Iterator> |
Definition at line 47 of file ProductItr.h.
|
default |
Default constructor creates a generic past-the-end iterator.
TrigCompositeUtils::ProductItr< Iterator >::ProductItr | ( | const std::vector< Iterator > & | itrs, |
const std::vector< Iterator > & | endItrs | ||
) |
Construct the iterator from an input vector of iterators.
itrs | The start positions of the internal iterators |
endItrs | The end positions of the internal iterators |
bool TrigCompositeUtils::ProductItr< Iterator >::exhausted | ( | ) | const |
True if this iterator is past the end.
|
inline |
bool TrigCompositeUtils::ProductItr< Iterator >::operator!= | ( | const ProductItr< Iterator > & | other | ) | const |
reference TrigCompositeUtils::ProductItr< Iterator >::operator* | ( | ) | const |
Dereference.
ProductItr& TrigCompositeUtils::ProductItr< Iterator >::operator++ | ( | ) |
Pre-increment operator.
ProductItr TrigCompositeUtils::ProductItr< Iterator >::operator++ | ( | int | ) |
Post-increment operator.
pointer TrigCompositeUtils::ProductItr< Iterator >::operator-> | ( | ) | const |
bool TrigCompositeUtils::ProductItr< Iterator >::operator== | ( | const ProductItr< Iterator > & | other | ) | const |
Iterator comparison functions.
void TrigCompositeUtils::ProductItr< Iterator >::reset | ( | ) |
Helper function to reset this iterator to its start position.
|
private |
Definition at line 89 of file ProductItr.h.
|
private |
Definition at line 88 of file ProductItr.h.
|
private |
Definition at line 87 of file ProductItr.h.