diff --git a/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h b/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h index f105396a041..50dda766267 100644 --- a/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h +++ b/include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h @@ -426,11 +426,7 @@ struct __stable_sort_fn const auto __dispatch_tag = oneapi::dpl::__ranges::__select_backend(__exec); return oneapi::dpl::__internal::__ranges::__pattern_sort_ranges(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), std::forward<_R>(__r), __comp, __proj, -#if _ONEDPL_STD_RANGES_ALGO_CPP_FUN - [](auto&&... __args) { return std::ranges::stable_sort(std::forward(__args)...); } -#else - std::ranges::stable_sort -#endif + _ONEDPL_ALGO(std::ranges::stable_sort) ); } }; //__stable_sort_fn @@ -452,11 +448,7 @@ struct __sort_fn const auto __dispatch_tag = oneapi::dpl::__ranges::__select_backend(__exec); return oneapi::dpl::__internal::__ranges::__pattern_sort_ranges(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), std::forward<_R>(__r), __comp, __proj, -#if _ONEDPL_STD_RANGES_ALGO_CPP_FUN - [](auto&&... __args) { return std::ranges::sort(std::forward(__args)...); } -#else - std::ranges::sort -#endif + _ONEDPL_ALGO(std::ranges::sort) ); } }; //__sort_fn diff --git a/include/oneapi/dpl/pstl/onedpl_config.h b/include/oneapi/dpl/pstl/onedpl_config.h index 2ef13c46f83..b2f5c6586ef 100644 --- a/include/oneapi/dpl/pstl/onedpl_config.h +++ b/include/oneapi/dpl/pstl/onedpl_config.h @@ -333,4 +333,11 @@ # define _ONEDPL_STD_RANGES_ALGO_CPP_FUN 0 #endif +#if _ONEDPL_STD_RANGES_ALGO_CPP_FUN +# define _ONEDPL_ALGO(std_algo_name) \ +[](auto&&... __args) { return std_algo_name(std::forward(__args)...); } +#else +# define _ONEDPL_ALGO(std_algo_name) std_algo_name +#endif + #endif // _ONEDPL_CONFIG_H