Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/execution is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_EXECUTION
0011 #define _LIBCPP_EXECUTION
0012 
0013 /*
0014 namespace std::execution {
0015   struct sequenced_policy;
0016   struct parallel_policy;
0017   struct parallel_unsequenced_policy;
0018   struct unsequenced_policy; // since C++20
0019 
0020   inline constexpr sequenced_policy seq = implementation-defined;
0021   inline constexpr parallel_policy par = implementation-defined;
0022   inline constexpr parallel_unsequenced_policy par_unseq = implementation-defined;
0023   inline constexpr unsequenced_policy unseq = implementation-defined; // since C++20
0024 }
0025 
0026 namespace std {
0027   template <class T>
0028   struct is_execution_policy;
0029 
0030   template <class T>
0031   inline constexpr bool is_execution_policy_v;
0032 }
0033 */
0034 
0035 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0036 #  include <__cxx03/execution>
0037 #else
0038 #  include <__config>
0039 #  include <__type_traits/is_execution_policy.h>
0040 #  include <__type_traits/is_same.h>
0041 #  include <__type_traits/remove_cvref.h>
0042 #  include <version>
0043 
0044 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0045 #    pragma GCC system_header
0046 #  endif
0047 
0048 #  if _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
0049 
0050 _LIBCPP_BEGIN_NAMESPACE_STD
0051 
0052 namespace execution {
0053 struct sequenced_policy {
0054   _LIBCPP_HIDE_FROM_ABI constexpr explicit sequenced_policy(__disable_user_instantiations_tag) {}
0055   sequenced_policy(const sequenced_policy&)            = delete;
0056   sequenced_policy& operator=(const sequenced_policy&) = delete;
0057 };
0058 
0059 inline constexpr sequenced_policy seq{__disable_user_instantiations_tag{}};
0060 
0061 struct parallel_policy {
0062   _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_policy(__disable_user_instantiations_tag) {}
0063   parallel_policy(const parallel_policy&)            = delete;
0064   parallel_policy& operator=(const parallel_policy&) = delete;
0065 };
0066 
0067 inline constexpr parallel_policy par{__disable_user_instantiations_tag{}};
0068 
0069 struct parallel_unsequenced_policy {
0070   _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_unsequenced_policy(__disable_user_instantiations_tag) {}
0071   parallel_unsequenced_policy(const parallel_unsequenced_policy&)            = delete;
0072   parallel_unsequenced_policy& operator=(const parallel_unsequenced_policy&) = delete;
0073 };
0074 
0075 inline constexpr parallel_unsequenced_policy par_unseq{__disable_user_instantiations_tag{}};
0076 
0077 struct __unsequenced_policy {
0078   _LIBCPP_HIDE_FROM_ABI constexpr explicit __unsequenced_policy(__disable_user_instantiations_tag) {}
0079   __unsequenced_policy(const __unsequenced_policy&)            = delete;
0080   __unsequenced_policy& operator=(const __unsequenced_policy&) = delete;
0081 };
0082 
0083 constexpr __unsequenced_policy __unseq{__disable_user_instantiations_tag{}};
0084 
0085 #    if _LIBCPP_STD_VER >= 20
0086 
0087 struct unsequenced_policy {
0088   _LIBCPP_HIDE_FROM_ABI constexpr explicit unsequenced_policy(__disable_user_instantiations_tag) {}
0089   unsequenced_policy(const unsequenced_policy&)            = delete;
0090   unsequenced_policy& operator=(const unsequenced_policy&) = delete;
0091 };
0092 
0093 inline constexpr unsequenced_policy unseq{__disable_user_instantiations_tag{}};
0094 
0095 #    endif // _LIBCPP_STD_VER >= 20
0096 
0097 } // namespace execution
0098 
0099 _LIBCPP_DIAGNOSTIC_PUSH
0100 #    if __has_warning("-Winvalid-specialization")
0101 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
0102 #    endif
0103 template <>
0104 inline constexpr bool is_execution_policy_v<execution::sequenced_policy> = true;
0105 
0106 template <>
0107 inline constexpr bool is_execution_policy_v<execution::parallel_policy> = true;
0108 
0109 template <>
0110 inline constexpr bool is_execution_policy_v<execution::parallel_unsequenced_policy> = true;
0111 
0112 template <>
0113 inline constexpr bool is_execution_policy_v<execution::__unsequenced_policy> = true;
0114 _LIBCPP_DIAGNOSTIC_POP
0115 
0116 template <>
0117 inline constexpr bool __is_parallel_execution_policy_impl<execution::parallel_policy> = true;
0118 
0119 template <>
0120 inline constexpr bool __is_parallel_execution_policy_impl<execution::parallel_unsequenced_policy> = true;
0121 
0122 template <>
0123 inline constexpr bool __is_unsequenced_execution_policy_impl<execution::__unsequenced_policy> = true;
0124 
0125 template <>
0126 inline constexpr bool __is_unsequenced_execution_policy_impl<execution::parallel_unsequenced_policy> = true;
0127 
0128 #    if _LIBCPP_STD_VER >= 20
0129 _LIBCPP_DIAGNOSTIC_PUSH
0130 #      if __has_warning("-Winvalid-specialization")
0131 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
0132 #      endif
0133 template <>
0134 inline constexpr bool is_execution_policy_v<execution::unsequenced_policy> = true;
0135 _LIBCPP_DIAGNOSTIC_POP
0136 
0137 template <>
0138 inline constexpr bool __is_unsequenced_execution_policy_impl<execution::unsequenced_policy> = true;
0139 
0140 #    endif
0141 
0142 template <class _Tp>
0143 struct _LIBCPP_NO_SPECIALIZATIONS is_execution_policy : bool_constant<is_execution_policy_v<_Tp>> {};
0144 
0145 template <class _ExecutionPolicy>
0146 _LIBCPP_HIDE_FROM_ABI auto __remove_parallel_policy(const _ExecutionPolicy&) {
0147   if constexpr (is_same_v<_ExecutionPolicy, execution::parallel_policy>) {
0148     return execution::sequenced_policy(execution::__disable_user_instantiations_tag{});
0149   } else if constexpr (is_same_v<_ExecutionPolicy, execution::parallel_unsequenced_policy>) {
0150     return execution::__unsequenced_policy{execution::__disable_user_instantiations_tag{}};
0151   }
0152 }
0153 
0154 _LIBCPP_END_NAMESPACE_STD
0155 
0156 #  endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
0157 
0158 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0159 #    include <cstddef>
0160 #  endif
0161 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0162 
0163 #endif // _LIBCPP_EXECUTION