3 #include <boost/iterator/iterator_facade.hpp>
14 template <
typename... Sequences>
21 template <std::size_t... I>
25 static constexpr
size_t size =
sizeof...(Sequences);
31 template <
typename Seq>
36 = std::tuple<typename seq_t<Sequences>::value_type...>;
48 = std::tuple<typename seq_t<Sequences>::const_iterator...>;
52 = std::tuple<typename seq_t<Sequences>::iterator...>;
55 template <
typename ValueType,
56 typename IteratorsType>
58 :
public boost::iterator_facade<
59 cross_iterator<ValueType, IteratorsType>
61 , boost::forward_traversal_tag
83 template <
typename OtherValue,
typename OtherIterators>
121 template <std::size_t... I>
124 for (
auto n: {(std::get<I>(
begins_) == std::get<I>(ends_))...})
148 template <std::size_t... I>
152 using swallow =
int[];
156 && std::get<size-1-I>(
is_) != std::get<size-1-I>(ends_)
157 && ++std::get<size-1-I>(
is_) != std::get<size-1-I>(ends_))
171 template <std::size_t... I>
174 using swallow =
int[];
178 && ((std::get<I>(
is_) = std::get<I>(begins_)),
true))...
182 template <std::size_t... I>
185 for (
auto n: {(std::get<I>(
is_) == std::get<I>(that.
is_))...})
192 template <std::size_t... I>
238 template <std::size_t... I>
245 template <std::size_t... I>
252 template <std::size_t... I>
259 template <std::size_t... I>
270 template <
typename... Sequences>
274 return {std::forward<Sequences>(seqs)...};
277 template <
typename... Sequences>
bool equal(const cross_iterator &that) const
typename std::remove_reference< Seq >::type seq_t
The type of the underlying sequences, without reference.
iterators_type begins_
The begins.
cross_iterator(cross_iterator< OtherValue, OtherIterators > const &that)
bool equal_(const cross_iterator &that, seq< I...>) const
std::tuple< typename seq_t< Sequences >::iterator...> iterators_t
Tuple of iterators.
friend class boost::iterator_core_access
Provide a range that allows to iterate over the cross product of the provided ranges.
cross_sequences(Sequences...sequences)
cross_sequences< Sequences...> cross(Sequences &&...seqs)
std::string type(const automaton &a)
The implementation type of a.
std::istringstream is
The input stream: the specification to translate.
cross_sequences< Sequences...> cross_tuple(const std::tuple< Sequences...> &seqs)
iterator begin_(seq< I...>)
const_iterator end() const
const_iterator cbegin_(seq< I...>) const
const_iterator cend_(seq< I...>) const
IteratorsType iterators_type
Underlying iterators.
ValueSet::value_t tuple(const ValueSet &vs, const typename ValueSets::value_t &...v)
int increment_()
Move to the next position.
iterators_type ends_
The ends.
std::tuple< typename seq_t< Sequences >::value_type...> value_type
The type of the members.
void reset_up_to_(int n)
Move beginning of ranges to their end, and align.
cross_iterator(const iterators_type &is, const iterators_type &ends)
bool empty() const
Whether some of the range is empty.
const_iterator begin() const
sequences_t sequences_
The sequences we iterate upon.
std::tuple< Sequences...> sequences_t
Type of the tuple of all the maps.
value_type dereference() const
const_iterator cend() const
bool empty_(seq< I...>) const
void reset_up_to_(size_t n, seq< I...>)
value_type dereference_(seq< I...>) const
Tuple of values.
const_iterator cbegin() const
iterators_type is_
The current position.
void done_()
We have reached the end, move all the cursors to this end.
std::tuple< typename seq_t< Sequences >::const_iterator...> const_iterators_t
Tuple of const_iterators.
cross_iterator(const iterators_type &is, const iterators_type &begins, const iterators_type &ends)
iterator end_(seq< I...>)
static constexpr size_t size
Number of sequences.
cross_sequences(sequences_t sequences)
int increment_(seq< I...>)
void increment()
Advance to next position.