1// -*- C++ -*-
2//===-- glue_algorithm_defs.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_GLUE_ALGORITHM_DEFS_H
11#define _PSTL_GLUE_ALGORITHM_DEFS_H
12
13#include <functional>
14
15#include "execution_defs.h"
16
17namespace std
18{
19
20// [alg.any_of]
21
22template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
23__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
24any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
25
26// [alg.all_of]
27
28template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
29__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
30all_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
31
32// [alg.none_of]
33
34template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
35__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
36none_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
37
38// [alg.foreach]
39
40template <class _ExecutionPolicy, class _ForwardIterator, class _Function>
41__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
42for_each(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Function __f);
43
44template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Function>
45__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
46for_each_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n, _Function __f);
47
48// [alg.find]
49
50template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
51__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
52find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
53
54template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
55__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
56find_if_not(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
57
58template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
59__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
60find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
61
62// [alg.find.end]
63
64template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
65__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
66find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
67 _ForwardIterator2 __s_last, _BinaryPredicate __pred);
68
69template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
70__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
71find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
72 _ForwardIterator2 __s_last);
73
74// [alg.find_first_of]
75
76template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
77__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
78find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
79 _ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred);
80
81template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
82__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
83find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
84 _ForwardIterator2 __s_first, _ForwardIterator2 __s_last);
85
86// [alg.adjacent_find]
87
88template <class _ExecutionPolicy, class _ForwardIterator>
89__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
90adjacent_find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
91
92template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate>
93__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
94adjacent_find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred);
95
96// [alg.count]
97
98template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
99__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy,
100 typename iterator_traits<_ForwardIterator>::difference_type>
101count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
102
103template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
104__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy,
105 typename iterator_traits<_ForwardIterator>::difference_type>
106count_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred);
107
108// [alg.search]
109
110template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
111__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
112search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
113 _ForwardIterator2 __s_last, _BinaryPredicate __pred);
114
115template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
116__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator1>
117search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
118 _ForwardIterator2 __s_last);
119
120template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
121__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
122search_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Size __count,
123 const _Tp& __value, _BinaryPredicate __pred);
124
125template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp>
126__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
127search_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Size __count,
128 const _Tp& __value);
129
130// [alg.copy]
131
132template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
133__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
134copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result);
135
136template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2>
137__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
138copy_n(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Size __n, _ForwardIterator2 __result);
139
140template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
141__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
142copy_if(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 result,
143 _Predicate __pred);
144
145// [alg.swap]
146
147template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
148__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
149swap_ranges(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
150 _ForwardIterator2 __first2);
151
152// [alg.transform]
153
154template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation>
155__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
156transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result,
157 _UnaryOperation __op);
158
159template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
160 class _BinaryOperation>
161__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
162transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
163 _ForwardIterator __result, _BinaryOperation __op);
164
165// [alg.replace]
166
167template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _Tp>
168__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
169replace_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
170 const _Tp& __new_value);
171
172template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
173__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
174replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
175 const _Tp& __new_value);
176
177template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryPredicate, class _Tp>
178__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
179replace_copy_if(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
180 _ForwardIterator2 __result, _UnaryPredicate __pred, const _Tp& __new_value);
181
182template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Tp>
183__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
184replace_copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result,
185 const _Tp& __old_value, const _Tp& __new_value);
186
187// [alg.fill]
188
189template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
190__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
191fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
192
193template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp>
194__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
195fill_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __count, const _Tp& __value);
196
197// [alg.generate]
198template <class _ExecutionPolicy, class _ForwardIterator, class _Generator>
199__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
200generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g);
201
202template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Generator>
203__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
204generate_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size count, _Generator __g);
205
206// [alg.remove]
207
208template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
209__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
210remove_copy_if(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
211 _ForwardIterator2 __result, _Predicate __pred);
212
213template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Tp>
214__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
215remove_copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result,
216 const _Tp& __value);
217
218template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate>
219__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
220remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred);
221
222template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
223__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
224remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
225
226// [alg.unique]
227
228template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate>
229__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
230unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred);
231
232template <class _ExecutionPolicy, class _ForwardIterator>
233__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
234unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
235
236template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
237__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
238unique_copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result,
239 _BinaryPredicate __pred);
240
241template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
242__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
243unique_copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result);
244
245// [alg.reverse]
246
247template <class _ExecutionPolicy, class _BidirectionalIterator>
248__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
249reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
250
251template <class _ExecutionPolicy, class _BidirectionalIterator, class _ForwardIterator>
252__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
253reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last,
254 _ForwardIterator __d_first);
255
256// [alg.rotate]
257
258template <class _ExecutionPolicy, class _ForwardIterator>
259__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
260rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last);
261
262template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
263__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
264rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __middle, _ForwardIterator1 __last,
265 _ForwardIterator2 __result);
266
267// [alg.partitions]
268
269template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate>
270__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
271is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred);
272
273template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate>
274__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
275partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred);
276
277template <class _ExecutionPolicy, class _BidirectionalIterator, class _UnaryPredicate>
278__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _BidirectionalIterator>
279stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last,
280 _UnaryPredicate __pred);
281
282template <class _ExecutionPolicy, class _ForwardIterator, class _ForwardIterator1, class _ForwardIterator2,
283 class _UnaryPredicate>
284__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator1, _ForwardIterator2>>
285partition_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
286 _ForwardIterator1 __out_true, _ForwardIterator2 __out_false, _UnaryPredicate __pred);
287
288// [alg.sort]
289
290template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
291__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
292sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
293
294template <class _ExecutionPolicy, class _RandomAccessIterator>
295__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
296sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
297
298// [stable.sort]
299
300template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
301__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
302stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
303
304template <class _ExecutionPolicy, class _RandomAccessIterator>
305__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
306stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
307
308// [mismatch]
309
310template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
311__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator1, _ForwardIterator2>>
312mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
313 _ForwardIterator2 __last2, _BinaryPredicate __pred);
314
315template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
316__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator1, _ForwardIterator2>>
317mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
318 _BinaryPredicate __pred);
319
320template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
321__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator1, _ForwardIterator2>>
322mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
323 _ForwardIterator2 __last2);
324
325template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
326__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator1, _ForwardIterator2>>
327mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
328
329// [alg.equal]
330
331template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
332__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
333equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
334 _BinaryPredicate __p);
335
336template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
337__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
338equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
339
340template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
341__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
342equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
343 _ForwardIterator2 __last2, _BinaryPredicate __p);
344
345template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
346__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
347equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
348 _ForwardIterator2 __last2);
349
350// [alg.move]
351template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
352__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
353move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
354
355// [partial.sort]
356
357template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
358__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
359partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __middle,
360 _RandomAccessIterator __last, _Compare __comp);
361
362template <class _ExecutionPolicy, class _RandomAccessIterator>
363__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
364partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __middle,
365 _RandomAccessIterator __last);
366
367// [partial.sort.copy]
368
369template <class _ExecutionPolicy, class _ForwardIterator, class _RandomAccessIterator, class _Compare>
370__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _RandomAccessIterator>
371partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
372 _RandomAccessIterator __d_first, _RandomAccessIterator __d_last, _Compare __comp);
373
374template <class _ExecutionPolicy, class _ForwardIterator, class _RandomAccessIterator>
375__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _RandomAccessIterator>
376partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last,
377 _RandomAccessIterator __d_first, _RandomAccessIterator __d_last);
378
379// [is.sorted]
380template <class _ExecutionPolicy, class _ForwardIterator, class _Compare>
381__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
382is_sorted_until(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
383
384template <class _ExecutionPolicy, class _ForwardIterator>
385__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
386is_sorted_until(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
387
388template <class _ExecutionPolicy, class _ForwardIterator, class _Compare>
389__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
390is_sorted(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
391
392template <class _ExecutionPolicy, class _ForwardIterator>
393__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
394is_sorted(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
395
396// [alg.nth.element]
397
398template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
399__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
400nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __nth,
401 _RandomAccessIterator __last, _Compare __comp);
402
403template <class _ExecutionPolicy, class _RandomAccessIterator>
404__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
405nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __nth,
406 _RandomAccessIterator __last);
407
408// [alg.merge]
409template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
410 class _Compare>
411__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
412merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
413 _ForwardIterator2 __last2, _ForwardIterator __d_first, _Compare __comp);
414
415template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator>
416__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
417merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
418 _ForwardIterator2 __last2, _ForwardIterator __d_first);
419
420template <class _ExecutionPolicy, class _BidirectionalIterator, class _Compare>
421__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
422inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __middle,
423 _BidirectionalIterator __last, _Compare __comp);
424
425template <class _ExecutionPolicy, class _BidirectionalIterator>
426__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
427inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __middle,
428 _BidirectionalIterator __last);
429
430// [includes]
431
432template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare>
433__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
434includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
435 _ForwardIterator2 __last2, _Compare __comp);
436
437template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
438__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
439includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
440 _ForwardIterator2 __last2);
441
442// [set.union]
443
444template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
445 class _Compare>
446__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
447set_union(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
448 _ForwardIterator2 __last2, _ForwardIterator __result, _Compare __comp);
449
450template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator>
451__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
452set_union(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
453 _ForwardIterator2 __last2, _ForwardIterator __result);
454
455// [set.intersection]
456
457template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
458 class _Compare>
459__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
460set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
461 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator __result, _Compare __comp);
462
463template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator>
464__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
465set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
466 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator __result);
467
468// [set.difference]
469
470template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
471 class _Compare>
472__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
473set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
474 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator __result, _Compare __comp);
475
476template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator>
477__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
478set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
479 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator __result);
480
481// [set.symmetric.difference]
482
483template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator,
484 class _Compare>
485__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
486set_symmetric_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
487 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator result,
488 _Compare __comp);
489
490template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator>
491__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
492set_symmetric_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
493 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _ForwardIterator __result);
494
495// [is.heap]
496template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
497__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _RandomAccessIterator>
498is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
499
500template <class _ExecutionPolicy, class _RandomAccessIterator>
501__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _RandomAccessIterator>
502is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
503
504template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare>
505__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
506is_heap(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
507
508template <class _ExecutionPolicy, class _RandomAccessIterator>
509__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
510is_heap(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
511
512// [alg.min.max]
513
514template <class _ExecutionPolicy, class _ForwardIterator, class _Compare>
515__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
516min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
517
518template <class _ExecutionPolicy, class _ForwardIterator>
519__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
520min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
521
522template <class _ExecutionPolicy, class _ForwardIterator, class _Compare>
523__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
524max_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
525
526template <class _ExecutionPolicy, class _ForwardIterator>
527__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
528max_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
529
530template <class _ExecutionPolicy, class _ForwardIterator, class _Compare>
531__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator, _ForwardIterator>>
532minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp);
533
534template <class _ExecutionPolicy, class _ForwardIterator>
535__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_ForwardIterator, _ForwardIterator>>
536minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
537
538// [alg.lex.comparison]
539
540template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare>
541__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
542lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
543 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _Compare __comp);
544
545template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
546__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
547lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
548 _ForwardIterator2 __first2, _ForwardIterator2 __last2);
549
550} // namespace std
551#endif /* _PSTL_GLUE_ALGORITHM_DEFS_H */
552