33 #include <boost/iterator/iterator_facade.hpp>
37 template<
class Ituple,
class Rtuple,
class Idx>
40 template<
class Ituple,
class Rtuple, std::size_t...Idxs>
42 public boost::iterator_facade <
43 ZipIteratorBase<Ituple, Rtuple, std::index_sequence<Idxs...>>,
45 boost::forward_traversal_tag,
64 friend class boost::iterator_core_access;
70 return std::forward_as_tuple(*std::get<Idxs>(_iters)...);
75 return _iters == other._iters;
80 void advance(difference_type n)
82 ((std::get<Idxs>(_iters) += n), ...);
88 (++std::get<Idxs>(_iters), ...);
95 (--std::get<Idxs>(_iters), ...);
111 template<
class It0,
class...Its>
115 std::tuple<It0, Its...>,
118 typename std::iterator_traits<It0>::reference&&,
119 typename std::iterator_traits<Its>::reference&& ...
121 std::make_index_sequence < 1 + sizeof...(Its) >
127 std::tuple<It0, Its...>,
130 typename std::iterator_traits<It0>::reference &&,
131 typename std::iterator_traits<Its>::reference && ...
133 std::make_index_sequence < 1 +
sizeof...(Its) >
137 Base({std::forward<It0>(it0), std::forward<Its>(its)...})
140 using Base::operator=;
151 : _begin{std::move(b)}, _end{std::move(e)}
167 #include <boost/iterator/zip_iterator.hpp>
168 #include <boost/iterator/counting_iterator.hpp>
171 template<
class Container,
class...Containers>
174 if constexpr(
sizeof...(Containers))
176 const auto initlist = {
c.size(), cs.size()...};
177 const auto [
lo,
hi] = std::minmax(initlist);
180 throw std::invalid_argument{
"All containers have to be of the same size!"};
185 ZipIterator(boost::counting_iterator<std::size_t>(0),
c.begin(), cs.begin()...),
186 ZipIterator(boost::counting_iterator<std::size_t>(
c.size()),
c.end(), cs.end()...)
190 template<
class Container,
class...Containers>
193 if constexpr(
sizeof...(Containers))
195 const auto initlist = {
c.size(), cs.size()...};
196 const auto [
lo,
hi] = std::minmax(initlist);
199 throw std::invalid_argument{
"All containers have to be of the same size!"};
209 template<
class Container>