1// -*- C++ -*-
2//===-- algorithm_fwd.h --------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _PSTL_ALGORITHM_FWD_H
11#define _PSTL_ALGORITHM_FWD_H
12
13#include <type_traits>
14#include <utility>
15
16namespace __pstl
17{
18namespace __internal
19{
20
21//------------------------------------------------------------------------
22// any_of
23//------------------------------------------------------------------------
24
25template <class _ForwardIterator, class _Pred>
26bool
27__brick_any_of(const _ForwardIterator, const _ForwardIterator, _Pred,
28 /*__is_vector=*/std::false_type) noexcept;
29
30template <class _ForwardIterator, class _Pred>
31bool
32__brick_any_of(const _ForwardIterator, const _ForwardIterator, _Pred,
33 /*__is_vector=*/std::true_type) noexcept;
34
35template <class _ExecutionPolicy, class _ForwardIterator, class _Pred, class _IsVector>
36bool
37__pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector,
38 /*parallel=*/std::false_type) noexcept;
39
40template <class _ExecutionPolicy, class _ForwardIterator, class _Pred, class _IsVector>
41bool
42__pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector,
43 /*parallel=*/std::true_type);
44
45//------------------------------------------------------------------------
46// walk1 (pseudo)
47//
48// walk1 evaluates f(x) for each dereferenced value x drawn from [first,last)
49//------------------------------------------------------------------------
50
51template <class _ForwardIterator, class _Function>
52void __brick_walk1(_ForwardIterator, _ForwardIterator, _Function,
53 /*vector=*/std::false_type) noexcept;
54
55template <class _RandomAccessIterator, class _Function>
56void __brick_walk1(_RandomAccessIterator, _RandomAccessIterator, _Function,
57 /*vector=*/std::true_type) noexcept;
58
59template <class _ExecutionPolicy, class _ForwardIterator, class _Function, class _IsVector>
60void
61__pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector,
62 /*parallel=*/std::false_type) noexcept;
63
64template <class _ExecutionPolicy, class _ForwardIterator, class _Function, class _IsVector>
65void
66__pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector,
67 /*parallel=*/std::true_type);
68
69template <class _ExecutionPolicy, class _ForwardIterator, class _Brick>
70void
71__pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick,
72 /*parallel=*/std::false_type) noexcept;
73
74template <class _ExecutionPolicy, class _ForwardIterator, class _Brick>
75void
76__pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick,
77 /*parallel=*/std::true_type);
78
79//------------------------------------------------------------------------
80// walk1_n
81//------------------------------------------------------------------------
82
83template <class _ForwardIterator, class _Size, class _Function>
84_ForwardIterator __brick_walk1_n(_ForwardIterator, _Size, _Function,
85 /*_IsVectorTag=*/std::false_type);
86
87template <class _RandomAccessIterator, class _DifferenceType, class _Function>
88_RandomAccessIterator __brick_walk1_n(_RandomAccessIterator, _DifferenceType, _Function,
89 /*vectorTag=*/std::true_type) noexcept;
90
91template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Function, class _IsVector>
92_ForwardIterator
93__pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Function, _IsVector,
94 /*is_parallel=*/std::false_type) noexcept;
95
96template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Function, class _IsVector>
97_RandomAccessIterator
98__pattern_walk1_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Function, _IsVector,
99 /*is_parallel=*/std::true_type);
100
101template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Brick>
102_ForwardIterator
103__pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Brick,
104 /*is_parallel=*/std::false_type) noexcept;
105
106template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Brick>
107_RandomAccessIterator
108__pattern_walk_brick_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Brick,
109 /*is_parallel=*/std::true_type);
110
111//------------------------------------------------------------------------
112// walk2 (pseudo)
113//
114// walk2 evaluates f(x,y) for deferenced values (x,y) drawn from [first1,last1) and [first2,...)
115//------------------------------------------------------------------------
116
117template <class _ForwardIterator1, class _ForwardIterator2, class _Function>
118_ForwardIterator2 __brick_walk2(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function,
119 /*vector=*/std::false_type) noexcept;
120
121template <class _ForwardIterator1, class _ForwardIterator2, class _Function>
122_ForwardIterator2 __brick_walk2(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function,
123 /*vector=*/std::true_type) noexcept;
124
125template <class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function>
126_ForwardIterator2 __brick_walk2_n(_ForwardIterator1, _Size, _ForwardIterator2, _Function,
127 /*vector=*/std::false_type) noexcept;
128
129template <class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function>
130_ForwardIterator2 __brick_walk2_n(_ForwardIterator1, _Size, _ForwardIterator2, _Function,
131 /*vector=*/std::true_type) noexcept;
132
133template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Function, class _IsVector>
134_ForwardIterator2
135__pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector,
136 /*parallel=*/std::false_type) noexcept;
137
138template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Function, class _IsVector>
139_ForwardIterator2
140__pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector,
141 /*parallel=*/std::true_type);
142
143template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function,
144 class _IsVector>
145_ForwardIterator2
146__pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Function, _IsVector,
147 /*parallel=*/std::false_type) noexcept;
148
149template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2,
150 class _Function, class _IsVector>
151_RandomAccessIterator2
152__pattern_walk2_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Function, _IsVector,
153 /*parallel=*/std::true_type);
154
155template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Brick>
156_ForwardIterator2
157__pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Brick,
158 /*parallel=*/std::false_type) noexcept;
159
160template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Brick>
161_RandomAccessIterator2
162__pattern_walk2_brick(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
163 _Brick,
164 /*parallel=*/std::true_type);
165
166template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Brick>
167_ForwardIterator2
168__pattern_walk2_brick_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Brick,
169 /*parallel=*/std::false_type) noexcept;
170
171template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2, class _Brick>
172_RandomAccessIterator2
173__pattern_walk2_brick_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Brick,
174 /*parallel=*/std::true_type);
175
176//------------------------------------------------------------------------
177// walk3 (pseudo)
178//
179// walk3 evaluates f(x,y,z) for (x,y,z) drawn from [first1,last1), [first2,...), [first3,...)
180//------------------------------------------------------------------------
181
182template <class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator3, class _Function>
183_ForwardIterator3 __brick_walk3(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3, _Function,
184 /*vector=*/std::false_type) noexcept;
185
186template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _RandomAccessIterator3, class _Function>
187_RandomAccessIterator3 __brick_walk3(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
188 _RandomAccessIterator3, _Function,
189 /*vector=*/std::true_type) noexcept;
190
191template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator3,
192 class _Function, class _IsVector>
193_ForwardIterator3
194__pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3,
195 _Function, _IsVector,
196 /*parallel=*/std::false_type) noexcept;
197
198template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2,
199 class _RandomAccessIterator3, class _Function, class _IsVector>
200_RandomAccessIterator3
201__pattern_walk3(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
202 _RandomAccessIterator3, _Function, _IsVector, /*parallel=*/std::true_type);
203
204//------------------------------------------------------------------------
205// equal
206//------------------------------------------------------------------------
207
208template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
209bool __brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate,
210 /* is_vector = */ std::false_type) noexcept;
211
212template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate>
213bool __brick_equal(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _BinaryPredicate,
214 /* is_vector = */ std::true_type) noexcept;
215
216template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
217 class _IsVector>
218bool
219__pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate,
220 _IsVector, /* is_parallel = */ std::false_type) noexcept;
221
222template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate,
223 class _IsVector>
224bool
225__pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
226 _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type);
227
228template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
229bool __brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate,
230 /* is_vector = */ std::false_type) noexcept;
231
232template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate>
233bool __brick_equal(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2,
234 _BinaryPredicate, /* is_vector = */ std::true_type) noexcept;
235
236template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
237 class _IsVector>
238bool
239__pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
240 _BinaryPredicate, _IsVector, /* is_parallel = */ std::false_type) noexcept;
241
242template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate,
243 class _IsVector>
244bool
245__pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
246 _RandomAccessIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type);
247
248//------------------------------------------------------------------------
249// find_if
250//------------------------------------------------------------------------
251
252template <class _ForwardIterator, class _Predicate>
253_ForwardIterator __brick_find_if(_ForwardIterator, _ForwardIterator, _Predicate,
254 /*is_vector=*/std::false_type) noexcept;
255
256template <class _RandomAccessIterator, class _Predicate>
257_RandomAccessIterator __brick_find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate,
258 /*is_vector=*/std::true_type) noexcept;
259
260template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
261_ForwardIterator
262__pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector,
263 /*is_parallel=*/std::false_type) noexcept;
264
265template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
266_ForwardIterator
267__pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector,
268 /*is_parallel=*/std::true_type);
269
270//------------------------------------------------------------------------
271// find_end
272//------------------------------------------------------------------------
273
274template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
275_ForwardIterator1 __brick_find_end(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
276 _BinaryPredicate,
277 /*__is_vector=*/std::false_type) noexcept;
278
279template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
280_ForwardIterator1 __brick_find_end(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
281 _BinaryPredicate,
282 /*__is_vector=*/std::true_type) noexcept;
283
284template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
285 class _IsVector>
286_ForwardIterator1
287__pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
288 _BinaryPredicate, _IsVector,
289 /*is_parallel=*/std::false_type) noexcept;
290
291template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
292 class _IsVector>
293_ForwardIterator1
294__pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
295 _BinaryPredicate, _IsVector,
296 /*is_parallel=*/std::true_type) noexcept;
297
298//------------------------------------------------------------------------
299// find_first_of
300//------------------------------------------------------------------------
301
302template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
303_ForwardIterator1 __brick_find_first_of(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
304 _BinaryPredicate,
305 /*__is_vector=*/std::false_type) noexcept;
306
307template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
308_ForwardIterator1 __brick_find_first_of(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
309 _BinaryPredicate,
310 /*__is_vector=*/std::true_type) noexcept;
311
312template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
313 class _IsVector>
314_ForwardIterator1
315__pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
316 _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept;
317
318template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
319 class _IsVector>
320_ForwardIterator1
321__pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
322 _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept;
323
324//------------------------------------------------------------------------
325// search
326//------------------------------------------------------------------------
327
328template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
329_ForwardIterator1 __brick_search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
330 _BinaryPredicate,
331 /*vector=*/std::false_type) noexcept;
332
333template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
334_ForwardIterator1 __brick_search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
335 _BinaryPredicate,
336 /*vector=*/std::true_type) noexcept;
337
338template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
339 class _IsVector>
340_ForwardIterator1
341__pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
342 _BinaryPredicate, _IsVector,
343 /*is_parallel=*/std::false_type) noexcept;
344
345template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
346 class _IsVector>
347_ForwardIterator1
348__pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
349 _BinaryPredicate, _IsVector,
350 /*is_parallel=*/std::true_type) noexcept;
351
352//------------------------------------------------------------------------
353// search_n
354//------------------------------------------------------------------------
355
356template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
357_ForwardIterator
358__brick_search_n(_ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate,
359 /*vector=*/std::false_type) noexcept;
360
361template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
362_ForwardIterator
363__brick_search_n(_ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate,
364 /*vector=*/std::true_type) noexcept;
365
366template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate,
367 class IsVector>
368_ForwardIterator
369__pattern_search_n(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate,
370 IsVector,
371 /*is_parallel=*/std::false_type) noexcept;
372
373template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Tp, class _BinaryPredicate,
374 class IsVector>
375_RandomAccessIterator
376__pattern_search_n(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Size, const _Tp&,
377 _BinaryPredicate, IsVector,
378 /*is_parallel=*/std::true_type) noexcept;
379
380//------------------------------------------------------------------------
381// copy_n
382//------------------------------------------------------------------------
383
384template <class _ForwardIterator, class _Size, class _OutputIterator>
385_OutputIterator __brick_copy_n(_ForwardIterator, _Size, _OutputIterator,
386 /*vector=*/std::false_type) noexcept;
387
388template <class _ForwardIterator, class _Size, class _OutputIterator>
389_OutputIterator __brick_copy_n(_ForwardIterator, _Size, _OutputIterator,
390 /*vector=*/std::true_type) noexcept;
391
392//------------------------------------------------------------------------
393// copy
394//------------------------------------------------------------------------
395
396template <class _ForwardIterator, class _OutputIterator>
397_OutputIterator __brick_copy(_ForwardIterator, _ForwardIterator, _OutputIterator,
398 /*vector=*/std::false_type) noexcept;
399
400template <class _RandomAccessIterator, class _OutputIterator>
401_OutputIterator __brick_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator,
402 /*vector=*/std::true_type) noexcept;
403
404//------------------------------------------------------------------------
405// move
406//------------------------------------------------------------------------
407
408template <class _ForwardIterator, class _OutputIterator>
409_OutputIterator __brick_move(_ForwardIterator, _ForwardIterator, _OutputIterator,
410 /*vector=*/std::false_type) noexcept;
411
412template <class _RandomAccessIterator, class _OutputIterator>
413_OutputIterator __brick_move(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator,
414 /*vector=*/std::true_type) noexcept;
415
416//------------------------------------------------------------------------
417// swap_ranges
418//------------------------------------------------------------------------
419template <class _ForwardIterator, class _OutputIterator>
420_OutputIterator
421__brick_swap_ranges(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
422 /*vector=*/std::false_type) noexcept;
423
424template <class _ForwardIterator, class _OutputIterator>
425_OutputIterator
426__brick_swap_ranges(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
427 /*vector=*/std::true_type) noexcept;
428
429//------------------------------------------------------------------------
430// copy_if
431//------------------------------------------------------------------------
432
433template <class _ForwardIterator, class _OutputIterator, class _UnaryPredicate>
434_OutputIterator __brick_copy_if(_ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate,
435 /*vector=*/std::false_type) noexcept;
436
437template <class _ForwardIterator, class _OutputIterator, class _UnaryPredicate>
438_OutputIterator __brick_copy_if(_ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate,
439 /*vector=*/std::true_type) noexcept;
440
441template <class _DifferenceType, class _ForwardIterator, class _UnaryPredicate>
442std::pair<_DifferenceType, _DifferenceType>
443__brick_calc_mask_1(_ForwardIterator, _ForwardIterator, bool* __restrict, _UnaryPredicate,
444 /*vector=*/std::false_type) noexcept;
445template <class _DifferenceType, class _RandomAccessIterator, class _UnaryPredicate>
446std::pair<_DifferenceType, _DifferenceType>
447__brick_calc_mask_1(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _UnaryPredicate,
448 /*vector=*/std::true_type) noexcept;
449
450template <class _ForwardIterator, class _OutputIterator>
451void
452__brick_copy_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator, bool*,
453 /*vector=*/std::false_type) noexcept;
454
455template <class _ForwardIterator, class _OutputIterator>
456void
457__brick_copy_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator, bool* __restrict,
458 /*vector=*/std::true_type) noexcept;
459
460template <class _ForwardIterator, class _OutputIterator1, class _OutputIterator2>
461void
462__brick_partition_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, bool*,
463 /*vector=*/std::false_type) noexcept;
464
465template <class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2>
466void
467__brick_partition_by_mask(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator1, _OutputIterator2, bool*,
468 /*vector=*/std::true_type) noexcept;
469
470template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _UnaryPredicate, class _IsVector>
471_OutputIterator
472__pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, _IsVector,
473 /*parallel=*/std::false_type) noexcept;
474
475template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _UnaryPredicate,
476 class _IsVector>
477_OutputIterator
478__pattern_copy_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryPredicate,
479 _IsVector, /*parallel=*/std::true_type);
480
481//------------------------------------------------------------------------
482// count
483//------------------------------------------------------------------------
484
485template <class _ForwardIterator, class _Predicate>
486typename std::iterator_traits<_ForwardIterator>::difference_type
487 __brick_count(_ForwardIterator, _ForwardIterator, _Predicate,
488 /* is_vector = */ std::true_type) noexcept;
489
490template <class _ForwardIterator, class _Predicate>
491typename std::iterator_traits<_ForwardIterator>::difference_type
492 __brick_count(_ForwardIterator, _ForwardIterator, _Predicate,
493 /* is_vector = */ std::false_type) noexcept;
494
495template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
496typename std::iterator_traits<_ForwardIterator>::difference_type
497__pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate,
498 /* is_parallel */ std::false_type, _IsVector) noexcept;
499
500template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector>
501typename std::iterator_traits<_ForwardIterator>::difference_type
502__pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate,
503 /* is_parallel */ std::true_type, _IsVector);
504
505//------------------------------------------------------------------------
506// unique
507//------------------------------------------------------------------------
508
509template <class _ForwardIterator, class _BinaryPredicate>
510_ForwardIterator __brick_unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate,
511 /*is_vector=*/std::false_type) noexcept;
512
513template <class _ForwardIterator, class _BinaryPredicate>
514_ForwardIterator __brick_unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate,
515 /*is_vector=*/std::true_type) noexcept;
516
517template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector>
518_ForwardIterator
519__pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector,
520 /*is_parallel=*/std::false_type) noexcept;
521
522template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector>
523_ForwardIterator
524__pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector,
525 /*is_parallel=*/std::true_type) noexcept;
526
527//------------------------------------------------------------------------
528// unique_copy
529//------------------------------------------------------------------------
530
531template <class _ForwardIterator, class OutputIterator, class _BinaryPredicate>
532OutputIterator __brick_unique_copy(_ForwardIterator, _ForwardIterator, OutputIterator, _BinaryPredicate,
533 /*vector=*/std::false_type) noexcept;
534
535template <class _RandomAccessIterator, class _OutputIterator, class _BinaryPredicate>
536_OutputIterator __brick_unique_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _BinaryPredicate,
537 /*vector=*/std::true_type) noexcept;
538
539template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _BinaryPredicate,
540 class _IsVector>
541_OutputIterator
542__pattern_unique_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryPredicate,
543 _IsVector, /*parallel=*/std::false_type) noexcept;
544
545template <class _ExecutionPolicy, class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate>
546_DifferenceType
547__brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate,
548 /*vector=*/std::false_type) noexcept;
549
550template <class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate>
551_DifferenceType
552__brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate,
553 /*vector=*/std::true_type) noexcept;
554
555template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _BinaryPredicate,
556 class _IsVector>
557_OutputIterator
558__pattern_unique_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator,
559 _BinaryPredicate, _IsVector, /*parallel=*/std::true_type);
560
561//------------------------------------------------------------------------
562// reverse
563//------------------------------------------------------------------------
564
565template <class _BidirectionalIterator>
566void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator,
567 /*__is_vector=*/std::false_type) noexcept;
568
569template <class _BidirectionalIterator>
570void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator,
571 /*__is_vector=*/std::true_type) noexcept;
572
573template <class _BidirectionalIterator>
574void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator,
575 /*is_vector=*/std::false_type) noexcept;
576
577template <class _BidirectionalIterator>
578void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator,
579 /*is_vector=*/std::true_type) noexcept;
580
581template <class _ExecutionPolicy, class _BidirectionalIterator, class _IsVector>
582void
583__pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector,
584 /*is_parallel=*/std::false_type) noexcept;
585
586template <class _ExecutionPolicy, class _BidirectionalIterator, class _IsVector>
587void
588__pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector,
589 /*is_parallel=*/std::true_type);
590
591//------------------------------------------------------------------------
592// reverse_copy
593//------------------------------------------------------------------------
594
595template <class _BidirectionalIterator, class _OutputIterator>
596_OutputIterator __brick_reverse_copy(_BidirectionalIterator, _BidirectionalIterator, _OutputIterator,
597 /*is_vector=*/std::false_type) noexcept;
598
599template <class _BidirectionalIterator, class _OutputIterator>
600_OutputIterator __brick_reverse_copy(_BidirectionalIterator, _BidirectionalIterator, _OutputIterator,
601 /*is_vector=*/std::true_type) noexcept;
602
603template <class _ExecutionPolicy, class _BidirectionalIterator, class _OutputIterator, class _IsVector>
604_OutputIterator
605__pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector,
606 /*is_parallel=*/std::false_type) noexcept;
607
608template <class _ExecutionPolicy, class _BidirectionalIterator, class _OutputIterator, class _IsVector>
609_OutputIterator
610__pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector,
611 /*is_parallel=*/std::true_type);
612
613//------------------------------------------------------------------------
614// rotate
615//------------------------------------------------------------------------
616
617template <class _ForwardIterator>
618_ForwardIterator __brick_rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator,
619 /*is_vector=*/std::false_type) noexcept;
620
621template <class _ForwardIterator>
622_ForwardIterator __brick_rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator,
623 /*is_vector=*/std::true_type) noexcept;
624
625template <class _ExecutionPolicy, class _ForwardIterator, class _IsVector>
626_ForwardIterator
627__pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector,
628 /*is_parallel=*/std::false_type) noexcept;
629
630template <class _ExecutionPolicy, class _ForwardIterator, class _IsVector>
631_ForwardIterator
632__pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector,
633 /*is_parallel=*/std::true_type);
634
635//------------------------------------------------------------------------
636// rotate_copy
637//------------------------------------------------------------------------
638
639template <class _ForwardIterator, class _OutputIterator>
640_OutputIterator __brick_rotate_copy(_ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator,
641 /*__is_vector=*/std::false_type) noexcept;
642
643template <class _ForwardIterator, class _OutputIterator>
644_OutputIterator __brick_rotate_copy(_ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator,
645 /*__is_vector=*/std::true_type) noexcept;
646
647template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector>
648_OutputIterator
649__pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator,
650 _IsVector,
651 /*is_parallel=*/std::false_type) noexcept;
652
653template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector>
654_OutputIterator
655__pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator,
656 _IsVector,
657 /*is_parallel=*/std::true_type);
658
659//------------------------------------------------------------------------
660// is_partitioned
661//------------------------------------------------------------------------
662
663template <class _ForwardIterator, class _UnaryPredicate>
664bool __brick_is_partitioned(_ForwardIterator, _ForwardIterator, _UnaryPredicate,
665 /*is_vector=*/std::false_type) noexcept;
666
667template <class _ForwardIterator, class _UnaryPredicate>
668bool __brick_is_partitioned(_ForwardIterator, _ForwardIterator, _UnaryPredicate,
669 /*is_vector=*/std::true_type) noexcept;
670
671template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
672bool
673__pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
674 /*is_parallel=*/std::false_type) noexcept;
675
676template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
677bool
678__pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
679 /*is_parallel=*/std::true_type);
680
681//------------------------------------------------------------------------
682// partition
683//------------------------------------------------------------------------
684
685template <class _ForwardIterator, class _UnaryPredicate>
686_ForwardIterator __brick_partition(_ForwardIterator, _ForwardIterator, _UnaryPredicate,
687 /*is_vector=*/std::false_type) noexcept;
688
689template <class _ForwardIterator, class _UnaryPredicate>
690_ForwardIterator __brick_partition(_ForwardIterator, _ForwardIterator, _UnaryPredicate,
691 /*is_vector=*/std::true_type) noexcept;
692
693template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
694_ForwardIterator
695__pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
696 /*is_parallel=*/std::false_type) noexcept;
697
698template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
699_ForwardIterator
700__pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
701 /*is_parallel=*/std::true_type);
702
703//------------------------------------------------------------------------
704// stable_partition
705//------------------------------------------------------------------------
706
707template <class _BidirectionalIterator, class _UnaryPredicate>
708_BidirectionalIterator __brick_stable_partition(_BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate,
709 /*__is_vector=*/std::false_type) noexcept;
710
711template <class _BidirectionalIterator, class _UnaryPredicate>
712_BidirectionalIterator __brick_stable_partition(_BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate,
713 /*__is_vector=*/std::true_type) noexcept;
714
715template <class _ExecutionPolicy, class _BidirectionalIterator, class _UnaryPredicate, class _IsVector>
716_BidirectionalIterator
717__pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate,
718 _IsVector,
719 /*is_parallelization=*/std::false_type) noexcept;
720
721template <class _ExecutionPolicy, class _BidirectionalIterator, class _UnaryPredicate, class _IsVector>
722_BidirectionalIterator
723__pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate,
724 _IsVector,
725 /*is_parallelization=*/std::true_type) noexcept;
726
727//------------------------------------------------------------------------
728// partition_copy
729//------------------------------------------------------------------------
730
731template <class _ForwardIterator, class _OutputIterator1, class _OutputIterator2, class _UnaryPredicate>
732std::pair<_OutputIterator1, _OutputIterator2>
733 __brick_partition_copy(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, _UnaryPredicate,
734 /*is_vector=*/std::false_type) noexcept;
735
736template <class _ForwardIterator, class _OutputIterator1, class _OutputIterator2, class _UnaryPredicate>
737std::pair<_OutputIterator1, _OutputIterator2>
738 __brick_partition_copy(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, _UnaryPredicate,
739 /*is_vector=*/std::true_type) noexcept;
740
741template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator1, class _OutputIterator2,
742 class _UnaryPredicate, class _IsVector>
743std::pair<_OutputIterator1, _OutputIterator2>
744__pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2,
745 _UnaryPredicate, _IsVector,
746 /*is_parallelization=*/std::false_type) noexcept;
747
748template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2,
749 class _UnaryPredicate, class _IsVector>
750std::pair<_OutputIterator1, _OutputIterator2>
751__pattern_partition_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator1,
752 _OutputIterator2, _UnaryPredicate, _IsVector,
753 /*is_parallelization=*/std::true_type);
754
755//------------------------------------------------------------------------
756// sort
757//------------------------------------------------------------------------
758
759template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector,
760 class _IsMoveConstructible>
761void
762__pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/,
763 /*is_parallel=*/std::false_type, _IsMoveConstructible) noexcept;
764
765template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
766void
767__pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/,
768 /*is_parallel=*/std::true_type,
769 /*is_move_constructible=*/std::true_type);
770
771//------------------------------------------------------------------------
772// stable_sort
773//------------------------------------------------------------------------
774
775template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
776void
777__pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare,
778 _IsVector /*is_vector*/,
779 /*is_parallel=*/std::false_type) noexcept;
780
781template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
782void
783__pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare,
784 _IsVector /*is_vector*/,
785 /*is_parallel=*/std::true_type);
786
787//------------------------------------------------------------------------
788// partial_sort
789//------------------------------------------------------------------------
790
791template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
792void
793__pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator,
794 _Compare, _IsVector,
795 /*is_parallel=*/std::false_type) noexcept;
796
797template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
798void
799__pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator,
800 _Compare, _IsVector,
801 /*is_parallel=*/std::true_type);
802
803//------------------------------------------------------------------------
804// partial_sort_copy
805//------------------------------------------------------------------------
806
807template <class _ExecutionPolicy, class _ForwardIterator, class _RandomAccessIterator, class _Compare, class _IsVector>
808_RandomAccessIterator
809__pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _RandomAccessIterator,
810 _RandomAccessIterator, _Compare, _IsVector,
811 /*is_parallel=*/std::false_type) noexcept;
812
813template <class _ExecutionPolicy, class _ForwardIterator, class _RandomAccessIterator, class _Compare, class _IsVector>
814_RandomAccessIterator
815__pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _RandomAccessIterator,
816 _RandomAccessIterator, _Compare, _IsVector,
817 /*is_parallel=*/std::true_type);
818
819//------------------------------------------------------------------------
820// adjacent_find
821//------------------------------------------------------------------------
822
823template <class _ForwardIterator, class _BinaryPredicate>
824_ForwardIterator
825__brick_adjacent_find(_ForwardIterator, _ForwardIterator, _BinaryPredicate,
826 /* IsVector = */ std::true_type, bool) noexcept;
827
828template <class _ForwardIterator, class _BinaryPredicate>
829_ForwardIterator
830__brick_adjacent_find(_ForwardIterator, _ForwardIterator, _BinaryPredicate,
831 /* IsVector = */ std::false_type, bool) noexcept;
832
833template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector>
834_ForwardIterator
835__pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate,
836 /* is_parallel */ std::false_type, _IsVector, bool) noexcept;
837
838template <class _ExecutionPolicy, class _RandomAccessIterator, class _BinaryPredicate, class _IsVector>
839_RandomAccessIterator
840__pattern_adjacent_find(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate,
841 /* is_parallel */ std::true_type, _IsVector, bool);
842
843//------------------------------------------------------------------------
844// nth_element
845//------------------------------------------------------------------------
846template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
847void
848__pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare,
849 _IsVector,
850 /*is_parallel=*/std::false_type) noexcept;
851
852template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
853void
854__pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare,
855 _IsVector,
856 /*is_parallel=*/std::true_type) noexcept;
857
858//------------------------------------------------------------------------
859// fill, fill_n
860//------------------------------------------------------------------------
861template <class _ForwardIterator, class _Tp>
862void
863__brick_fill(_ForwardIterator, _ForwardIterator, const _Tp&,
864 /* __is_vector = */ std::true_type) noexcept;
865
866template <class _ForwardIterator, class _Tp>
867void
868__brick_fill(_ForwardIterator, _ForwardIterator, const _Tp&,
869 /* __is_vector = */ std::false_type) noexcept;
870
871template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _IsVector>
872void
873__pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&,
874 /*is_parallel=*/std::false_type, _IsVector) noexcept;
875
876template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _IsVector>
877_ForwardIterator
878__pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&,
879 /*is_parallel=*/std::true_type, _IsVector);
880
881template <class _OutputIterator, class _Size, class _Tp>
882_OutputIterator
883__brick_fill_n(_OutputIterator, _Size, const _Tp&,
884 /* __is_vector = */ std::true_type) noexcept;
885
886template <class _OutputIterator, class _Size, class _Tp>
887_OutputIterator
888__brick_fill_n(_OutputIterator, _Size, const _Tp&,
889 /* __is_vector = */ std::false_type) noexcept;
890
891template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Tp, class _IsVector>
892_OutputIterator
893__pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&,
894 /*is_parallel=*/std::false_type, _IsVector) noexcept;
895
896template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Tp, class _IsVector>
897_OutputIterator
898__pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&,
899 /*is_parallel=*/std::true_type, _IsVector);
900
901//------------------------------------------------------------------------
902// generate, generate_n
903//------------------------------------------------------------------------
904
905template <class _RandomAccessIterator, class _Generator>
906void __brick_generate(_RandomAccessIterator, _RandomAccessIterator, _Generator,
907 /* is_vector = */ std::true_type) noexcept;
908
909template <class _ForwardIterator, class _Generator>
910void __brick_generate(_ForwardIterator, _ForwardIterator, _Generator,
911 /* is_vector = */ std::false_type) noexcept;
912
913template <class _ExecutionPolicy, class _ForwardIterator, class _Generator, class _IsVector>
914void
915__pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator,
916 /*is_parallel=*/std::false_type, _IsVector) noexcept;
917
918template <class _ExecutionPolicy, class _ForwardIterator, class _Generator, class _IsVector>
919_ForwardIterator
920__pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator,
921 /*is_parallel=*/std::true_type, _IsVector);
922
923template <class OutputIterator, class Size, class _Generator>
924OutputIterator __brick_generate_n(OutputIterator, Size, _Generator,
925 /* is_vector = */ std::true_type) noexcept;
926
927template <class OutputIterator, class Size, class _Generator>
928OutputIterator __brick_generate_n(OutputIterator, Size, _Generator,
929 /* is_vector = */ std::false_type) noexcept;
930
931template <class _ExecutionPolicy, class OutputIterator, class Size, class _Generator, class _IsVector>
932OutputIterator
933__pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator,
934 /*is_parallel=*/std::false_type, _IsVector) noexcept;
935
936template <class _ExecutionPolicy, class OutputIterator, class Size, class _Generator, class _IsVector>
937OutputIterator
938__pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator,
939 /*is_parallel=*/std::true_type, _IsVector);
940
941//------------------------------------------------------------------------
942// remove
943//------------------------------------------------------------------------
944template <class _ForwardIterator, class _UnaryPredicate>
945_ForwardIterator __brick_remove_if(_ForwardIterator, _ForwardIterator, _UnaryPredicate,
946 /* __is_vector = */ std::false_type) noexcept;
947
948template <class _RandomAccessIterator, class _UnaryPredicate>
949_RandomAccessIterator __brick_remove_if(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate,
950 /* __is_vector = */ std::true_type) noexcept;
951
952template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
953_ForwardIterator
954__pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
955 /*is_parallel*/ std::false_type) noexcept;
956
957template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector>
958_ForwardIterator
959__pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector,
960 /*is_parallel*/ std::true_type) noexcept;
961
962//------------------------------------------------------------------------
963// merge
964//------------------------------------------------------------------------
965
966template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
967_OutputIterator __brick_merge(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
968 _OutputIterator, _Compare,
969 /* __is_vector = */ std::false_type) noexcept;
970
971template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
972_OutputIterator __brick_merge(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
973 _OutputIterator, _Compare,
974 /* __is_vector = */ std::true_type) noexcept;
975
976template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
977 class _Compare, class _IsVector>
978_OutputIterator
979__pattern_merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
980 _OutputIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept;
981
982template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator,
983 class _Compare, class _IsVector>
984_OutputIterator
985__pattern_merge(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
986 _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector,
987 /* is_parallel = */ std::true_type);
988
989//------------------------------------------------------------------------
990// inplace_merge
991//------------------------------------------------------------------------
992
993template <class _BidirectionalIterator, class _Compare>
994void __brick_inplace_merge(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare,
995 /* __is_vector = */ std::false_type) noexcept;
996
997template <class _BidirectionalIterator, class _Compare>
998void __brick_inplace_merge(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare,
999 /* __is_vector = */ std::true_type) noexcept;
1000
1001template <class _ExecutionPolicy, class _BidirectionalIterator, class _Compare, class _IsVector>
1002void
1003__pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator,
1004 _Compare, _IsVector,
1005 /* is_parallel = */ std::false_type) noexcept;
1006
1007template <class _ExecutionPolicy, class _BidirectionalIterator, class _Compare, class _IsVector>
1008void
1009__pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator,
1010 _Compare, _IsVector,
1011 /*is_parallel=*/std::true_type);
1012
1013//------------------------------------------------------------------------
1014// includes
1015//------------------------------------------------------------------------
1016
1017template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
1018bool
1019__pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1020 _Compare, _IsVector,
1021 /*is_parallel=*/std::false_type) noexcept;
1022
1023template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
1024bool
1025__pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1026 _Compare, _IsVector,
1027 /*is_parallel=*/std::true_type);
1028
1029//------------------------------------------------------------------------
1030// set_union
1031//------------------------------------------------------------------------
1032
1033template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1034_OutputIterator __brick_set_union(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1035 _OutputIterator, _Compare,
1036 /*__is_vector=*/std::false_type) noexcept;
1037
1038template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1039_OutputIterator __brick_set_union(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1040 _OutputIterator, _Compare,
1041 /*__is_vector=*/std::true_type) noexcept;
1042
1043template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1044 class _Compare, class _IsVector>
1045_OutputIterator
1046__pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1047 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept;
1048
1049template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1050 class _Compare, class _IsVector>
1051_OutputIterator
1052__pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1053 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type);
1054
1055//------------------------------------------------------------------------
1056// set_intersection
1057//------------------------------------------------------------------------
1058
1059template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1060_OutputIterator __brick_set_intersection(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1061 _OutputIterator, _Compare,
1062 /*__is_vector=*/std::false_type) noexcept;
1063
1064template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1065_OutputIterator __brick_set_intersection(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1066 _OutputIterator, _Compare,
1067 /*__is_vector=*/std::true_type) noexcept;
1068
1069template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1070 class _Compare, class _IsVector>
1071_OutputIterator
1072__pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1073 _ForwardIterator2, _OutputIterator, _Compare, _IsVector,
1074 /*is_parallel=*/std::false_type) noexcept;
1075
1076template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1077 class _Compare, class _IsVector>
1078_OutputIterator
1079__pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1080 _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type);
1081
1082//------------------------------------------------------------------------
1083// set_difference
1084//------------------------------------------------------------------------
1085
1086template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1087_OutputIterator __brick_set_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1088 _OutputIterator, _Compare,
1089 /*__is_vector=*/std::false_type) noexcept;
1090
1091template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1092_OutputIterator __brick_set_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1093 _OutputIterator, _Compare,
1094 /*__is_vector=*/std::true_type) noexcept;
1095
1096template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1097 class _Compare, class _IsVector>
1098_OutputIterator
1099__pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1100 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept;
1101
1102template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1103 class _Compare, class _IsVector>
1104_OutputIterator
1105__pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1106 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type);
1107
1108//------------------------------------------------------------------------
1109// set_symmetric_difference
1110//------------------------------------------------------------------------
1111
1112template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1113_OutputIterator __brick_set_symmetric_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1114 _ForwardIterator2, _OutputIterator, _Compare,
1115 /*__is_vector=*/std::false_type) noexcept;
1116
1117template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare>
1118_OutputIterator __brick_set_symmetric_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1119 _ForwardIterator2, _OutputIterator, _Compare,
1120 /*__is_vector=*/std::true_type) noexcept;
1121
1122template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1123 class _Compare, class _IsVector>
1124_OutputIterator
1125__pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1126 _ForwardIterator2, _OutputIterator, _Compare, _IsVector,
1127 /*is_parallel=*/std::false_type) noexcept;
1128
1129template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator,
1130 class _Compare, class _IsVector>
1131_OutputIterator
1132__pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1133 _ForwardIterator2, _OutputIterator, _Compare, _IsVector,
1134 /*is_parallel=*/std::true_type);
1135
1136//------------------------------------------------------------------------
1137// is_heap_until
1138//------------------------------------------------------------------------
1139
1140template <class _RandomAccessIterator, class _Compare>
1141_RandomAccessIterator __brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare,
1142 /* __is_vector = */ std::false_type) noexcept;
1143
1144template <class _RandomAccessIterator, class _Compare>
1145_RandomAccessIterator __brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare,
1146 /* __is_vector = */ std::true_type) noexcept;
1147
1148template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
1149_RandomAccessIterator
1150__pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector,
1151 /* is_parallel = */ std::false_type) noexcept;
1152
1153template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector>
1154_RandomAccessIterator
1155__pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector,
1156 /* is_parallel = */ std::true_type) noexcept;
1157
1158//------------------------------------------------------------------------
1159// min_element
1160//------------------------------------------------------------------------
1161
1162template <typename _ForwardIterator, typename _Compare>
1163_ForwardIterator __brick_min_element(_ForwardIterator, _ForwardIterator, _Compare,
1164 /* __is_vector = */ std::false_type) noexcept;
1165
1166template <typename _ForwardIterator, typename _Compare>
1167_ForwardIterator __brick_min_element(_ForwardIterator, _ForwardIterator, _Compare,
1168 /* __is_vector = */ std::true_type) noexcept;
1169
1170template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector>
1171_ForwardIterator
1172__pattern_min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector,
1173 /* is_parallel = */ std::false_type) noexcept;
1174
1175template <typename _ExecutionPolicy, typename _RandomAccessIterator, typename _Compare, typename _IsVector>
1176_RandomAccessIterator
1177__pattern_min_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector,
1178 /* is_parallel = */ std::true_type);
1179
1180//------------------------------------------------------------------------
1181// minmax_element
1182//------------------------------------------------------------------------
1183
1184template <typename _ForwardIterator, typename _Compare>
1185std::pair<_ForwardIterator, _ForwardIterator> __brick_minmax_element(_ForwardIterator, _ForwardIterator, _Compare,
1186 /* __is_vector = */ std::false_type) noexcept;
1187
1188template <typename _ForwardIterator, typename _Compare>
1189std::pair<_ForwardIterator, _ForwardIterator> __brick_minmax_element(_ForwardIterator, _ForwardIterator, _Compare,
1190 /* __is_vector = */ std::true_type) noexcept;
1191
1192template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector>
1193std::pair<_ForwardIterator, _ForwardIterator>
1194__pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector,
1195 /* is_parallel = */ std::false_type) noexcept;
1196
1197template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector>
1198std::pair<_ForwardIterator, _ForwardIterator>
1199__pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector,
1200 /* is_parallel = */ std::true_type);
1201
1202//------------------------------------------------------------------------
1203// mismatch
1204//------------------------------------------------------------------------
1205
1206template <class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
1207std::pair<_ForwardIterator1, _ForwardIterator2> __brick_mismatch(_ForwardIterator1, _ForwardIterator1,
1208 _ForwardIterator2, _ForwardIterator2, _Predicate,
1209 /* __is_vector = */ std::false_type) noexcept;
1210
1211template <class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
1212std::pair<_ForwardIterator1, _ForwardIterator2> __brick_mismatch(_ForwardIterator1, _ForwardIterator1,
1213 _ForwardIterator2, _ForwardIterator2, _Predicate,
1214 /* __is_vector = */ std::true_type) noexcept;
1215
1216template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate, class _IsVector>
1217std::pair<_ForwardIterator1, _ForwardIterator2>
1218__pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1219 _Predicate, _IsVector,
1220 /* is_parallel = */ std::false_type) noexcept;
1221
1222template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Predicate,
1223 class _IsVector>
1224std::pair<_RandomAccessIterator1, _RandomAccessIterator2>
1225__pattern_mismatch(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
1226 _RandomAccessIterator2, _Predicate, _IsVector, /* is_parallel = */ std::true_type) noexcept;
1227
1228//------------------------------------------------------------------------
1229// lexicographical_compare
1230//------------------------------------------------------------------------
1231
1232template <class _ForwardIterator1, class _ForwardIterator2, class _Compare>
1233bool __brick_lexicographical_compare(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1234 _Compare,
1235 /* __is_vector = */ std::false_type) noexcept;
1236
1237template <class _ForwardIterator1, class _ForwardIterator2, class _Compare>
1238bool __brick_lexicographical_compare(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2,
1239 _Compare,
1240 /* __is_vector = */ std::true_type) noexcept;
1241
1242template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
1243bool
1244__pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1245 _ForwardIterator2, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept;
1246
1247template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector>
1248bool
1249__pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
1250 _ForwardIterator2, _Compare, _IsVector, /* is_parallel = */ std::true_type) noexcept;
1251
1252} // namespace __internal
1253} // namespace __pstl
1254#endif /* _PSTL_ALGORITHM_FWD_H */
1255

source code of include/c++/11/pstl/algorithm_fwd.h