[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __pstl / backend_fwd.h
blob2132e8dbceb3ad2c17be02890933414e884986e8
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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___PSTL_BACKEND_FWD_H
10 #define _LIBCPP___PSTL_BACKEND_FWD_H
12 #include <__config>
14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15 # pragma GCC system_header
16 #endif
18 _LIBCPP_PUSH_MACROS
19 #include <__undef_macros>
22 // This header declares available PSTL backends and the functions that must be implemented in order for the
23 // PSTL algorithms to be provided.
25 // Backends often do not implement the full set of functions themselves -- a configuration of the PSTL is
26 // usually a set of backends "stacked" together which each implement some algorithms under some execution
27 // policies. It is only necessary for the "stack" of backends to implement all algorithms under all execution
28 // policies, but a single backend is not required to implement everything on its own.
30 // The signatures used by each backend function are documented below.
32 // Exception handling
33 // ==================
35 // PSTL backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from
36 // their implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions
37 // are turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
38 // frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
39 // the user.
42 #if _LIBCPP_STD_VER >= 17
44 _LIBCPP_BEGIN_NAMESPACE_STD
45 namespace __pstl {
47 template <class... _Backends>
48 struct __backend_configuration;
50 struct __default_backend_tag;
51 struct __libdispatch_backend_tag;
52 struct __serial_backend_tag;
53 struct __std_thread_backend_tag;
55 # if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
56 using __current_configuration = __backend_configuration<__serial_backend_tag, __default_backend_tag>;
57 # elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
58 using __current_configuration = __backend_configuration<__std_thread_backend_tag, __default_backend_tag>;
59 # elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
60 using __current_configuration = __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>;
61 # else
63 // ...New vendors can add parallel backends here...
65 # error "Invalid PSTL backend configuration"
66 # endif
68 template <class _Backend, class _ExecutionPolicy>
69 struct __find_if;
70 // template <class _Policy, class _ForwardIterator, class _Predicate>
71 // optional<_ForwardIterator>
72 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
74 template <class _Backend, class _ExecutionPolicy>
75 struct __find_if_not;
76 // template <class _Policy, class _ForwardIterator, class _Predicate>
77 // optional<_ForwardIterator>
78 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
80 template <class _Backend, class _ExecutionPolicy>
81 struct __find;
82 // template <class _Policy, class _ForwardIterator, class _Tp>
83 // optional<_ForwardIterator>
84 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept;
86 template <class _Backend, class _ExecutionPolicy>
87 struct __any_of;
88 // template <class _Policy, class _ForwardIterator, class _Predicate>
89 // optional<bool>
90 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
92 template <class _Backend, class _ExecutionPolicy>
93 struct __all_of;
94 // template <class _Policy, class _ForwardIterator, class _Predicate>
95 // optional<bool>
96 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
98 template <class _Backend, class _ExecutionPolicy>
99 struct __none_of;
100 // template <class _Policy, class _ForwardIterator, class _Predicate>
101 // optional<bool>
102 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
104 template <class _Backend, class _ExecutionPolicy>
105 struct __is_partitioned;
106 // template <class _Policy, class _ForwardIterator, class _Predicate>
107 // optional<bool>
108 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
110 template <class _Backend, class _ExecutionPolicy>
111 struct __for_each;
112 // template <class _Policy, class _ForwardIterator, class _Function>
113 // optional<__empty>
114 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept;
116 template <class _Backend, class _ExecutionPolicy>
117 struct __for_each_n;
118 // template <class _Policy, class _ForwardIterator, class _Size, class _Function>
119 // optional<__empty>
120 // operator()(_Policy&&, _ForwardIterator __first, _Size __size, _Function __func) const noexcept;
122 template <class _Backend, class _ExecutionPolicy>
123 struct __fill;
124 // template <class _Policy, class _ForwardIterator, class _Tp>
125 // optional<__empty>
126 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
128 template <class _Backend, class _ExecutionPolicy>
129 struct __fill_n;
130 // template <class _Policy, class _ForwardIterator, class _Size, class _Tp>
131 // optional<__empty>
132 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept;
134 template <class _Backend, class _ExecutionPolicy>
135 struct __replace;
136 // template <class _Policy, class _ForwardIterator, class _Tp>
137 // optional<__empty>
138 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
139 // _Tp const& __old, _Tp const& __new) const noexcept;
141 template <class _Backend, class _ExecutionPolicy>
142 struct __replace_if;
143 // template <class _Policy, class _ForwardIterator, class _Predicate, class _Tp>
144 // optional<__empty>
145 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
146 // _Predicate __pred, _Tp const& __new_value) const noexcept;
148 template <class _Backend, class _ExecutionPolicy>
149 struct __generate;
150 // template <class _Policy, class _ForwardIterator, class _Generator>
151 // optional<__empty>
152 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) const noexcept;
154 template <class _Backend, class _ExecutionPolicy>
155 struct __generate_n;
156 // template <class _Policy, class _ForwardIterator, class _Size, class _Generator>
157 // optional<__empty>
158 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept;
160 template <class _Backend, class _ExecutionPolicy>
161 struct __merge;
162 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
163 // optional<_ForwardOutIterator>
164 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
165 // _ForwardIterator2 __first2, _ForwardIterator2 __last2,
166 // _ForwardOutIterator __result, _Comp __comp) const noexcept;
168 template <class _Backend, class _ExecutionPolicy>
169 struct __stable_sort;
170 // template <class _Policy, class _RandomAccessIterator, class _Comp>
171 // optional<__empty>
172 // operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
174 template <class _Backend, class _ExecutionPolicy>
175 struct __sort;
176 // template <class _Policy, class _RandomAccessIterator, class _Comp>
177 // optional<__empty>
178 // operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
180 template <class _Backend, class _ExecutionPolicy>
181 struct __transform;
182 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
183 // optional<_ForwardOutIterator>
184 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
185 // _ForwardOutIterator __result,
186 // _UnaryOperation __op) const noexcept;
188 template <class _Backend, class _ExecutionPolicy>
189 struct __transform_binary;
190 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
191 // class _ForwardOutIterator,
192 // class _BinaryOperation>
193 // optional<_ForwardOutIterator>
194 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
195 // _ForwardIterator2 __first2,
196 // _ForwardOutIterator __result,
197 // _BinaryOperation __op) const noexcept;
199 template <class _Backend, class _ExecutionPolicy>
200 struct __replace_copy_if;
201 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Predicate, class _Tp>
202 // optional<__empty>
203 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
204 // _ForwardOutIterator __out_it,
205 // _Predicate __pred,
206 // _Tp const& __new_value) const noexcept;
208 template <class _Backend, class _ExecutionPolicy>
209 struct __replace_copy;
210 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp>
211 // optional<__empty>
212 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
213 // _ForwardOutIterator __out_it,
214 // _Tp const& __old_value,
215 // _Tp const& __new_value) const noexcept;
217 template <class _Backend, class _ExecutionPolicy>
218 struct __move;
219 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
220 // optional<_ForwardOutIterator>
221 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
222 // _ForwardOutIterator __out_it) const noexcept;
224 template <class _Backend, class _ExecutionPolicy>
225 struct __copy;
226 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
227 // optional<_ForwardOutIterator>
228 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
229 // _ForwardOutIterator __out_it) const noexcept;
231 template <class _Backend, class _ExecutionPolicy>
232 struct __copy_n;
233 // template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator>
234 // optional<_ForwardOutIterator>
235 // operator()(_Policy&&, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept;
237 template <class _Backend, class _ExecutionPolicy>
238 struct __rotate_copy;
239 // template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
240 // optional<_ForwardOutIterator>
241 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
242 // _ForwardOutIterator __out_it) const noexcept;
244 template <class _Backend, class _ExecutionPolicy>
245 struct __transform_reduce;
246 // template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
247 // optional<_Tp>
248 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
249 // _Tp __init,
250 // _BinaryOperation __reduce,
251 // _UnaryOperation __transform) const noexcept;
253 template <class _Backend, class _ExecutionPolicy>
254 struct __transform_reduce_binary;
255 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
256 // class _Tp, class _BinaryOperation1, class _BinaryOperation2>
257 // optional<_Tp> operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
258 // _ForwardIterator2 __first2,
259 // _Tp __init,
260 // _BinaryOperation1 __reduce,
261 // _BinaryOperation2 __transform) const noexcept;
263 template <class _Backend, class _ExecutionPolicy>
264 struct __count_if;
265 // template <class _Policy, class _ForwardIterator, class _Predicate>
266 // optional<__iter_diff_t<_ForwardIterator>>
267 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
269 template <class _Backend, class _ExecutionPolicy>
270 struct __count;
271 // template <class _Policy, class _ForwardIterator, class _Tp>
272 // optional<__iter_diff_t<_ForwardIterator>>
273 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
275 template <class _Backend, class _ExecutionPolicy>
276 struct __equal_3leg;
277 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
278 // optional<bool>
279 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
280 // _ForwardIterator2 __first2,
281 // _Predicate __pred) const noexcept;
283 template <class _Backend, class _ExecutionPolicy>
284 struct __equal;
285 // template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
286 // optional<bool>
287 // operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
288 // _ForwardIterator2 __first2, _ForwardIterator2 __last2,
289 // _Predicate __pred) const noexcept;
291 template <class _Backend, class _ExecutionPolicy>
292 struct __reduce;
293 // template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation>
294 // optional<_Tp>
295 // operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
296 // _Tp __init, _BinaryOperation __op) const noexcept;
298 } // namespace __pstl
299 _LIBCPP_END_NAMESPACE_STD
301 #endif // _LIBCPP_STD_VER >= 17
303 _LIBCPP_POP_MACROS
305 #endif // _LIBCPP___PSTL_BACKEND_FWD_H