Class CartesianProductIterator¶
-
template<typename
T
>
classCartesianProductIterator
: public boost::iterator_facade<CartesianProductIterator<T>, std::vector<T::value_type::value_type> const, boost::forward_traversal_tag>¶ Class iterating over the Cartesian product of a forward iterable container of forward iterable containers
Unnamed Group
-
template<>
usingOuterContainer
= T¶ Give types more descriptive names.
-
template<>
usingContainer
= typename T::value_type¶
-
template<>
usingContent
= typename T::value_type::value_type¶
Public Functions
-
CartesianProductIterator
()¶ Delete default constructor.
-
CartesianProductIterator
(T const &structure, std::size_t pos)¶ Constructor setting the underlying iterator and position.
- Parameters
[in] structure
: The underlying structure[in] pos
: The position the iterator should be initialized to. std::numeric_limits<std::size_t>::max()stands for the end, the position after the last element.
Private Functions
-
void
increment
()¶ Increment iterator.
-
bool
equal
(CartesianProductIterator<T> const &other) const¶ Check for equality.
-
std::vector<typename T::value_type::value_type> const &
dereference
() const¶ Dereference iterator.
Private Members
-
OuterContainer const &
structure_
¶ The part we are iterating over.
-
std::vector<typename Container::const_iterator>
position_
¶ The position in the Cartesian product.
For each element of structure_, give the position in it. The empty vector represents the end position. Note that this vector has a size equal to structure->size(), or is empty.
-
std::size_t
absolutePosition_
= 0¶ The position just indexed by an integer.
-
std::vector<typename Container::const_iterator>
cbegins_
¶ The begin iterators, saved for convenience and performance.
-
std::vector<typename Container::const_iterator>
cends_
¶ The end iterators, saved for convenience and performance.
-
std::vector<std::vector<Content>>
result_
= {std::vector<Content>()}¶ Used for returning references.
We initialize with one empty element, so that we only need to add more elements in increment().
-
std::size_t
size_
= 0¶ The size of the instance of OuterContainer.
Friends
-
friend
CartesianProductIterator::boost::iterator_core_access
Grant access to boost::iterator_facade.
-
template<>