summaryrefslogtreecommitdiff
path: root/libcxx/include/__type_traits/is_execution_policy.h
blob: 6884f17ba16c88d48f82e644d66d3d4a42ed9f97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___TYPE_TRAITS_IS_EXECUTION_POLICY_H
#define _LIBCPP___TYPE_TRAITS_IS_EXECUTION_POLICY_H

#include <__config>
#include <__type_traits/remove_cvref.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

#if _LIBCPP_STD_VER >= 17

_LIBCPP_BEGIN_NAMESPACE_STD

template <class>
inline constexpr bool is_execution_policy_v = false;

template <class>
inline constexpr bool __is_unsequenced_execution_policy_impl = false;

template <class _Tp>
inline constexpr bool __is_unsequenced_execution_policy_v =
    __is_unsequenced_execution_policy_impl<__remove_cvref_t<_Tp>>;

template <class>
inline constexpr bool __is_parallel_execution_policy_impl = false;

template <class _Tp>
inline constexpr bool __is_parallel_execution_policy_v = __is_parallel_execution_policy_impl<__remove_cvref_t<_Tp>>;

namespace execution {
struct __disable_user_instantiations_tag {
  explicit __disable_user_instantiations_tag() = default;
};
} // namespace execution

// TODO: Remove default argument once algorithms are using the new backend dispatching
template <class _ExecutionPolicy>
_LIBCPP_HIDE_FROM_ABI auto
__remove_parallel_policy(const _ExecutionPolicy& = _ExecutionPolicy{execution::__disable_user_instantiations_tag{}});

// Removes the "parallel" part of an execution policy.
// For example, turns par_unseq into unseq, and par into seq.
template <class _ExecutionPolicy>
using __remove_parallel_policy_t = decltype(std::__remove_parallel_policy<_ExecutionPolicy>());

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP_STD_VER >= 17

#endif // _LIBCPP___TYPE_TRAITS_IS_EXECUTION_POLICY_H