1 #ifndef UTOPIA_CORE_ZIP_HH
2 #define UTOPIA_CORE_ZIP_HH
10 #include <boost/hana/ext/std/tuple.hpp>
11 #include <boost/hana/transform.hpp>
12 #include <boost/hana/for_each.hpp>
40 template <
typename... Iters>
44 using Tuple = std::tuple<Iters...>;
46 using RefTuple = std::tuple<decltype(*std::declval<Iters>())...>;
48 using PtrTuple = std::tuple<typename std::iterator_traits<Iters>::pointer...>;
55 using value_type = std::tuple<typename std::iterator_traits<Iters>::value_type...>;
60 std::common_type_t<typename std::iterator_traits<Iters>::iterator_category...>;
75 typename std::enable_if_t<
76 std::is_base_of_v<std::bidirectional_iterator_tag,
98 typename std::enable_if_t<
99 std::is_base_of_v<std::bidirectional_iterator_tag,
113 typename std::enable_if_t<
114 std::is_base_of_v<std::random_access_iterator_tag,
127 typename std::enable_if_t<
128 std::is_base_of_v<std::random_access_iterator_tag,
141 typename std::enable_if_t<
142 std::is_base_of_v<std::random_access_iterator_tag,
154 typename std::enable_if_t<
155 std::is_base_of_v<std::random_access_iterator_tag,
168 typename std::enable_if_t<
169 std::is_base_of_v<std::random_access_iterator_tag,
184 [](
auto&& iter) {
return std::ref(*iter); });
194 [](
auto&& iter) {
return std::ref(*iter); });
204 [](
auto&& iter) {
return &(*iter); });
214 [](
auto&& iter) {
return &(*iter); });
255 template <
typename... Iterators>
265 template<
typename... It>
276 template<
typename... It>
288 typename std::enable_if_t<
289 std::is_base_of_v<std::random_access_iterator_tag,
302 typename std::enable_if_t<
303 std::is_base_of_v<std::random_access_iterator_tag,
316 typename std::enable_if_t<
317 std::is_base_of_v<std::random_access_iterator_tag,
330 typename std::enable_if_t<
331 std::is_base_of_v<std::random_access_iterator_tag,
353 typename std::enable_if_t<
354 std::is_base_of_v<std::random_access_iterator_tag,
372 ostr <<
"->" << *right;
378 template <
typename... Iterators>
379 ZipIterator(std::tuple<Iterators...> iters)->ZipIterator<Iterators...>;
395 template <
typename Adaptor,
typename... Containers>
396 auto adapt_zip(Adaptor&& adaptor, Containers&... containers)
408 template <
typename... Containers>
412 using Tuple = std::tuple<std::reference_wrapper<Containers>...>;
536 template <
typename... Containers>
539 return zipper.
begin();
549 template <
typename... Containers>
562 template <
typename... Containers>
575 template <
typename... Containers>
578 return zipper.
cend();
588 template <
typename... Containers>
601 template <
typename... Containers>
604 return zipper.
rend();
OutputIt copy(const Utopia::ExecPolicy policy, InputIt first, InputIt last, OutputIt d_first)
Copy the input range to a new range.
Definition: parallel.hh:324
OutputIt transform(const Utopia::ExecPolicy policy, InputIt first1, InputIt last1, OutputIt d_first, UnaryOperation unary_op)
Apply a unary operator to a range and store the result in a new range.
Definition: parallel.hh:368
void for_each(const Utopia::ExecPolicy policy, InputIt first, InputIt last, UnaryFunction f)
Apply a function to a range.
Definition: parallel.hh:346
auto adapt_zip(Adaptor &&adaptor, Containers &... containers)
Return a zip iterator built from an adapter applied to containers.
Definition: zip.hh:396
Definition: parallel.hh:235