diff --git a/include/oneapi/dpl/pstl/execution_defs.h b/include/oneapi/dpl/pstl/execution_defs.h index a87ade0cd6..61dc62d2b7 100644 --- a/include/oneapi/dpl/pstl/execution_defs.h +++ b/include/oneapi/dpl/pstl/execution_defs.h @@ -124,22 +124,6 @@ struct __ref_or_copy_impl template using __ref_or_copy = typename __ref_or_copy_impl<::std::decay_t<_ExecPolicy>, _T>::type; -// utilities for Range API -template -auto -__check_size(int) -> decltype(::std::declval<_R&>().size()); - -template -auto -__check_size(long) -> decltype(::std::declval<_R&>().get_count()); - -template -auto -__check_size(...) -> typename ::std::iterator_traits<_It>::difference_type; - -template -using __difference_t = ::std::make_signed_t(0))>; - //------------------------------------------------------------------------ // backend tags //------------------------------------------------------------------------ diff --git a/include/oneapi/dpl/pstl/glue_algorithm_ranges_defs.h b/include/oneapi/dpl/pstl/glue_algorithm_ranges_defs.h index 0ce4dcc804..d953785fb4 100644 --- a/include/oneapi/dpl/pstl/glue_algorithm_ranges_defs.h +++ b/include/oneapi/dpl/pstl/glue_algorithm_ranges_defs.h @@ -18,6 +18,7 @@ #include "../functional" #include "execution_defs.h" +#include "utils_ranges.h" namespace oneapi { diff --git a/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h b/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h index 93b2b5b2a0..7cd5a4422f 100644 --- a/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h +++ b/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h @@ -22,9 +22,11 @@ # include # include # include -# include //to use std::ranges::sort, std::ranges::stable_sort +# include // std::ranges::sort, std::ranges::stable_sort #endif +#include "utils_ranges.h" // __difference_t + #include "execution_defs.h" #include "oneapi/dpl/pstl/ranges_defs.h" diff --git a/include/oneapi/dpl/pstl/glue_numeric_ranges_defs.h b/include/oneapi/dpl/pstl/glue_numeric_ranges_defs.h index f2f6ae44a2..666a1052a7 100644 --- a/include/oneapi/dpl/pstl/glue_numeric_ranges_defs.h +++ b/include/oneapi/dpl/pstl/glue_numeric_ranges_defs.h @@ -17,6 +17,7 @@ #define _ONEDPL_GLUE_NUMERIC_RANGES_DEFS_H #include "execution_defs.h" +#include "utils_ranges.h" namespace oneapi { diff --git a/include/oneapi/dpl/pstl/glue_numeric_ranges_impl.h b/include/oneapi/dpl/pstl/glue_numeric_ranges_impl.h index d6238f5c26..c2d1b29503 100644 --- a/include/oneapi/dpl/pstl/glue_numeric_ranges_impl.h +++ b/include/oneapi/dpl/pstl/glue_numeric_ranges_impl.h @@ -17,6 +17,7 @@ #define _ONEDPL_GLUE_NUMERIC_RANGES_IMPL_H #include "execution_defs.h" +#include "utils_ranges.h" #include "glue_numeric_defs.h" #if _ONEDPL_HETERO_BACKEND diff --git a/include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h b/include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h index 55dddfb8fe..08b185266b 100644 --- a/include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h +++ b/include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h @@ -20,6 +20,7 @@ #include "../algorithm_fwd.h" #include "../parallel_backend.h" +#include "../utils_ranges.h" #include "utils_hetero.h" #if _ONEDPL_BACKEND_SYCL diff --git a/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h b/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h index ac7983653d..b9cd154a04 100644 --- a/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h +++ b/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h @@ -18,6 +18,7 @@ #include "../algorithm_fwd.h" #include "../parallel_backend.h" +#include "../utils_ranges.h" #include "utils_hetero.h" #if _ONEDPL_BACKEND_SYCL diff --git a/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge_sort.h b/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge_sort.h index 19a4f25b88..23c3442959 100644 --- a/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge_sort.h +++ b/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge_sort.h @@ -25,6 +25,7 @@ #include "sycl_defs.h" // __dpl_sycl::__local_accessor, __dpl_sycl::__group_barrier #include "../../utils.h" // __dpl_bit_floor, __dpl_bit_ceil +#include "../../utils_ranges.h" // __difference_t #include "parallel_backend_sycl_merge.h" // __find_start_point, __serial_merge namespace oneapi diff --git a/include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h b/include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h index 1c7d16ea18..15ba89712c 100644 --- a/include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h +++ b/include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h @@ -24,6 +24,8 @@ # include "dpcpp/unseq_backend_sycl.h" #endif +#include "../utils_ranges.h" + namespace oneapi { namespace dpl diff --git a/include/oneapi/dpl/pstl/utils_ranges.h b/include/oneapi/dpl/pstl/utils_ranges.h index 5a2bc3650f..8676f039b0 100644 --- a/include/oneapi/dpl/pstl/utils_ranges.h +++ b/include/oneapi/dpl/pstl/utils_ranges.h @@ -21,7 +21,6 @@ #include "iterator_defs.h" #include "iterator_impl.h" -#include "execution_defs.h" // __internal::__difference_t namespace oneapi { @@ -92,6 +91,21 @@ using __range_size_t = typename __range_size<_R>::type; #endif //_ONEDPL_CPP20_RANGES_PRESENT +template +auto +__check_size(int) -> decltype(std::declval<_R&>().size()); + +template +auto +__check_size(long) -> decltype(std::declval<_R&>().get_count()); + +template +auto +__check_size(...) -> typename std::iterator_traits<_It>::difference_type; + +template +using __difference_t = std::make_signed_t(0))>; + } //namespace __internal namespace __ranges