1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef _LIBCPP___ALGORITHM_PSTL_STABLE_SORT_H 10 #define _LIBCPP___ALGORITHM_PSTL_STABLE_SORT_H 11 12 #include <__algorithm/pstl_backend.h> 13 #include <__config> 14 #include <__functional/operations.h> 15 #include <__type_traits/enable_if.h> 16 #include <__type_traits/is_execution_policy.h> 17 #include <__type_traits/remove_cvref.h> 18 #include <__utility/move.h> 19 20 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 21 # pragma GCC system_header 22 #endif 23 24 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 25 26 _LIBCPP_BEGIN_NAMESPACE_STD 27 28 template <class _ExecutionPolicy, 29 class _RandomAccessIterator, 30 class _Comp = less<>, 31 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, 32 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> 33 _LIBCPP_HIDE_FROM_ABI void 34 stable_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp = {}) { 35 using _Backend = typename __select_backend<_RawPolicy>::type; 36 std::__pstl_stable_sort<_RawPolicy>(_Backend{}, std::move(__first), std::move(__last), std::move(__comp)); 37 } 38 39 _LIBCPP_END_NAMESPACE_STD 40 41 #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17 42 43 #endif // _LIBCPP___ALGORITHM_PSTL_STABLE_SORT_H 44