Skip to content

Commit

Permalink
[oneDPL][ranges] + fix for std::ranges::sort using (windows); + _ONED…
Browse files Browse the repository at this point in the history
…PL_STD_RANGES_WINDOWS_NON_GLOBAL_FUN_OBJ
  • Loading branch information
MikeDvorskiy committed Oct 7, 2024
1 parent 2be9d5f commit 64688b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,13 @@ 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, std::ranges::stable_sort);
std::forward<_ExecutionPolicy>(__exec), std::forward<_R>(__r), __comp, __proj,
#if _ONEDPL_STD_RANGES_FUN_OBJ_WINDOWS_BROKEN
[](auto&&... __args) { std::ranges::stable_sort(std::forward<decltype(__args)>(__args)...); }
#else
std::ranges::stable_sort
#endif
);
}
}; //__stable_sort_fn
} //__internal
Expand All @@ -443,7 +449,13 @@ 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, std::ranges::sort);
std::forward<_ExecutionPolicy>(__exec), std::forward<_R>(__r), __comp, __proj,
#if _ONEDPL_STD_RANGES_FUN_OBJ_WINDOWS_BROKEN
[](auto&&... __args) { std::ranges::sort(std::forward<decltype(__args)>(__args)...); }
#else
std::ranges::sort
#endif
);
}
}; //__sort_fn
} //__internal
Expand Down
7 changes: 7 additions & 0 deletions include/oneapi/dpl/pstl/onedpl_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,11 @@
# define _ONEDPL_STD_BIT_FLOOR_BROKEN 0
#endif
// The implementation of std::ranges algorithms in MS C++ standard library does not meet the C++ standard requirements.
#if defined(_MSC_VER) && (_MSC_VER < 1939)
# define _ONEDPL_STD_RANGES_FUN_OBJ_WINDOWS_BROKEN 1
#else
# define _ONEDPL_STD_RANGES_FUN_OBJ_WINDOWS_BROKEN 0
#endif
#endif // _ONEDPL_CONFIG_H

0 comments on commit 64688b1

Please sign in to comment.