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___EXECUTION_IS_EXECUTION_POLICY_H
10#define _LIBCPP___EXECUTION_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
23template <class>
24_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_execution_policy_v = false;
25
26template <class>
27inline constexpr bool __is_unsequenced_execution_policy_impl = false;
28
29template <class _Tp>
30inline constexpr bool __is_unsequenced_execution_policy_v =
31 __is_unsequenced_execution_policy_impl<__remove_cvref_t<_Tp>>;
32
33template <class>
34inline constexpr bool __is_parallel_execution_policy_impl = false;
35
36template <class _Tp>
37inline constexpr bool __is_parallel_execution_policy_v = __is_parallel_execution_policy_impl<__remove_cvref_t<_Tp>>;
38
39namespace execution {
40struct __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
46template <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.
52template <class _ExecutionPolicy>
53using __remove_parallel_policy_t _LIBCPP_NODEBUG = decltype(std::__remove_parallel_policy<_ExecutionPolicy>());
54
55_LIBCPP_END_NAMESPACE_STD
56
57#endif // _LIBCPP_STD_VER >= 17
58
59#endif // _LIBCPP___EXECUTION_IS_EXECUTION_POLICY_H
60