|
|
|||
File indexing completed on 2026-05-03 08:13:59
0001 //===----------------------------------------------------------------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef _LIBCPP___PSTL_BACKEND_FWD_H 0010 #define _LIBCPP___PSTL_BACKEND_FWD_H 0011 0012 #include <__config> 0013 0014 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 0015 # pragma GCC system_header 0016 #endif 0017 0018 _LIBCPP_PUSH_MACROS 0019 #include <__undef_macros> 0020 0021 // 0022 // This header declares available PSTL backends and the functions that must be implemented in order for the 0023 // PSTL algorithms to be provided. 0024 // 0025 // Backends often do not implement the full set of functions themselves -- a configuration of the PSTL is 0026 // usually a set of backends "stacked" together which each implement some algorithms under some execution 0027 // policies. It is only necessary for the "stack" of backends to implement all algorithms under all execution 0028 // policies, but a single backend is not required to implement everything on its own. 0029 // 0030 // The signatures used by each backend function are documented below. 0031 // 0032 // Exception handling 0033 // ================== 0034 // 0035 // PSTL backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from 0036 // their implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions 0037 // are turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the 0038 // frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to 0039 // the user. 0040 // 0041 0042 #if _LIBCPP_STD_VER >= 17 0043 0044 _LIBCPP_BEGIN_NAMESPACE_STD 0045 namespace __pstl { 0046 0047 template <class... _Backends> 0048 struct __backend_configuration; 0049 0050 struct __default_backend_tag; 0051 struct __libdispatch_backend_tag; 0052 struct __serial_backend_tag; 0053 struct __std_thread_backend_tag; 0054 0055 # if defined(_LIBCPP_PSTL_BACKEND_SERIAL) 0056 using __current_configuration _LIBCPP_NODEBUG = __backend_configuration<__serial_backend_tag, __default_backend_tag>; 0057 # elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) 0058 using __current_configuration _LIBCPP_NODEBUG = 0059 __backend_configuration<__std_thread_backend_tag, __default_backend_tag>; 0060 # elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH) 0061 using __current_configuration _LIBCPP_NODEBUG = 0062 __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>; 0063 # else 0064 0065 // ...New vendors can add parallel backends here... 0066 0067 # error "Invalid PSTL backend configuration" 0068 # endif 0069 0070 template <class _Backend, class _ExecutionPolicy> 0071 struct __find_if; 0072 // template <class _Policy, class _ForwardIterator, class _Predicate> 0073 // optional<_ForwardIterator> 0074 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0075 0076 template <class _Backend, class _ExecutionPolicy> 0077 struct __find_if_not; 0078 // template <class _Policy, class _ForwardIterator, class _Predicate> 0079 // optional<_ForwardIterator> 0080 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0081 0082 template <class _Backend, class _ExecutionPolicy> 0083 struct __find; 0084 // template <class _Policy, class _ForwardIterator, class _Tp> 0085 // optional<_ForwardIterator> 0086 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept; 0087 0088 template <class _Backend, class _ExecutionPolicy> 0089 struct __any_of; 0090 // template <class _Policy, class _ForwardIterator, class _Predicate> 0091 // optional<bool> 0092 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0093 0094 template <class _Backend, class _ExecutionPolicy> 0095 struct __all_of; 0096 // template <class _Policy, class _ForwardIterator, class _Predicate> 0097 // optional<bool> 0098 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0099 0100 template <class _Backend, class _ExecutionPolicy> 0101 struct __none_of; 0102 // template <class _Policy, class _ForwardIterator, class _Predicate> 0103 // optional<bool> 0104 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0105 0106 template <class _Backend, class _ExecutionPolicy> 0107 struct __is_partitioned; 0108 // template <class _Policy, class _ForwardIterator, class _Predicate> 0109 // optional<bool> 0110 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0111 0112 template <class _Backend, class _ExecutionPolicy> 0113 struct __for_each; 0114 // template <class _Policy, class _ForwardIterator, class _Function> 0115 // optional<__empty> 0116 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept; 0117 0118 template <class _Backend, class _ExecutionPolicy> 0119 struct __for_each_n; 0120 // template <class _Policy, class _ForwardIterator, class _Size, class _Function> 0121 // optional<__empty> 0122 // operator()(_Policy&&, _ForwardIterator __first, _Size __size, _Function __func) const noexcept; 0123 0124 template <class _Backend, class _ExecutionPolicy> 0125 struct __fill; 0126 // template <class _Policy, class _ForwardIterator, class _Tp> 0127 // optional<__empty> 0128 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept; 0129 0130 template <class _Backend, class _ExecutionPolicy> 0131 struct __fill_n; 0132 // template <class _Policy, class _ForwardIterator, class _Size, class _Tp> 0133 // optional<__empty> 0134 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept; 0135 0136 template <class _Backend, class _ExecutionPolicy> 0137 struct __replace; 0138 // template <class _Policy, class _ForwardIterator, class _Tp> 0139 // optional<__empty> 0140 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0141 // _Tp const& __old, _Tp const& __new) const noexcept; 0142 0143 template <class _Backend, class _ExecutionPolicy> 0144 struct __replace_if; 0145 // template <class _Policy, class _ForwardIterator, class _Predicate, class _Tp> 0146 // optional<__empty> 0147 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0148 // _Predicate __pred, _Tp const& __new_value) const noexcept; 0149 0150 template <class _Backend, class _ExecutionPolicy> 0151 struct __generate; 0152 // template <class _Policy, class _ForwardIterator, class _Generator> 0153 // optional<__empty> 0154 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) const noexcept; 0155 0156 template <class _Backend, class _ExecutionPolicy> 0157 struct __generate_n; 0158 // template <class _Policy, class _ForwardIterator, class _Size, class _Generator> 0159 // optional<__empty> 0160 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept; 0161 0162 template <class _Backend, class _ExecutionPolicy> 0163 struct __merge; 0164 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp> 0165 // optional<_ForwardOutIterator> 0166 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, 0167 // _ForwardIterator2 __first2, _ForwardIterator2 __last2, 0168 // _ForwardOutIterator __result, _Comp __comp) const noexcept; 0169 0170 template <class _Backend, class _ExecutionPolicy> 0171 struct __stable_sort; 0172 // template <class _Policy, class _RandomAccessIterator, class _Comp> 0173 // optional<__empty> 0174 // operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept; 0175 0176 template <class _Backend, class _ExecutionPolicy> 0177 struct __sort; 0178 // template <class _Policy, class _RandomAccessIterator, class _Comp> 0179 // optional<__empty> 0180 // operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept; 0181 0182 template <class _Backend, class _ExecutionPolicy> 0183 struct __transform; 0184 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation> 0185 // optional<_ForwardOutIterator> 0186 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0187 // _ForwardOutIterator __result, 0188 // _UnaryOperation __op) const noexcept; 0189 0190 template <class _Backend, class _ExecutionPolicy> 0191 struct __transform_binary; 0192 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, 0193 // class _ForwardOutIterator, 0194 // class _BinaryOperation> 0195 // optional<_ForwardOutIterator> 0196 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, 0197 // _ForwardIterator2 __first2, 0198 // _ForwardOutIterator __result, 0199 // _BinaryOperation __op) const noexcept; 0200 0201 template <class _Backend, class _ExecutionPolicy> 0202 struct __replace_copy_if; 0203 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Predicate, class _Tp> 0204 // optional<__empty> 0205 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0206 // _ForwardOutIterator __out_it, 0207 // _Predicate __pred, 0208 // _Tp const& __new_value) const noexcept; 0209 0210 template <class _Backend, class _ExecutionPolicy> 0211 struct __replace_copy; 0212 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp> 0213 // optional<__empty> 0214 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0215 // _ForwardOutIterator __out_it, 0216 // _Tp const& __old_value, 0217 // _Tp const& __new_value) const noexcept; 0218 0219 template <class _Backend, class _ExecutionPolicy> 0220 struct __move; 0221 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator> 0222 // optional<_ForwardOutIterator> 0223 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0224 // _ForwardOutIterator __out_it) const noexcept; 0225 0226 template <class _Backend, class _ExecutionPolicy> 0227 struct __copy; 0228 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator> 0229 // optional<_ForwardOutIterator> 0230 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0231 // _ForwardOutIterator __out_it) const noexcept; 0232 0233 template <class _Backend, class _ExecutionPolicy> 0234 struct __copy_n; 0235 // template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator> 0236 // optional<_ForwardOutIterator> 0237 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept; 0238 0239 template <class _Backend, class _ExecutionPolicy> 0240 struct __rotate_copy; 0241 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator> 0242 // optional<_ForwardOutIterator> 0243 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, 0244 // _ForwardOutIterator __out_it) const noexcept; 0245 0246 template <class _Backend, class _ExecutionPolicy> 0247 struct __transform_reduce; 0248 // template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation> 0249 // optional<_Tp> 0250 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0251 // _Tp __init, 0252 // _BinaryOperation __reduce, 0253 // _UnaryOperation __transform) const noexcept; 0254 0255 template <class _Backend, class _ExecutionPolicy> 0256 struct __transform_reduce_binary; 0257 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, 0258 // class _Tp, class _BinaryOperation1, class _BinaryOperation2> 0259 // optional<_Tp> operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, 0260 // _ForwardIterator2 __first2, 0261 // _Tp __init, 0262 // _BinaryOperation1 __reduce, 0263 // _BinaryOperation2 __transform) const noexcept; 0264 0265 template <class _Backend, class _ExecutionPolicy> 0266 struct __count_if; 0267 // template <class _Policy, class _ForwardIterator, class _Predicate> 0268 // optional<__iter_diff_t<_ForwardIterator>> 0269 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept; 0270 0271 template <class _Backend, class _ExecutionPolicy> 0272 struct __count; 0273 // template <class _Policy, class _ForwardIterator, class _Tp> 0274 // optional<__iter_diff_t<_ForwardIterator>> 0275 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept; 0276 0277 template <class _Backend, class _ExecutionPolicy> 0278 struct __equal_3leg; 0279 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate> 0280 // optional<bool> 0281 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, 0282 // _ForwardIterator2 __first2, 0283 // _Predicate __pred) const noexcept; 0284 0285 template <class _Backend, class _ExecutionPolicy> 0286 struct __equal; 0287 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate> 0288 // optional<bool> 0289 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, 0290 // _ForwardIterator2 __first2, _ForwardIterator2 __last2, 0291 // _Predicate __pred) const noexcept; 0292 0293 template <class _Backend, class _ExecutionPolicy> 0294 struct __reduce; 0295 // template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation> 0296 // optional<_Tp> 0297 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, 0298 // _Tp __init, _BinaryOperation __op) const noexcept; 0299 0300 } // namespace __pstl 0301 _LIBCPP_END_NAMESPACE_STD 0302 0303 #endif // _LIBCPP_STD_VER >= 17 0304 0305 _LIBCPP_POP_MACROS 0306 0307 #endif // _LIBCPP___PSTL_BACKEND_FWD_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|