Skip to content

Commit

Permalink
[oneDPL][ranges][zip_view] + 'minor change' for const/non const type …
Browse files Browse the repository at this point in the history
…definition
  • Loading branch information
MikeDvorskiy committed Oct 22, 2024
1 parent 03ce46f commit 74d52be
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions include/oneapi/dpl/pstl/zip_view_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ class zip_view : public std::ranges::view_interface<zip_view<Views...>> {
std::forward_iterator_tag,
std::input_iterator_tag>>>;

using value_type = std::conditional_t<!Const, tuple_type<std::ranges::range_value_t<Views>...>,
tuple_type<std::ranges::range_value_t<const Views>...>>;
using value_type = std::conditional_t<Const, tuple_type<std::ranges::range_value_t<const Views>...>,
tuple_type<std::ranges::range_value_t<Views>...>>;

using difference_type = std::conditional_t<!Const, std::common_type_t<std::ranges::range_difference_t<Views>...>,
std::common_type_t<std::ranges::range_difference_t<const Views>...>>;
using return_tuple_type = std::conditional_t<!Const, tuple_type<typename std::iterator_traits<std::ranges::iterator_t<Views>>::reference...>,
tuple_type<typename std::iterator_traits<std::ranges::iterator_t<const Views>>::reference...>>;
using difference_type = std::conditional_t<Const, std::common_type_t<std::ranges::range_difference_t<const Views>...>,
std::common_type_t<std::ranges::range_difference_t<Views>...>>;

using return_tuple_type = std::conditional_t<Const,
tuple_type<typename std::iterator_traits<std::ranges::iterator_t<const Views>>::reference...>,
tuple_type<typename std::iterator_traits<std::ranges::iterator_t<Views>>::reference...>>;

iterator() = default;

Expand Down Expand Up @@ -303,9 +305,9 @@ class zip_view : public std::ranges::view_interface<zip_view<Views...>> {
tuple_type<std::ranges::sentinel_t<const Views>...>>;

end_type end_;
}; // class sentinel
}; // class sentinel

constexpr auto begin() requires (std::ranges::range<Views> && ...) // !simple_view?
constexpr auto begin() requires (std::ranges::range<Views> && ...)
{
auto __tr = [](auto... __args) { return iterator<false>(__args...);};
return apply_to_tuple(__tr, std::ranges::begin, views_);
Expand All @@ -317,7 +319,7 @@ class zip_view : public std::ranges::view_interface<zip_view<Views...>> {
return apply_to_tuple(__tr, std::ranges::begin, views_);
}

constexpr auto end() requires (std::ranges::range<Views> && ...) // requires !simple_view {
constexpr auto end() requires (std::ranges::range<Views> && ...)
{
if constexpr (!zip_is_common<Views...>)
{
Expand Down

0 comments on commit 74d52be

Please sign in to comment.