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___TYPE_TRAITS_IS_EXECUTION_POLICY_H 10 #define _LIBCPP___TYPE_TRAITS_IS_EXECUTION_POLICY_H 11 12 #include <__config> 13 #include <__type_traits/remove_cvref.h> 14 15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 16 # pragma GCC system_header 17 #endif 18 19 #if _LIBCPP_STD_VER >= 17 20 21 _LIBCPP_BEGIN_NAMESPACE_STD 22 23 template <class> 24 inline constexpr bool is_execution_policy_v = false; 25 26 template <class> 27 inline constexpr bool __is_unsequenced_execution_policy_impl = false; 28 29 template <class _Tp> 30 inline constexpr bool __is_unsequenced_execution_policy_v = 31 __is_unsequenced_execution_policy_impl<__remove_cvref_t<_Tp>>; 32 33 template <class> 34 inline constexpr bool __is_parallel_execution_policy_impl = false; 35 36 template <class _Tp> 37 inline constexpr bool __is_parallel_execution_policy_v = __is_parallel_execution_policy_impl<__remove_cvref_t<_Tp>>; 38 39 namespace execution { 40 struct __disable_user_instantiations_tag { 41 explicit __disable_user_instantiations_tag() = default; 42 }; 43 } // namespace execution 44 45 // TODO: Remove default argument once algorithms are using the new backend dispatching 46 template <class _ExecutionPolicy> 47 _LIBCPP_HIDE_FROM_ABI auto 48 __remove_parallel_policy(const _ExecutionPolicy& = _ExecutionPolicy{execution::__disable_user_instantiations_tag{}}); 49 50 // Removes the "parallel" part of an execution policy. 51 // For example, turns par_unseq into unseq, and par into seq. 52 template <class _ExecutionPolicy> 53 using __remove_parallel_policy_t = decltype(std::__remove_parallel_policy<_ExecutionPolicy>()); 54 55 _LIBCPP_END_NAMESPACE_STD 56 57 #endif // _LIBCPP_STD_VER >= 17 58 59 #endif // _LIBCPP___TYPE_TRAITS_IS_EXECUTION_POLICY_H 60