46 template <
typename... Iterators>
51 typedef std::tuple<
typename Iterators::value_type...>
value_type;
52 typedef std::tuple<
typename Iterators::pointer...>
pointer;
53 typedef std::tuple<
typename Iterators::reference...>
reference;
57 template <
typename... Iterators>
63 typedef typename traits::iterators iterators;
71 template <
size_t... Is>
72 struct index_sequence;
74 template <
typename... Iterators2>
75 zip_iterator(
const Iterators2&... iterators) : iContents{ iterators... }
81 return reference_helper(std::make_index_sequence<
sizeof...(Iterators)>());
86 set_pointer<0>(result);
96 self_type old{ *
this };
107 self_type old{ *
this };
113 return std::get<0>(
contents()) - std::get<0>(aOther.contents());
117 self_type result{ *
this };
118 result.add<0>(aAmount);
123 self_type result{ *
this };
124 result.subtract<0>(aAmount);
129 return std::get<0>(
contents()) < std::get<0>(aOther.contents());
133 return std::get<0>(
contents()) == std::get<0>(aOther.contents());
137 return std::get<0>(
contents()) != std::get<0>(aOther.contents());
145 template <std::
size_t Index>
149 if constexpr (Index < std::tuple_size<iterators>::value - 1)
150 increment<Index + 1>();
152 template <std::
size_t Index>
156 if constexpr (Index < std::tuple_size<iterators>::value - 1)
157 decrement<Index + 1>();
159 template <std::
size_t Index>
162 std::get<Index>(
contents()) += aAmount;
163 if constexpr (Index < std::tuple_size<iterators>::value - 1)
164 add<Index + 1>(aAmount);
166 template <std::
size_t Index>
169 std::get<Index>(
contents()) -= aAmount;
170 if constexpr (Index < std::tuple_size<iterators>::value - 1)
171 subtract<Index + 1>(aAmount);
173 template <std::size_t... Is>
174 reference reference_helper(std::index_sequence<Is...>)
176 return reference_helper_2(*std::get<Is>(
contents())...);
178 template <
typename... References>
179 reference reference_helper_2(References&... aReferences)
183 template <std::
size_t Index>
184 void set_pointer(
pointer& aResult)
186 std::get<Index>(aResult) = &std::get<Index>(
contents());
187 if constexpr (Index < std::tuple_size<iterators>::value - 1)
188 set_pointer<Index + 1>(aResult);
198 template <
typename... Iterators>
201 return zip_iterator<Iterators...>(std::forward<Iterators>(iterators)...);
207 template <
typename... Iterators>
208 struct iterator_traits<
neolib::zip_iterator<Iterators...>>
217 template <
typename... Iterators>
self_type operator+(difference_type aAmount) const
traits::iterator_category iterator_category
const iterators & contents() const
traits::reference reference
traits::difference_type difference_type
traits::value_type value_type
bool operator!=(const self_type &aOther) const
self_type operator++(int)
self_type operator--(int)
bool operator<(const self_type &aOther) const
difference_type operator-(const self_type &aOther) const
zip_iterator(const Iterators2 &... iterators)
self_type operator-(difference_type aAmount) const
bool operator==(const self_type &aOther) const
zip_iterator< Iterators... > make_zip_iterator(Iterators &&... iterators)
std::tuple< typename Iterators::pointer... > pointer
std::ptrdiff_t difference_type
std::tuple< typename Iterators::value_type... > value_type
std::iterator_traits< typenamestd::tuple_element< 0, iterators >::type >::iterator_category iterator_category
std::tuple< Iterators... > iterators
std::tuple< typename Iterators::reference... > reference