Skip to content

Commit

Permalink
[oneDPL][ranges][zip_view] + enumerate_view
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDvorskiy committed Sep 27, 2024
1 parent 80ef9c5 commit 603daed
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/oneapi/dpl/pstl/zip_view_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,20 @@ struct zip_fn {

inline constexpr zip_fn zip{};

template <typename _R>
using enumerate_view = oneapi::dpl::ranges::zip_view<std::ranges::iota_view<std::ranges::range_size_t<_R>,
std::ranges::range_size_t<_R>>, _R>;

struct enumerate_fn {
template <std::ranges::viewable_range _R>
constexpr auto operator()(_R&& __r) const {
return oneapi::dpl::ranges::zip_view(std::views::iota((std::ranges::range_size_t<_R>)0,
std::ranges::size(__r)), std::forward<_R>(__r));
}
};

inline constexpr enumerate_fn enumerate{};

} // namespace ranges
} // namespace dpl
} // namespace oneapi
Expand Down

0 comments on commit 603daed

Please sign in to comment.