From Jason Turner

[algorithm.syn]

Large diff (133.5 KB) - rendering may be slow on some devices

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5qf2kc5x/{from.md → to.md} +1546 -315
tmp/tmp5qf2kc5x/{from.md → to.md} RENAMED
@@ -2,74 +2,175 @@
2
 
3
  ``` cpp
4
  #include <initializer_list>
5
 
6
  namespace std {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  // [alg.nonmodifying], non-modifying sequence operations
8
- // [alg.all_of], all of
9
  template<class InputIterator, class Predicate>
10
- bool all_of(InputIterator first, InputIterator last, Predicate pred);
11
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
12
  bool all_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
13
  ForwardIterator first, ForwardIterator last, Predicate pred);
14
 
15
- // [alg.any_of], any of
 
 
 
 
 
 
 
 
 
16
  template<class InputIterator, class Predicate>
17
- bool any_of(InputIterator first, InputIterator last, Predicate pred);
18
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
19
  bool any_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
20
  ForwardIterator first, ForwardIterator last, Predicate pred);
21
 
22
- // [alg.none_of], none of
 
 
 
 
 
 
 
 
 
23
  template<class InputIterator, class Predicate>
24
- bool none_of(InputIterator first, InputIterator last, Predicate pred);
25
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
26
  bool none_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
27
  ForwardIterator first, ForwardIterator last, Predicate pred);
28
 
 
 
 
 
 
 
 
 
 
29
  // [alg.foreach], for each
30
  template<class InputIterator, class Function>
31
- Function for_each(InputIterator first, InputIterator last, Function f);
32
  template<class ExecutionPolicy, class ForwardIterator, class Function>
33
  void for_each(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
34
  ForwardIterator first, ForwardIterator last, Function f);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  template<class InputIterator, class Size, class Function>
36
- InputIterator for_each_n(InputIterator first, Size n, Function f);
37
  template<class ExecutionPolicy, class ForwardIterator, class Size, class Function>
38
  ForwardIterator for_each_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
39
  ForwardIterator first, Size n, Function f);
40
 
 
 
 
 
 
 
 
 
 
 
41
  // [alg.find], find
42
  template<class InputIterator, class T>
43
- InputIterator find(InputIterator first, InputIterator last,
44
  const T& value);
45
  template<class ExecutionPolicy, class ForwardIterator, class T>
46
  ForwardIterator find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
47
  ForwardIterator first, ForwardIterator last,
48
  const T& value);
49
  template<class InputIterator, class Predicate>
50
- InputIterator find_if(InputIterator first, InputIterator last,
51
  Predicate pred);
52
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
53
  ForwardIterator find_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
54
  ForwardIterator first, ForwardIterator last,
55
  Predicate pred);
56
  template<class InputIterator, class Predicate>
57
- InputIterator find_if_not(InputIterator first, InputIterator last,
58
  Predicate pred);
59
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
60
  ForwardIterator find_if_not(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
61
  ForwardIterator first, ForwardIterator last,
62
  Predicate pred);
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  // [alg.find.end], find end
65
  template<class ForwardIterator1, class ForwardIterator2>
66
- ForwardIterator1
67
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
68
  ForwardIterator2 first2, ForwardIterator2 last2);
69
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
70
- ForwardIterator1
71
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
72
  ForwardIterator2 first2, ForwardIterator2 last2,
73
  BinaryPredicate pred);
74
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
75
  ForwardIterator1
@@ -82,17 +183,32 @@ namespace std {
82
  find_end(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
83
  ForwardIterator1 first1, ForwardIterator1 last1,
84
  ForwardIterator2 first2, ForwardIterator2 last2,
85
  BinaryPredicate pred);
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  // [alg.find.first.of], find first
88
  template<class InputIterator, class ForwardIterator>
89
- InputIterator
90
  find_first_of(InputIterator first1, InputIterator last1,
91
  ForwardIterator first2, ForwardIterator last2);
92
  template<class InputIterator, class ForwardIterator, class BinaryPredicate>
93
- InputIterator
94
  find_first_of(InputIterator first1, InputIterator last1,
95
  ForwardIterator first2, ForwardIterator last2,
96
  BinaryPredicate pred);
97
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
98
  ForwardIterator1
@@ -105,59 +221,108 @@ namespace std {
105
  find_first_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
106
  ForwardIterator1 first1, ForwardIterator1 last1,
107
  ForwardIterator2 first2, ForwardIterator2 last2,
108
  BinaryPredicate pred);
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  // [alg.adjacent.find], adjacent find
111
  template<class ForwardIterator>
112
- ForwardIterator adjacent_find(ForwardIterator first,
113
- ForwardIterator last);
114
  template<class ForwardIterator, class BinaryPredicate>
115
- ForwardIterator adjacent_find(ForwardIterator first,
116
- ForwardIterator last,
117
  BinaryPredicate pred);
118
  template<class ExecutionPolicy, class ForwardIterator>
119
- ForwardIterator adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
120
- ForwardIterator first,
121
- ForwardIterator last);
122
  template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
123
- ForwardIterator adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
124
- ForwardIterator first,
125
- ForwardIterator last,
126
  BinaryPredicate pred);
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  // [alg.count], count
129
  template<class InputIterator, class T>
130
- typename iterator_traits<InputIterator>::difference_type
131
  count(InputIterator first, InputIterator last, const T& value);
132
  template<class ExecutionPolicy, class ForwardIterator, class T>
133
  typename iterator_traits<ForwardIterator>::difference_type
134
  count(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
135
  ForwardIterator first, ForwardIterator last, const T& value);
136
  template<class InputIterator, class Predicate>
137
- typename iterator_traits<InputIterator>::difference_type
138
  count_if(InputIterator first, InputIterator last, Predicate pred);
139
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
140
  typename iterator_traits<ForwardIterator>::difference_type
141
  count_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
142
  ForwardIterator first, ForwardIterator last, Predicate pred);
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  // [mismatch], mismatch
145
  template<class InputIterator1, class InputIterator2>
146
- pair<InputIterator1, InputIterator2>
147
  mismatch(InputIterator1 first1, InputIterator1 last1,
148
  InputIterator2 first2);
149
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
150
- pair<InputIterator1, InputIterator2>
151
  mismatch(InputIterator1 first1, InputIterator1 last1,
152
  InputIterator2 first2, BinaryPredicate pred);
153
  template<class InputIterator1, class InputIterator2>
154
- pair<InputIterator1, InputIterator2>
155
  mismatch(InputIterator1 first1, InputIterator1 last1,
156
  InputIterator2 first2, InputIterator2 last2);
157
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
158
- pair<InputIterator1, InputIterator2>
159
  mismatch(InputIterator1 first1, InputIterator1 last1,
160
  InputIterator2 first2, InputIterator2 last2,
161
  BinaryPredicate pred);
162
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
163
  pair<ForwardIterator1, ForwardIterator2>
@@ -181,22 +346,40 @@ namespace std {
181
  mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
182
  ForwardIterator1 first1, ForwardIterator1 last1,
183
  ForwardIterator2 first2, ForwardIterator2 last2,
184
  BinaryPredicate pred);
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  // [alg.equal], equal
187
  template<class InputIterator1, class InputIterator2>
188
- bool equal(InputIterator1 first1, InputIterator1 last1,
189
  InputIterator2 first2);
190
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
191
- bool equal(InputIterator1 first1, InputIterator1 last1,
192
  InputIterator2 first2, BinaryPredicate pred);
193
  template<class InputIterator1, class InputIterator2>
194
- bool equal(InputIterator1 first1, InputIterator1 last1,
195
  InputIterator2 first2, InputIterator2 last2);
196
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
197
- bool equal(InputIterator1 first1, InputIterator1 last1,
198
  InputIterator2 first2, InputIterator2 last2,
199
  BinaryPredicate pred);
200
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
201
  bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
202
  ForwardIterator1 first1, ForwardIterator1 last1,
@@ -215,529 +398,1240 @@ namespace std {
215
  bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
216
  ForwardIterator1 first1, ForwardIterator1 last1,
217
  ForwardIterator2 first2, ForwardIterator2 last2,
218
  BinaryPredicate pred);
219
 
220
- // [alg.is_permutation], is permutation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  template<class ForwardIterator1, class ForwardIterator2>
222
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
223
  ForwardIterator2 first2);
224
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
225
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
226
  ForwardIterator2 first2, BinaryPredicate pred);
227
-
228
  template<class ForwardIterator1, class ForwardIterator2>
229
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
230
  ForwardIterator2 first2, ForwardIterator2 last2);
231
-
232
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
233
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
234
  ForwardIterator2 first2, ForwardIterator2 last2,
235
  BinaryPredicate pred);
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  // [alg.search], search
238
  template<class ForwardIterator1, class ForwardIterator2>
239
- ForwardIterator1 search(
240
- ForwardIterator1 first1, ForwardIterator1 last1,
241
  ForwardIterator2 first2, ForwardIterator2 last2);
242
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
243
- ForwardIterator1 search(
244
- ForwardIterator1 first1, ForwardIterator1 last1,
245
  ForwardIterator2 first2, ForwardIterator2 last2,
246
  BinaryPredicate pred);
247
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
248
- ForwardIterator1 search(
249
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
250
  ForwardIterator1 first1, ForwardIterator1 last1,
251
  ForwardIterator2 first2, ForwardIterator2 last2);
252
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
253
  class BinaryPredicate>
254
- ForwardIterator1 search(
255
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
256
  ForwardIterator1 first1, ForwardIterator1 last1,
257
  ForwardIterator2 first2, ForwardIterator2 last2,
258
  BinaryPredicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  template<class ForwardIterator, class Size, class T>
260
- ForwardIterator search_n(ForwardIterator first, ForwardIterator last,
 
261
  Size count, const T& value);
262
  template<class ForwardIterator, class Size, class T, class BinaryPredicate>
263
- ForwardIterator search_n(ForwardIterator first, ForwardIterator last,
 
264
  Size count, const T& value,
265
  BinaryPredicate pred);
266
  template<class ExecutionPolicy, class ForwardIterator, class Size, class T>
267
- ForwardIterator search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
268
  ForwardIterator first, ForwardIterator last,
269
  Size count, const T& value);
270
  template<class ExecutionPolicy, class ForwardIterator, class Size, class T,
271
  class BinaryPredicate>
272
- ForwardIterator search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
273
  ForwardIterator first, ForwardIterator last,
274
  Size count, const T& value,
275
  BinaryPredicate pred);
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  template<class ForwardIterator, class Searcher>
278
- ForwardIterator search(ForwardIterator first, ForwardIterator last,
279
- const Searcher& searcher);
280
 
281
- // [alg.modifying.operations], modifying sequence operations
282
  // [alg.copy], copy
283
  template<class InputIterator, class OutputIterator>
284
- OutputIterator copy(InputIterator first, InputIterator last,
285
  OutputIterator result);
286
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
287
  ForwardIterator2 copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
288
  ForwardIterator1 first, ForwardIterator1 last,
289
  ForwardIterator2 result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  template<class InputIterator, class Size, class OutputIterator>
291
- OutputIterator copy_n(InputIterator first, Size n,
292
  OutputIterator result);
293
  template<class ExecutionPolicy, class ForwardIterator1, class Size,
294
  class ForwardIterator2>
295
  ForwardIterator2 copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
296
  ForwardIterator1 first, Size n,
297
  ForwardIterator2 result);
 
 
 
 
 
 
 
 
 
 
 
298
  template<class InputIterator, class OutputIterator, class Predicate>
299
- OutputIterator copy_if(InputIterator first, InputIterator last,
300
  OutputIterator result, Predicate pred);
301
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
302
  class Predicate>
303
  ForwardIterator2 copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
304
  ForwardIterator1 first, ForwardIterator1 last,
305
  ForwardIterator2 result, Predicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  template<class BidirectionalIterator1, class BidirectionalIterator2>
307
- BidirectionalIterator2 copy_backward(
308
- BidirectionalIterator1 first, BidirectionalIterator1 last,
309
  BidirectionalIterator2 result);
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  // [alg.move], move
312
  template<class InputIterator, class OutputIterator>
313
- OutputIterator move(InputIterator first, InputIterator last,
314
  OutputIterator result);
315
  template<class ExecutionPolicy, class ForwardIterator1,
316
  class ForwardIterator2>
317
  ForwardIterator2 move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
318
  ForwardIterator1 first, ForwardIterator1 last,
319
  ForwardIterator2 result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  template<class BidirectionalIterator1, class BidirectionalIterator2>
321
- BidirectionalIterator2 move_backward(
322
- BidirectionalIterator1 first, BidirectionalIterator1 last,
323
  BidirectionalIterator2 result);
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  // [alg.swap], swap
326
  template<class ForwardIterator1, class ForwardIterator2>
327
- ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1,
328
  ForwardIterator2 first2);
329
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
330
  ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
331
  ForwardIterator1 first1, ForwardIterator1 last1,
332
  ForwardIterator2 first2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  template<class ForwardIterator1, class ForwardIterator2>
334
- void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
335
 
336
  // [alg.transform], transform
337
  template<class InputIterator, class OutputIterator, class UnaryOperation>
338
- OutputIterator transform(InputIterator first, InputIterator last,
 
339
  OutputIterator result, UnaryOperation op);
340
  template<class InputIterator1, class InputIterator2, class OutputIterator,
341
  class BinaryOperation>
342
- OutputIterator transform(InputIterator1 first1, InputIterator1 last1,
 
343
  InputIterator2 first2, OutputIterator result,
344
  BinaryOperation binary_op);
345
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
346
  class UnaryOperation>
347
- ForwardIterator2 transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
348
- ForwardIterator1 first, ForwardIterator1 last,
 
349
  ForwardIterator2 result, UnaryOperation op);
350
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
351
  class ForwardIterator, class BinaryOperation>
352
- ForwardIterator transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
353
  ForwardIterator1 first1, ForwardIterator1 last1,
354
  ForwardIterator2 first2, ForwardIterator result,
355
  BinaryOperation binary_op);
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  // [alg.replace], replace
358
  template<class ForwardIterator, class T>
359
- void replace(ForwardIterator first, ForwardIterator last,
360
  const T& old_value, const T& new_value);
361
  template<class ExecutionPolicy, class ForwardIterator, class T>
362
  void replace(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
363
  ForwardIterator first, ForwardIterator last,
364
  const T& old_value, const T& new_value);
365
  template<class ForwardIterator, class Predicate, class T>
366
- void replace_if(ForwardIterator first, ForwardIterator last,
367
  Predicate pred, const T& new_value);
368
  template<class ExecutionPolicy, class ForwardIterator, class Predicate, class T>
369
  void replace_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
370
  ForwardIterator first, ForwardIterator last,
371
  Predicate pred, const T& new_value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  template<class InputIterator, class OutputIterator, class T>
373
- OutputIterator replace_copy(InputIterator first, InputIterator last,
374
  OutputIterator result,
375
  const T& old_value, const T& new_value);
376
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
377
  ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
378
  ForwardIterator1 first, ForwardIterator1 last,
379
  ForwardIterator2 result,
380
  const T& old_value, const T& new_value);
381
  template<class InputIterator, class OutputIterator, class Predicate, class T>
382
- OutputIterator replace_copy_if(InputIterator first, InputIterator last,
383
  OutputIterator result,
384
  Predicate pred, const T& new_value);
385
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
386
  class Predicate, class T>
387
  ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
388
  ForwardIterator1 first, ForwardIterator1 last,
389
  ForwardIterator2 result,
390
  Predicate pred, const T& new_value);
391
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  // [alg.fill], fill
393
  template<class ForwardIterator, class T>
394
- void fill(ForwardIterator first, ForwardIterator last, const T& value);
395
- template<class ExecutionPolicy, class ForwardIterator,
396
- class T>
397
  void fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
398
  ForwardIterator first, ForwardIterator last, const T& value);
399
  template<class OutputIterator, class Size, class T>
400
- OutputIterator fill_n(OutputIterator first, Size n, const T& value);
401
  template<class ExecutionPolicy, class ForwardIterator,
402
  class Size, class T>
403
  ForwardIterator fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
404
  ForwardIterator first, Size n, const T& value);
405
 
 
 
 
 
 
 
 
 
 
406
  // [alg.generate], generate
407
  template<class ForwardIterator, class Generator>
408
- void generate(ForwardIterator first, ForwardIterator last,
409
  Generator gen);
410
  template<class ExecutionPolicy, class ForwardIterator, class Generator>
411
  void generate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
412
  ForwardIterator first, ForwardIterator last,
413
  Generator gen);
414
  template<class OutputIterator, class Size, class Generator>
415
- OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
416
  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
417
  ForwardIterator generate_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
418
  ForwardIterator first, Size n, Generator gen);
419
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  // [alg.remove], remove
421
  template<class ForwardIterator, class T>
422
- ForwardIterator remove(ForwardIterator first, ForwardIterator last,
423
  const T& value);
424
  template<class ExecutionPolicy, class ForwardIterator, class T>
425
  ForwardIterator remove(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
426
  ForwardIterator first, ForwardIterator last,
427
  const T& value);
428
  template<class ForwardIterator, class Predicate>
429
- ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
430
  Predicate pred);
431
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
432
  ForwardIterator remove_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
433
  ForwardIterator first, ForwardIterator last,
434
  Predicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  template<class InputIterator, class OutputIterator, class T>
436
- OutputIterator remove_copy(InputIterator first, InputIterator last,
 
437
  OutputIterator result, const T& value);
438
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
439
  class T>
440
- ForwardIterator2 remove_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
441
  ForwardIterator1 first, ForwardIterator1 last,
442
  ForwardIterator2 result, const T& value);
443
  template<class InputIterator, class OutputIterator, class Predicate>
444
- OutputIterator remove_copy_if(InputIterator first, InputIterator last,
 
445
  OutputIterator result, Predicate pred);
446
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
447
  class Predicate>
448
- ForwardIterator2 remove_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
449
  ForwardIterator1 first, ForwardIterator1 last,
450
  ForwardIterator2 result, Predicate pred);
451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  // [alg.unique], unique
453
  template<class ForwardIterator>
454
- ForwardIterator unique(ForwardIterator first, ForwardIterator last);
455
  template<class ForwardIterator, class BinaryPredicate>
456
- ForwardIterator unique(ForwardIterator first, ForwardIterator last,
457
  BinaryPredicate pred);
458
  template<class ExecutionPolicy, class ForwardIterator>
459
  ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
460
  ForwardIterator first, ForwardIterator last);
461
  template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
462
  ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
463
  ForwardIterator first, ForwardIterator last,
464
  BinaryPredicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
465
  template<class InputIterator, class OutputIterator>
466
- OutputIterator unique_copy(InputIterator first, InputIterator last,
 
467
  OutputIterator result);
468
  template<class InputIterator, class OutputIterator, class BinaryPredicate>
469
- OutputIterator unique_copy(InputIterator first, InputIterator last,
 
470
  OutputIterator result, BinaryPredicate pred);
471
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
472
- ForwardIterator2 unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
473
  ForwardIterator1 first, ForwardIterator1 last,
474
  ForwardIterator2 result);
475
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
476
  class BinaryPredicate>
477
- ForwardIterator2 unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
478
  ForwardIterator1 first, ForwardIterator1 last,
479
  ForwardIterator2 result, BinaryPredicate pred);
480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  // [alg.reverse], reverse
482
  template<class BidirectionalIterator>
483
- void reverse(BidirectionalIterator first, BidirectionalIterator last);
484
  template<class ExecutionPolicy, class BidirectionalIterator>
485
  void reverse(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
486
  BidirectionalIterator first, BidirectionalIterator last);
 
 
 
 
 
 
 
 
 
 
487
  template<class BidirectionalIterator, class OutputIterator>
488
- OutputIterator reverse_copy(BidirectionalIterator first,
489
- BidirectionalIterator last,
490
  OutputIterator result);
491
  template<class ExecutionPolicy, class BidirectionalIterator, class ForwardIterator>
492
- ForwardIterator reverse_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
493
- BidirectionalIterator first,
494
- BidirectionalIterator last,
495
  ForwardIterator result);
496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  // [alg.rotate], rotate
498
  template<class ForwardIterator>
499
- ForwardIterator rotate(ForwardIterator first,
500
  ForwardIterator middle,
501
  ForwardIterator last);
502
  template<class ExecutionPolicy, class ForwardIterator>
503
  ForwardIterator rotate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
504
  ForwardIterator first,
505
  ForwardIterator middle,
506
  ForwardIterator last);
 
 
 
 
 
 
 
 
 
507
  template<class ForwardIterator, class OutputIterator>
508
- OutputIterator rotate_copy(
509
- ForwardIterator first, ForwardIterator middle,
510
  ForwardIterator last, OutputIterator result);
511
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
512
- ForwardIterator2 rotate_copy(
513
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
514
  ForwardIterator1 first, ForwardIterator1 middle,
515
  ForwardIterator1 last, ForwardIterator2 result);
516
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  // [alg.random.sample], sample
518
  template<class PopulationIterator, class SampleIterator,
519
  class Distance, class UniformRandomBitGenerator>
520
  SampleIterator sample(PopulationIterator first, PopulationIterator last,
521
  SampleIterator out, Distance n,
522
  UniformRandomBitGenerator&& g);
523
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  // [alg.random.shuffle], shuffle
525
  template<class RandomAccessIterator, class UniformRandomBitGenerator>
526
  void shuffle(RandomAccessIterator first,
527
  RandomAccessIterator last,
528
  UniformRandomBitGenerator&& g);
529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  // [alg.partitions], partitions
531
  template<class InputIterator, class Predicate>
532
- bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);
533
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
534
  bool is_partitioned(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
535
  ForwardIterator first, ForwardIterator last, Predicate pred);
536
 
 
 
 
 
 
 
 
 
 
537
  template<class ForwardIterator, class Predicate>
538
- ForwardIterator partition(ForwardIterator first,
539
  ForwardIterator last,
540
  Predicate pred);
541
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
542
  ForwardIterator partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
543
  ForwardIterator first,
544
  ForwardIterator last,
545
  Predicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  template<class BidirectionalIterator, class Predicate>
547
  BidirectionalIterator stable_partition(BidirectionalIterator first,
548
  BidirectionalIterator last,
549
  Predicate pred);
550
  template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
551
  BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
552
  BidirectionalIterator first,
553
  BidirectionalIterator last,
554
  Predicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
555
  template<class InputIterator, class OutputIterator1,
556
  class OutputIterator2, class Predicate>
557
- pair<OutputIterator1, OutputIterator2>
558
  partition_copy(InputIterator first, InputIterator last,
559
  OutputIterator1 out_true, OutputIterator2 out_false,
560
  Predicate pred);
561
  template<class ExecutionPolicy, class ForwardIterator, class ForwardIterator1,
562
  class ForwardIterator2, class Predicate>
563
  pair<ForwardIterator1, ForwardIterator2>
564
  partition_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
565
  ForwardIterator first, ForwardIterator last,
566
  ForwardIterator1 out_true, ForwardIterator2 out_false,
567
  Predicate pred);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  template<class ForwardIterator, class Predicate>
569
- ForwardIterator partition_point(ForwardIterator first,
570
- ForwardIterator last,
571
  Predicate pred);
572
 
573
- // [alg.sorting], sorting and related operations
574
- // [alg.sort], sorting
575
- template<class RandomAccessIterator>
576
- void sort(RandomAccessIterator first, RandomAccessIterator last);
577
- template<class RandomAccessIterator, class Compare>
578
- void sort(RandomAccessIterator first, RandomAccessIterator last,
579
- Compare comp);
580
- template<class ExecutionPolicy, class RandomAccessIterator>
581
- void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
582
- RandomAccessIterator first, RandomAccessIterator last);
583
- template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
584
- void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
585
- RandomAccessIterator first, RandomAccessIterator last,
586
- Compare comp);
587
-
588
- template<class RandomAccessIterator>
589
- void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
590
- template<class RandomAccessIterator, class Compare>
591
- void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
592
- Compare comp);
593
- template<class ExecutionPolicy, class RandomAccessIterator>
594
- void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
595
- RandomAccessIterator first, RandomAccessIterator last);
596
- template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
597
- void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
598
- RandomAccessIterator first, RandomAccessIterator last,
599
- Compare comp);
600
-
601
- template<class RandomAccessIterator>
602
- void partial_sort(RandomAccessIterator first,
603
- RandomAccessIterator middle,
604
- RandomAccessIterator last);
605
- template<class RandomAccessIterator, class Compare>
606
- void partial_sort(RandomAccessIterator first,
607
- RandomAccessIterator middle,
608
- RandomAccessIterator last, Compare comp);
609
- template<class ExecutionPolicy, class RandomAccessIterator>
610
- void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
611
- RandomAccessIterator first,
612
- RandomAccessIterator middle,
613
- RandomAccessIterator last);
614
- template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
615
- void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
616
- RandomAccessIterator first,
617
- RandomAccessIterator middle,
618
- RandomAccessIterator last, Compare comp);
619
- template<class InputIterator, class RandomAccessIterator>
620
- RandomAccessIterator partial_sort_copy(
621
- InputIterator first, InputIterator last,
622
- RandomAccessIterator result_first,
623
- RandomAccessIterator result_last);
624
- template<class InputIterator, class RandomAccessIterator, class Compare>
625
- RandomAccessIterator partial_sort_copy(
626
- InputIterator first, InputIterator last,
627
- RandomAccessIterator result_first,
628
- RandomAccessIterator result_last,
629
- Compare comp);
630
- template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator>
631
- RandomAccessIterator partial_sort_copy(
632
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
633
- ForwardIterator first, ForwardIterator last,
634
- RandomAccessIterator result_first,
635
- RandomAccessIterator result_last);
636
- template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator,
637
- class Compare>
638
- RandomAccessIterator partial_sort_copy(
639
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
640
- ForwardIterator first, ForwardIterator last,
641
- RandomAccessIterator result_first,
642
- RandomAccessIterator result_last,
643
- Compare comp);
644
- template<class ForwardIterator>
645
- bool is_sorted(ForwardIterator first, ForwardIterator last);
646
- template<class ForwardIterator, class Compare>
647
- bool is_sorted(ForwardIterator first, ForwardIterator last,
648
- Compare comp);
649
- template<class ExecutionPolicy, class ForwardIterator>
650
- bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
651
- ForwardIterator first, ForwardIterator last);
652
- template<class ExecutionPolicy, class ForwardIterator, class Compare>
653
- bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
654
- ForwardIterator first, ForwardIterator last,
655
- Compare comp);
656
- template<class ForwardIterator>
657
- ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last);
658
- template<class ForwardIterator, class Compare>
659
- ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last,
660
- Compare comp);
661
- template<class ExecutionPolicy, class ForwardIterator>
662
- ForwardIterator is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
663
- ForwardIterator first, ForwardIterator last);
664
- template<class ExecutionPolicy, class ForwardIterator, class Compare>
665
- ForwardIterator is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
666
- ForwardIterator first, ForwardIterator last,
667
- Compare comp);
668
-
669
- // [alg.nth.element], Nth element
670
- template<class RandomAccessIterator>
671
- void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
672
- RandomAccessIterator last);
673
- template<class RandomAccessIterator, class Compare>
674
- void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
675
- RandomAccessIterator last, Compare comp);
676
- template<class ExecutionPolicy, class RandomAccessIterator>
677
- void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
678
- RandomAccessIterator first, RandomAccessIterator nth,
679
- RandomAccessIterator last);
680
- template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
681
- void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
682
- RandomAccessIterator first, RandomAccessIterator nth,
683
- RandomAccessIterator last, Compare comp);
684
-
685
- // [alg.binary.search], binary search
686
- template<class ForwardIterator, class T>
687
- ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last,
688
- const T& value);
689
- template<class ForwardIterator, class T, class Compare>
690
- ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last,
691
- const T& value, Compare comp);
692
-
693
- template<class ForwardIterator, class T>
694
- ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last,
695
- const T& value);
696
- template<class ForwardIterator, class T, class Compare>
697
- ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last,
698
- const T& value, Compare comp);
699
-
700
- template<class ForwardIterator, class T>
701
- pair<ForwardIterator, ForwardIterator>
702
- equal_range(ForwardIterator first, ForwardIterator last,
703
- const T& value);
704
- template<class ForwardIterator, class T, class Compare>
705
- pair<ForwardIterator, ForwardIterator>
706
- equal_range(ForwardIterator first, ForwardIterator last,
707
- const T& value, Compare comp);
708
-
709
- template<class ForwardIterator, class T>
710
- bool binary_search(ForwardIterator first, ForwardIterator last,
711
- const T& value);
712
- template<class ForwardIterator, class T, class Compare>
713
- bool binary_search(ForwardIterator first, ForwardIterator last,
714
- const T& value, Compare comp);
715
 
716
  // [alg.merge], merge
717
  template<class InputIterator1, class InputIterator2, class OutputIterator>
718
- OutputIterator merge(InputIterator1 first1, InputIterator1 last1,
 
719
  InputIterator2 first2, InputIterator2 last2,
720
  OutputIterator result);
721
  template<class InputIterator1, class InputIterator2, class OutputIterator,
722
  class Compare>
723
- OutputIterator merge(InputIterator1 first1, InputIterator1 last1,
 
724
  InputIterator2 first2, InputIterator2 last2,
725
  OutputIterator result, Compare comp);
726
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
727
  class ForwardIterator>
728
- ForwardIterator merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
729
  ForwardIterator1 first1, ForwardIterator1 last1,
730
  ForwardIterator2 first2, ForwardIterator2 last2,
731
  ForwardIterator result);
732
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
733
  class ForwardIterator, class Compare>
734
- ForwardIterator merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
735
  ForwardIterator1 first1, ForwardIterator1 last1,
736
  ForwardIterator2 first2, ForwardIterator2 last2,
737
  ForwardIterator result, Compare comp);
738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  template<class BidirectionalIterator>
740
  void inplace_merge(BidirectionalIterator first,
741
  BidirectionalIterator middle,
742
  BidirectionalIterator last);
743
  template<class BidirectionalIterator, class Compare>
@@ -753,196 +1647,428 @@ namespace std {
753
  void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
754
  BidirectionalIterator first,
755
  BidirectionalIterator middle,
756
  BidirectionalIterator last, Compare comp);
757
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  // [alg.set.operations], set operations
759
  template<class InputIterator1, class InputIterator2>
760
- bool includes(InputIterator1 first1, InputIterator1 last1,
761
  InputIterator2 first2, InputIterator2 last2);
762
  template<class InputIterator1, class InputIterator2, class Compare>
763
- bool includes(InputIterator1 first1, InputIterator1 last1,
764
- InputIterator2 first2, InputIterator2 last2, Compare comp);
 
765
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
766
  bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
767
  ForwardIterator1 first1, ForwardIterator1 last1,
768
  ForwardIterator2 first2, ForwardIterator2 last2);
769
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
770
  class Compare>
771
  bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
772
  ForwardIterator1 first1, ForwardIterator1 last1,
773
- ForwardIterator2 first2, ForwardIterator2 last2, Compare comp);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
 
775
  template<class InputIterator1, class InputIterator2, class OutputIterator>
776
- OutputIterator set_union(InputIterator1 first1, InputIterator1 last1,
 
777
  InputIterator2 first2, InputIterator2 last2,
778
  OutputIterator result);
779
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
780
- OutputIterator set_union(InputIterator1 first1, InputIterator1 last1,
 
781
  InputIterator2 first2, InputIterator2 last2,
782
  OutputIterator result, Compare comp);
783
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
784
  class ForwardIterator>
785
- ForwardIterator set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
786
  ForwardIterator1 first1, ForwardIterator1 last1,
787
  ForwardIterator2 first2, ForwardIterator2 last2,
788
  ForwardIterator result);
789
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
790
  class ForwardIterator, class Compare>
791
- ForwardIterator set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
792
  ForwardIterator1 first1, ForwardIterator1 last1,
793
  ForwardIterator2 first2, ForwardIterator2 last2,
794
  ForwardIterator result, Compare comp);
795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  template<class InputIterator1, class InputIterator2, class OutputIterator>
797
- OutputIterator set_intersection(
798
- InputIterator1 first1, InputIterator1 last1,
799
  InputIterator2 first2, InputIterator2 last2,
800
  OutputIterator result);
801
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
802
- OutputIterator set_intersection(
803
- InputIterator1 first1, InputIterator1 last1,
804
  InputIterator2 first2, InputIterator2 last2,
805
  OutputIterator result, Compare comp);
806
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
807
  class ForwardIterator>
808
- ForwardIterator set_intersection(
809
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
810
  ForwardIterator1 first1, ForwardIterator1 last1,
811
  ForwardIterator2 first2, ForwardIterator2 last2,
812
  ForwardIterator result);
813
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
814
  class ForwardIterator, class Compare>
815
- ForwardIterator set_intersection(
816
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
817
  ForwardIterator1 first1, ForwardIterator1 last1,
818
  ForwardIterator2 first2, ForwardIterator2 last2,
819
  ForwardIterator result, Compare comp);
820
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  template<class InputIterator1, class InputIterator2, class OutputIterator>
822
- OutputIterator set_difference(
823
- InputIterator1 first1, InputIterator1 last1,
824
  InputIterator2 first2, InputIterator2 last2,
825
  OutputIterator result);
826
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
827
- OutputIterator set_difference(
828
- InputIterator1 first1, InputIterator1 last1,
829
  InputIterator2 first2, InputIterator2 last2,
830
  OutputIterator result, Compare comp);
831
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
832
  class ForwardIterator>
833
- ForwardIterator set_difference(
834
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
835
  ForwardIterator1 first1, ForwardIterator1 last1,
836
  ForwardIterator2 first2, ForwardIterator2 last2,
837
  ForwardIterator result);
838
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
839
  class ForwardIterator, class Compare>
840
- ForwardIterator set_difference(
841
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
842
  ForwardIterator1 first1, ForwardIterator1 last1,
843
  ForwardIterator2 first2, ForwardIterator2 last2,
844
  ForwardIterator result, Compare comp);
845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
846
  template<class InputIterator1, class InputIterator2, class OutputIterator>
847
- OutputIterator set_symmetric_difference(
848
- InputIterator1 first1, InputIterator1 last1,
849
  InputIterator2 first2, InputIterator2 last2,
850
  OutputIterator result);
851
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
852
- OutputIterator set_symmetric_difference(
853
- InputIterator1 first1, InputIterator1 last1,
854
  InputIterator2 first2, InputIterator2 last2,
855
  OutputIterator result, Compare comp);
856
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
857
  class ForwardIterator>
858
- ForwardIterator set_symmetric_difference(
859
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
860
  ForwardIterator1 first1, ForwardIterator1 last1,
861
  ForwardIterator2 first2, ForwardIterator2 last2,
862
  ForwardIterator result);
863
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
864
  class ForwardIterator, class Compare>
865
- ForwardIterator set_symmetric_difference(
866
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
867
  ForwardIterator1 first1, ForwardIterator1 last1,
868
  ForwardIterator2 first2, ForwardIterator2 last2,
869
  ForwardIterator result, Compare comp);
870
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
  // [alg.heap.operations], heap operations
872
  template<class RandomAccessIterator>
873
- void push_heap(RandomAccessIterator first, RandomAccessIterator last);
874
  template<class RandomAccessIterator, class Compare>
875
- void push_heap(RandomAccessIterator first, RandomAccessIterator last,
876
  Compare comp);
877
 
 
 
 
 
 
 
 
 
 
 
 
 
878
  template<class RandomAccessIterator>
879
- void pop_heap(RandomAccessIterator first, RandomAccessIterator last);
880
  template<class RandomAccessIterator, class Compare>
881
- void pop_heap(RandomAccessIterator first, RandomAccessIterator last,
882
  Compare comp);
883
 
 
 
 
 
 
 
 
 
 
 
 
 
884
  template<class RandomAccessIterator>
885
- void make_heap(RandomAccessIterator first, RandomAccessIterator last);
886
  template<class RandomAccessIterator, class Compare>
887
- void make_heap(RandomAccessIterator first, RandomAccessIterator last,
888
  Compare comp);
889
 
 
 
 
 
 
 
 
 
 
 
 
 
890
  template<class RandomAccessIterator>
891
- void sort_heap(RandomAccessIterator first, RandomAccessIterator last);
892
  template<class RandomAccessIterator, class Compare>
893
- void sort_heap(RandomAccessIterator first, RandomAccessIterator last,
894
  Compare comp);
895
 
 
 
 
 
 
 
 
 
 
 
 
 
896
  template<class RandomAccessIterator>
897
- bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
898
  template<class RandomAccessIterator, class Compare>
899
- bool is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
 
900
  template<class ExecutionPolicy, class RandomAccessIterator>
901
  bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
902
  RandomAccessIterator first, RandomAccessIterator last);
903
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
904
  bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
905
- RandomAccessIterator first, RandomAccessIterator last, Compare comp);
 
 
 
 
 
 
 
 
 
 
 
906
  template<class RandomAccessIterator>
907
- RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
 
908
  template<class RandomAccessIterator, class Compare>
909
- RandomAccessIterator is_heap_until(RandomAccessIterator first, RandomAccessIterator last,
 
910
  Compare comp);
911
  template<class ExecutionPolicy, class RandomAccessIterator>
912
- RandomAccessIterator is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
913
  RandomAccessIterator first, RandomAccessIterator last);
914
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
915
- RandomAccessIterator is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
916
  RandomAccessIterator first, RandomAccessIterator last,
917
  Compare comp);
918
 
 
 
 
 
 
 
 
 
 
 
919
  // [alg.min.max], minimum and maximum
920
  template<class T> constexpr const T& min(const T& a, const T& b);
921
  template<class T, class Compare>
922
  constexpr const T& min(const T& a, const T& b, Compare comp);
923
  template<class T>
924
  constexpr T min(initializer_list<T> t);
925
  template<class T, class Compare>
926
  constexpr T min(initializer_list<T> t, Compare comp);
927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
928
  template<class T> constexpr const T& max(const T& a, const T& b);
929
  template<class T, class Compare>
930
  constexpr const T& max(const T& a, const T& b, Compare comp);
931
  template<class T>
932
  constexpr T max(initializer_list<T> t);
933
  template<class T, class Compare>
934
  constexpr T max(initializer_list<T> t, Compare comp);
935
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  template<class T> constexpr pair<const T&, const T&> minmax(const T& a, const T& b);
937
  template<class T, class Compare>
938
  constexpr pair<const T&, const T&> minmax(const T& a, const T& b, Compare comp);
939
  template<class T>
940
  constexpr pair<T, T> minmax(initializer_list<T> t);
941
  template<class T, class Compare>
942
  constexpr pair<T, T> minmax(initializer_list<T> t, Compare comp);
943
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
944
  template<class ForwardIterator>
945
  constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
946
  template<class ForwardIterator, class Compare>
947
  constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
948
  Compare comp);
@@ -951,10 +2077,21 @@ namespace std {
951
  ForwardIterator first, ForwardIterator last);
952
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
953
  ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
954
  ForwardIterator first, ForwardIterator last,
955
  Compare comp);
 
 
 
 
 
 
 
 
 
 
 
956
  template<class ForwardIterator>
957
  constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
958
  template<class ForwardIterator, class Compare>
959
  constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
960
  Compare comp);
@@ -963,10 +2100,21 @@ namespace std {
963
  ForwardIterator first, ForwardIterator last);
964
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
965
  ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
966
  ForwardIterator first, ForwardIterator last,
967
  Compare comp);
 
 
 
 
 
 
 
 
 
 
 
968
  template<class ForwardIterator>
969
  constexpr pair<ForwardIterator, ForwardIterator>
970
  minmax_element(ForwardIterator first, ForwardIterator last);
971
  template<class ForwardIterator, class Compare>
972
  constexpr pair<ForwardIterator, ForwardIterator>
@@ -978,50 +2126,133 @@ namespace std {
978
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
979
  pair<ForwardIterator, ForwardIterator>
980
  minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
981
  ForwardIterator first, ForwardIterator last, Compare comp);
982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
983
  // [alg.clamp], bounded value
984
  template<class T>
985
  constexpr const T& clamp(const T& v, const T& lo, const T& hi);
986
  template<class T, class Compare>
987
  constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp);
988
 
 
 
 
 
 
 
 
989
  // [alg.lex.comparison], lexicographical comparison
990
  template<class InputIterator1, class InputIterator2>
991
- bool lexicographical_compare(
992
- InputIterator1 first1, InputIterator1 last1,
993
  InputIterator2 first2, InputIterator2 last2);
994
  template<class InputIterator1, class InputIterator2, class Compare>
995
- bool lexicographical_compare(
996
- InputIterator1 first1, InputIterator1 last1,
997
  InputIterator2 first2, InputIterator2 last2,
998
  Compare comp);
999
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
1000
- bool lexicographical_compare(
1001
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1002
  ForwardIterator1 first1, ForwardIterator1 last1,
1003
  ForwardIterator2 first2, ForwardIterator2 last2);
1004
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1005
  class Compare>
1006
- bool lexicographical_compare(
1007
- ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1008
  ForwardIterator1 first1, ForwardIterator1 last1,
1009
  ForwardIterator2 first2, ForwardIterator2 last2,
1010
  Compare comp);
1011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1012
  // [alg.permutation.generators], permutations
1013
  template<class BidirectionalIterator>
1014
- bool next_permutation(BidirectionalIterator first,
1015
  BidirectionalIterator last);
1016
  template<class BidirectionalIterator, class Compare>
1017
- bool next_permutation(BidirectionalIterator first,
1018
  BidirectionalIterator last, Compare comp);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1019
  template<class BidirectionalIterator>
1020
- bool prev_permutation(BidirectionalIterator first,
1021
  BidirectionalIterator last);
1022
  template<class BidirectionalIterator, class Compare>
1023
- bool prev_permutation(BidirectionalIterator first,
1024
  BidirectionalIterator last, Compare comp);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
  }
1026
  ```
1027
 
 
2
 
3
  ``` cpp
4
  #include <initializer_list>
5
 
6
  namespace std {
7
+ namespace ranges {
8
+ // [algorithms.results], algorithm result types
9
+ template<class I, class F>
10
+ struct in_fun_result;
11
+
12
+ template<class I1, class I2>
13
+ struct in_in_result;
14
+
15
+ template<class I, class O>
16
+ struct in_out_result;
17
+
18
+ template<class I1, class I2, class O>
19
+ struct in_in_out_result;
20
+
21
+ template<class I, class O1, class O2>
22
+ struct in_out_out_result;
23
+
24
+ template<class T>
25
+ struct min_max_result;
26
+
27
+ template<class I>
28
+ struct in_found_result;
29
+ }
30
+
31
  // [alg.nonmodifying], non-modifying sequence operations
32
+ // [alg.all.of], all of
33
  template<class InputIterator, class Predicate>
34
+ constexpr bool all_of(InputIterator first, InputIterator last, Predicate pred);
35
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
36
  bool all_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
37
  ForwardIterator first, ForwardIterator last, Predicate pred);
38
 
39
+ namespace ranges {
40
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
41
+ indirect_unary_predicate<projected<I, Proj>> Pred>
42
+ constexpr bool all_of(I first, S last, Pred pred, Proj proj = {});
43
+ template<input_range R, class Proj = identity,
44
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
45
+ constexpr bool all_of(R&& r, Pred pred, Proj proj = {});
46
+ }
47
+
48
+ // [alg.any.of], any of
49
  template<class InputIterator, class Predicate>
50
+ constexpr bool any_of(InputIterator first, InputIterator last, Predicate pred);
51
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
52
  bool any_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
53
  ForwardIterator first, ForwardIterator last, Predicate pred);
54
 
55
+ namespace ranges {
56
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
57
+ indirect_unary_predicate<projected<I, Proj>> Pred>
58
+ constexpr bool any_of(I first, S last, Pred pred, Proj proj = {});
59
+ template<input_range R, class Proj = identity,
60
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
61
+ constexpr bool any_of(R&& r, Pred pred, Proj proj = {});
62
+ }
63
+
64
+ // [alg.none.of], none of
65
  template<class InputIterator, class Predicate>
66
+ constexpr bool none_of(InputIterator first, InputIterator last, Predicate pred);
67
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
68
  bool none_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
69
  ForwardIterator first, ForwardIterator last, Predicate pred);
70
 
71
+ namespace ranges {
72
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
73
+ indirect_unary_predicate<projected<I, Proj>> Pred>
74
+ constexpr bool none_of(I first, S last, Pred pred, Proj proj = {});
75
+ template<input_range R, class Proj = identity,
76
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
77
+ constexpr bool none_of(R&& r, Pred pred, Proj proj = {});
78
+ }
79
+
80
  // [alg.foreach], for each
81
  template<class InputIterator, class Function>
82
+ constexpr Function for_each(InputIterator first, InputIterator last, Function f);
83
  template<class ExecutionPolicy, class ForwardIterator, class Function>
84
  void for_each(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
85
  ForwardIterator first, ForwardIterator last, Function f);
86
+
87
+ namespace ranges {
88
+ template<class I, class F>
89
+ using for_each_result = in_fun_result<I, F>;
90
+
91
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
92
+ indirectly_unary_invocable<projected<I, Proj>> Fun>
93
+ constexpr for_each_result<I, Fun>
94
+ for_each(I first, S last, Fun f, Proj proj = {});
95
+ template<input_range R, class Proj = identity,
96
+ indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
97
+ constexpr for_each_result<borrowed_iterator_t<R>, Fun>
98
+ for_each(R&& r, Fun f, Proj proj = {});
99
+ }
100
+
101
  template<class InputIterator, class Size, class Function>
102
+ constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
103
  template<class ExecutionPolicy, class ForwardIterator, class Size, class Function>
104
  ForwardIterator for_each_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
105
  ForwardIterator first, Size n, Function f);
106
 
107
+ namespace ranges {
108
+ template<class I, class F>
109
+ using for_each_n_result = in_fun_result<I, F>;
110
+
111
+ template<input_iterator I, class Proj = identity,
112
+ indirectly_unary_invocable<projected<I, Proj>> Fun>
113
+ constexpr for_each_n_result<I, Fun>
114
+ for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});
115
+ }
116
+
117
  // [alg.find], find
118
  template<class InputIterator, class T>
119
+ constexpr InputIterator find(InputIterator first, InputIterator last,
120
  const T& value);
121
  template<class ExecutionPolicy, class ForwardIterator, class T>
122
  ForwardIterator find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
123
  ForwardIterator first, ForwardIterator last,
124
  const T& value);
125
  template<class InputIterator, class Predicate>
126
+ constexpr InputIterator find_if(InputIterator first, InputIterator last,
127
  Predicate pred);
128
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
129
  ForwardIterator find_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
130
  ForwardIterator first, ForwardIterator last,
131
  Predicate pred);
132
  template<class InputIterator, class Predicate>
133
+ constexpr InputIterator find_if_not(InputIterator first, InputIterator last,
134
  Predicate pred);
135
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
136
  ForwardIterator find_if_not(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
137
  ForwardIterator first, ForwardIterator last,
138
  Predicate pred);
139
 
140
+ namespace ranges {
141
+ template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
142
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
143
+ constexpr I find(I first, S last, const T& value, Proj proj = {});
144
+ template<input_range R, class T, class Proj = identity>
145
+ requires indirect_binary_predicate<ranges::equal_to,
146
+ projected<iterator_t<R>, Proj>, const T*>
147
+ constexpr borrowed_iterator_t<R>
148
+ find(R&& r, const T& value, Proj proj = {});
149
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
150
+ indirect_unary_predicate<projected<I, Proj>> Pred>
151
+ constexpr I find_if(I first, S last, Pred pred, Proj proj = {});
152
+ template<input_range R, class Proj = identity,
153
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
154
+ constexpr borrowed_iterator_t<R>
155
+ find_if(R&& r, Pred pred, Proj proj = {});
156
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
157
+ indirect_unary_predicate<projected<I, Proj>> Pred>
158
+ constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});
159
+ template<input_range R, class Proj = identity,
160
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
161
+ constexpr borrowed_iterator_t<R>
162
+ find_if_not(R&& r, Pred pred, Proj proj = {});
163
+ }
164
+
165
  // [alg.find.end], find end
166
  template<class ForwardIterator1, class ForwardIterator2>
167
+ constexpr ForwardIterator1
168
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
169
  ForwardIterator2 first2, ForwardIterator2 last2);
170
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
171
+ constexpr ForwardIterator1
172
  find_end(ForwardIterator1 first1, ForwardIterator1 last1,
173
  ForwardIterator2 first2, ForwardIterator2 last2,
174
  BinaryPredicate pred);
175
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
176
  ForwardIterator1
 
183
  find_end(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
184
  ForwardIterator1 first1, ForwardIterator1 last1,
185
  ForwardIterator2 first2, ForwardIterator2 last2,
186
  BinaryPredicate pred);
187
 
188
+ namespace ranges {
189
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
190
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
191
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
192
+ constexpr subrange<I1>
193
+ find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
194
+ Proj1 proj1 = {}, Proj2 proj2 = {});
195
+ template<forward_range R1, forward_range R2,
196
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
197
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
198
+ constexpr borrowed_subrange_t<R1>
199
+ find_end(R1&& r1, R2&& r2, Pred pred = {},
200
+ Proj1 proj1 = {}, Proj2 proj2 = {});
201
+ }
202
+
203
  // [alg.find.first.of], find first
204
  template<class InputIterator, class ForwardIterator>
205
+ constexpr InputIterator
206
  find_first_of(InputIterator first1, InputIterator last1,
207
  ForwardIterator first2, ForwardIterator last2);
208
  template<class InputIterator, class ForwardIterator, class BinaryPredicate>
209
+ constexpr InputIterator
210
  find_first_of(InputIterator first1, InputIterator last1,
211
  ForwardIterator first2, ForwardIterator last2,
212
  BinaryPredicate pred);
213
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
214
  ForwardIterator1
 
221
  find_first_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
222
  ForwardIterator1 first1, ForwardIterator1 last1,
223
  ForwardIterator2 first2, ForwardIterator2 last2,
224
  BinaryPredicate pred);
225
 
226
+ namespace ranges {
227
+ template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
228
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
229
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
230
+ constexpr I1 find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
231
+ Pred pred = {},
232
+ Proj1 proj1 = {}, Proj2 proj2 = {});
233
+ template<input_range R1, forward_range R2,
234
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
235
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
236
+ constexpr borrowed_iterator_t<R1>
237
+ find_first_of(R1&& r1, R2&& r2,
238
+ Pred pred = {},
239
+ Proj1 proj1 = {}, Proj2 proj2 = {});
240
+ }
241
+
242
  // [alg.adjacent.find], adjacent find
243
  template<class ForwardIterator>
244
+ constexpr ForwardIterator
245
+ adjacent_find(ForwardIterator first, ForwardIterator last);
246
  template<class ForwardIterator, class BinaryPredicate>
247
+ constexpr ForwardIterator
248
+ adjacent_find(ForwardIterator first, ForwardIterator last,
249
  BinaryPredicate pred);
250
  template<class ExecutionPolicy, class ForwardIterator>
251
+ ForwardIterator
252
+ adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
253
+ ForwardIterator first, ForwardIterator last);
254
  template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
255
+ ForwardIterator
256
+ adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
257
+ ForwardIterator first, ForwardIterator last,
258
  BinaryPredicate pred);
259
 
260
+ namespace ranges {
261
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
262
+ indirect_binary_predicate<projected<I, Proj>,
263
+ projected<I, Proj>> Pred = ranges::equal_to>
264
+ constexpr I adjacent_find(I first, S last, Pred pred = {},
265
+ Proj proj = {});
266
+ template<forward_range R, class Proj = identity,
267
+ indirect_binary_predicate<projected<iterator_t<R>, Proj>,
268
+ projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
269
+ constexpr borrowed_iterator_t<R>
270
+ adjacent_find(R&& r, Pred pred = {}, Proj proj = {});
271
+ }
272
+
273
  // [alg.count], count
274
  template<class InputIterator, class T>
275
+ constexpr typename iterator_traits<InputIterator>::difference_type
276
  count(InputIterator first, InputIterator last, const T& value);
277
  template<class ExecutionPolicy, class ForwardIterator, class T>
278
  typename iterator_traits<ForwardIterator>::difference_type
279
  count(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
280
  ForwardIterator first, ForwardIterator last, const T& value);
281
  template<class InputIterator, class Predicate>
282
+ constexpr typename iterator_traits<InputIterator>::difference_type
283
  count_if(InputIterator first, InputIterator last, Predicate pred);
284
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
285
  typename iterator_traits<ForwardIterator>::difference_type
286
  count_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
287
  ForwardIterator first, ForwardIterator last, Predicate pred);
288
 
289
+ namespace ranges {
290
+ template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
291
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
292
+ constexpr iter_difference_t<I>
293
+ count(I first, S last, const T& value, Proj proj = {});
294
+ template<input_range R, class T, class Proj = identity>
295
+ requires indirect_binary_predicate<ranges::equal_to,
296
+ projected<iterator_t<R>, Proj>, const T*>
297
+ constexpr range_difference_t<R>
298
+ count(R&& r, const T& value, Proj proj = {});
299
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
300
+ indirect_unary_predicate<projected<I, Proj>> Pred>
301
+ constexpr iter_difference_t<I>
302
+ count_if(I first, S last, Pred pred, Proj proj = {});
303
+ template<input_range R, class Proj = identity,
304
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
305
+ constexpr range_difference_t<R>
306
+ count_if(R&& r, Pred pred, Proj proj = {});
307
+ }
308
+
309
  // [mismatch], mismatch
310
  template<class InputIterator1, class InputIterator2>
311
+ constexpr pair<InputIterator1, InputIterator2>
312
  mismatch(InputIterator1 first1, InputIterator1 last1,
313
  InputIterator2 first2);
314
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
315
+ constexpr pair<InputIterator1, InputIterator2>
316
  mismatch(InputIterator1 first1, InputIterator1 last1,
317
  InputIterator2 first2, BinaryPredicate pred);
318
  template<class InputIterator1, class InputIterator2>
319
+ constexpr pair<InputIterator1, InputIterator2>
320
  mismatch(InputIterator1 first1, InputIterator1 last1,
321
  InputIterator2 first2, InputIterator2 last2);
322
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
323
+ constexpr pair<InputIterator1, InputIterator2>
324
  mismatch(InputIterator1 first1, InputIterator1 last1,
325
  InputIterator2 first2, InputIterator2 last2,
326
  BinaryPredicate pred);
327
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
328
  pair<ForwardIterator1, ForwardIterator2>
 
346
  mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
347
  ForwardIterator1 first1, ForwardIterator1 last1,
348
  ForwardIterator2 first2, ForwardIterator2 last2,
349
  BinaryPredicate pred);
350
 
351
+ namespace ranges {
352
+ template<class I1, class I2>
353
+ using mismatch_result = in_in_result<I1, I2>;
354
+
355
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
356
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
357
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
358
+ constexpr mismatch_result<I1, I2>
359
+ mismatch(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
360
+ Proj1 proj1 = {}, Proj2 proj2 = {});
361
+ template<input_range R1, input_range R2,
362
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
363
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
364
+ constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
365
+ mismatch(R1&& r1, R2&& r2, Pred pred = {},
366
+ Proj1 proj1 = {}, Proj2 proj2 = {});
367
+ }
368
+
369
  // [alg.equal], equal
370
  template<class InputIterator1, class InputIterator2>
371
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
372
  InputIterator2 first2);
373
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
374
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
375
  InputIterator2 first2, BinaryPredicate pred);
376
  template<class InputIterator1, class InputIterator2>
377
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
378
  InputIterator2 first2, InputIterator2 last2);
379
  template<class InputIterator1, class InputIterator2, class BinaryPredicate>
380
+ constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
381
  InputIterator2 first2, InputIterator2 last2,
382
  BinaryPredicate pred);
383
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
384
  bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
385
  ForwardIterator1 first1, ForwardIterator1 last1,
 
398
  bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
399
  ForwardIterator1 first1, ForwardIterator1 last1,
400
  ForwardIterator2 first2, ForwardIterator2 last2,
401
  BinaryPredicate pred);
402
 
403
+ namespace ranges {
404
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
405
+ class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
406
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
407
+ constexpr bool equal(I1 first1, S1 last1, I2 first2, S2 last2,
408
+ Pred pred = {},
409
+ Proj1 proj1 = {}, Proj2 proj2 = {});
410
+ template<input_range R1, input_range R2, class Pred = ranges::equal_to,
411
+ class Proj1 = identity, class Proj2 = identity>
412
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
413
+ constexpr bool equal(R1&& r1, R2&& r2, Pred pred = {},
414
+ Proj1 proj1 = {}, Proj2 proj2 = {});
415
+ }
416
+
417
+ // [alg.is.permutation], is permutation
418
  template<class ForwardIterator1, class ForwardIterator2>
419
+ constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
420
  ForwardIterator2 first2);
421
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
422
+ constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
423
  ForwardIterator2 first2, BinaryPredicate pred);
 
424
  template<class ForwardIterator1, class ForwardIterator2>
425
+ constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
426
  ForwardIterator2 first2, ForwardIterator2 last2);
 
427
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
428
+ constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
429
  ForwardIterator2 first2, ForwardIterator2 last2,
430
  BinaryPredicate pred);
431
 
432
+ namespace ranges {
433
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
434
+ sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
435
+ indirect_equivalence_relation<projected<I1, Proj1>,
436
+ projected<I2, Proj2>> Pred = ranges::equal_to>
437
+ constexpr bool is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
438
+ Pred pred = {},
439
+ Proj1 proj1 = {}, Proj2 proj2 = {});
440
+ template<forward_range R1, forward_range R2,
441
+ class Proj1 = identity, class Proj2 = identity,
442
+ indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
443
+ projected<iterator_t<R2>, Proj2>>
444
+ Pred = ranges::equal_to>
445
+ constexpr bool is_permutation(R1&& r1, R2&& r2, Pred pred = {},
446
+ Proj1 proj1 = {}, Proj2 proj2 = {});
447
+ }
448
+
449
  // [alg.search], search
450
  template<class ForwardIterator1, class ForwardIterator2>
451
+ constexpr ForwardIterator1
452
+ search(ForwardIterator1 first1, ForwardIterator1 last1,
453
  ForwardIterator2 first2, ForwardIterator2 last2);
454
  template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
455
+ constexpr ForwardIterator1
456
+ search(ForwardIterator1 first1, ForwardIterator1 last1,
457
  ForwardIterator2 first2, ForwardIterator2 last2,
458
  BinaryPredicate pred);
459
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
460
+ ForwardIterator1
461
+ search(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
462
  ForwardIterator1 first1, ForwardIterator1 last1,
463
  ForwardIterator2 first2, ForwardIterator2 last2);
464
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
465
  class BinaryPredicate>
466
+ ForwardIterator1
467
+ search(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
468
  ForwardIterator1 first1, ForwardIterator1 last1,
469
  ForwardIterator2 first2, ForwardIterator2 last2,
470
  BinaryPredicate pred);
471
+
472
+ namespace ranges {
473
+ template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
474
+ sentinel_for<I2> S2, class Pred = ranges::equal_to,
475
+ class Proj1 = identity, class Proj2 = identity>
476
+ requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
477
+ constexpr subrange<I1>
478
+ search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
479
+ Proj1 proj1 = {}, Proj2 proj2 = {});
480
+ template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
481
+ class Proj1 = identity, class Proj2 = identity>
482
+ requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
483
+ constexpr borrowed_subrange_t<R1>
484
+ search(R1&& r1, R2&& r2, Pred pred = {},
485
+ Proj1 proj1 = {}, Proj2 proj2 = {});
486
+ }
487
+
488
  template<class ForwardIterator, class Size, class T>
489
+ constexpr ForwardIterator
490
+ search_n(ForwardIterator first, ForwardIterator last,
491
  Size count, const T& value);
492
  template<class ForwardIterator, class Size, class T, class BinaryPredicate>
493
+ constexpr ForwardIterator
494
+ search_n(ForwardIterator first, ForwardIterator last,
495
  Size count, const T& value,
496
  BinaryPredicate pred);
497
  template<class ExecutionPolicy, class ForwardIterator, class Size, class T>
498
+ ForwardIterator
499
+ search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
500
  ForwardIterator first, ForwardIterator last,
501
  Size count, const T& value);
502
  template<class ExecutionPolicy, class ForwardIterator, class Size, class T,
503
  class BinaryPredicate>
504
+ ForwardIterator
505
+ search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
506
  ForwardIterator first, ForwardIterator last,
507
  Size count, const T& value,
508
  BinaryPredicate pred);
509
 
510
+ namespace ranges {
511
+ template<forward_iterator I, sentinel_for<I> S, class T,
512
+ class Pred = ranges::equal_to, class Proj = identity>
513
+ requires indirectly_comparable<I, const T*, Pred, Proj>
514
+ constexpr subrange<I>
515
+ search_n(I first, S last, iter_difference_t<I> count,
516
+ const T& value, Pred pred = {}, Proj proj = {});
517
+ template<forward_range R, class T, class Pred = ranges::equal_to,
518
+ class Proj = identity>
519
+ requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
520
+ constexpr borrowed_subrange_t<R>
521
+ search_n(R&& r, range_difference_t<R> count,
522
+ const T& value, Pred pred = {}, Proj proj = {});
523
+ }
524
+
525
  template<class ForwardIterator, class Searcher>
526
+ constexpr ForwardIterator
527
+ search(ForwardIterator first, ForwardIterator last, const Searcher& searcher);
528
 
529
+ // [alg.modifying.operations], mutating sequence operations
530
  // [alg.copy], copy
531
  template<class InputIterator, class OutputIterator>
532
+ constexpr OutputIterator copy(InputIterator first, InputIterator last,
533
  OutputIterator result);
534
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
535
  ForwardIterator2 copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
536
  ForwardIterator1 first, ForwardIterator1 last,
537
  ForwardIterator2 result);
538
+
539
+ namespace ranges {
540
+ template<class I, class O>
541
+ using copy_result = in_out_result<I, O>;
542
+
543
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
544
+ requires indirectly_copyable<I, O>
545
+ constexpr copy_result<I, O>
546
+ copy(I first, S last, O result);
547
+ template<input_range R, weakly_incrementable O>
548
+ requires indirectly_copyable<iterator_t<R>, O>
549
+ constexpr copy_result<borrowed_iterator_t<R>, O>
550
+ copy(R&& r, O result);
551
+ }
552
+
553
  template<class InputIterator, class Size, class OutputIterator>
554
+ constexpr OutputIterator copy_n(InputIterator first, Size n,
555
  OutputIterator result);
556
  template<class ExecutionPolicy, class ForwardIterator1, class Size,
557
  class ForwardIterator2>
558
  ForwardIterator2 copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
559
  ForwardIterator1 first, Size n,
560
  ForwardIterator2 result);
561
+
562
+ namespace ranges {
563
+ template<class I, class O>
564
+ using copy_n_result = in_out_result<I, O>;
565
+
566
+ template<input_iterator I, weakly_incrementable O>
567
+ requires indirectly_copyable<I, O>
568
+ constexpr copy_n_result<I, O>
569
+ copy_n(I first, iter_difference_t<I> n, O result);
570
+ }
571
+
572
  template<class InputIterator, class OutputIterator, class Predicate>
573
+ constexpr OutputIterator copy_if(InputIterator first, InputIterator last,
574
  OutputIterator result, Predicate pred);
575
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
576
  class Predicate>
577
  ForwardIterator2 copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
578
  ForwardIterator1 first, ForwardIterator1 last,
579
  ForwardIterator2 result, Predicate pred);
580
+
581
+ namespace ranges {
582
+ template<class I, class O>
583
+ using copy_if_result = in_out_result<I, O>;
584
+
585
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
586
+ indirect_unary_predicate<projected<I, Proj>> Pred>
587
+ requires indirectly_copyable<I, O>
588
+ constexpr copy_if_result<I, O>
589
+ copy_if(I first, S last, O result, Pred pred, Proj proj = {});
590
+ template<input_range R, weakly_incrementable O, class Proj = identity,
591
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
592
+ requires indirectly_copyable<iterator_t<R>, O>
593
+ constexpr copy_if_result<borrowed_iterator_t<R>, O>
594
+ copy_if(R&& r, O result, Pred pred, Proj proj = {});
595
+ }
596
+
597
  template<class BidirectionalIterator1, class BidirectionalIterator2>
598
+ constexpr BidirectionalIterator2
599
+ copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
600
  BidirectionalIterator2 result);
601
 
602
+ namespace ranges {
603
+ template<class I1, class I2>
604
+ using copy_backward_result = in_out_result<I1, I2>;
605
+
606
+ template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
607
+ requires indirectly_copyable<I1, I2>
608
+ constexpr copy_backward_result<I1, I2>
609
+ copy_backward(I1 first, S1 last, I2 result);
610
+ template<bidirectional_range R, bidirectional_iterator I>
611
+ requires indirectly_copyable<iterator_t<R>, I>
612
+ constexpr copy_backward_result<borrowed_iterator_t<R>, I>
613
+ copy_backward(R&& r, I result);
614
+ }
615
+
616
  // [alg.move], move
617
  template<class InputIterator, class OutputIterator>
618
+ constexpr OutputIterator move(InputIterator first, InputIterator last,
619
  OutputIterator result);
620
  template<class ExecutionPolicy, class ForwardIterator1,
621
  class ForwardIterator2>
622
  ForwardIterator2 move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
623
  ForwardIterator1 first, ForwardIterator1 last,
624
  ForwardIterator2 result);
625
+
626
+ namespace ranges {
627
+ template<class I, class O>
628
+ using move_result = in_out_result<I, O>;
629
+
630
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
631
+ requires indirectly_movable<I, O>
632
+ constexpr move_result<I, O>
633
+ move(I first, S last, O result);
634
+ template<input_range R, weakly_incrementable O>
635
+ requires indirectly_movable<iterator_t<R>, O>
636
+ constexpr move_result<borrowed_iterator_t<R>, O>
637
+ move(R&& r, O result);
638
+ }
639
+
640
  template<class BidirectionalIterator1, class BidirectionalIterator2>
641
+ constexpr BidirectionalIterator2
642
+ move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
643
  BidirectionalIterator2 result);
644
 
645
+ namespace ranges {
646
+ template<class I1, class I2>
647
+ using move_backward_result = in_out_result<I1, I2>;
648
+
649
+ template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
650
+ requires indirectly_movable<I1, I2>
651
+ constexpr move_backward_result<I1, I2>
652
+ move_backward(I1 first, S1 last, I2 result);
653
+ template<bidirectional_range R, bidirectional_iterator I>
654
+ requires indirectly_movable<iterator_t<R>, I>
655
+ constexpr move_backward_result<borrowed_iterator_t<R>, I>
656
+ move_backward(R&& r, I result);
657
+ }
658
+
659
  // [alg.swap], swap
660
  template<class ForwardIterator1, class ForwardIterator2>
661
+ constexpr ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1,
662
  ForwardIterator2 first2);
663
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
664
  ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
665
  ForwardIterator1 first1, ForwardIterator1 last1,
666
  ForwardIterator2 first2);
667
+
668
+ namespace ranges {
669
+ template<class I1, class I2>
670
+ using swap_ranges_result = in_in_result<I1, I2>;
671
+
672
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
673
+ requires indirectly_swappable<I1, I2>
674
+ constexpr swap_ranges_result<I1, I2>
675
+ swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
676
+ template<input_range R1, input_range R2>
677
+ requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
678
+ constexpr swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
679
+ swap_ranges(R1&& r1, R2&& r2);
680
+ }
681
+
682
  template<class ForwardIterator1, class ForwardIterator2>
683
+ constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
684
 
685
  // [alg.transform], transform
686
  template<class InputIterator, class OutputIterator, class UnaryOperation>
687
+ constexpr OutputIterator
688
+ transform(InputIterator first1, InputIterator last1,
689
  OutputIterator result, UnaryOperation op);
690
  template<class InputIterator1, class InputIterator2, class OutputIterator,
691
  class BinaryOperation>
692
+ constexpr OutputIterator
693
+ transform(InputIterator1 first1, InputIterator1 last1,
694
  InputIterator2 first2, OutputIterator result,
695
  BinaryOperation binary_op);
696
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
697
  class UnaryOperation>
698
+ ForwardIterator2
699
+ transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
700
+ ForwardIterator1 first1, ForwardIterator1 last1,
701
  ForwardIterator2 result, UnaryOperation op);
702
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
703
  class ForwardIterator, class BinaryOperation>
704
+ ForwardIterator
705
+ transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
706
  ForwardIterator1 first1, ForwardIterator1 last1,
707
  ForwardIterator2 first2, ForwardIterator result,
708
  BinaryOperation binary_op);
709
 
710
+ namespace ranges {
711
+ template<class I, class O>
712
+ using unary_transform_result = in_out_result<I, O>;
713
+
714
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
715
+ copy_constructible F, class Proj = identity>
716
+ requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
717
+ constexpr unary_transform_result<I, O>
718
+ transform(I first1, S last1, O result, F op, Proj proj = {});
719
+ template<input_range R, weakly_incrementable O, copy_constructible F,
720
+ class Proj = identity>
721
+ requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
722
+ constexpr unary_transform_result<borrowed_iterator_t<R>, O>
723
+ transform(R&& r, O result, F op, Proj proj = {});
724
+
725
+ template<class I1, class I2, class O>
726
+ using binary_transform_result = in_in_out_result<I1, I2, O>;
727
+
728
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
729
+ weakly_incrementable O, copy_constructible F, class Proj1 = identity,
730
+ class Proj2 = identity>
731
+ requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
732
+ projected<I2, Proj2>>>
733
+ constexpr binary_transform_result<I1, I2, O>
734
+ transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
735
+ F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
736
+ template<input_range R1, input_range R2, weakly_incrementable O,
737
+ copy_constructible F, class Proj1 = identity, class Proj2 = identity>
738
+ requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
739
+ projected<iterator_t<R2>, Proj2>>>
740
+ constexpr binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
741
+ transform(R1&& r1, R2&& r2, O result,
742
+ F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
743
+ }
744
+
745
  // [alg.replace], replace
746
  template<class ForwardIterator, class T>
747
+ constexpr void replace(ForwardIterator first, ForwardIterator last,
748
  const T& old_value, const T& new_value);
749
  template<class ExecutionPolicy, class ForwardIterator, class T>
750
  void replace(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
751
  ForwardIterator first, ForwardIterator last,
752
  const T& old_value, const T& new_value);
753
  template<class ForwardIterator, class Predicate, class T>
754
+ constexpr void replace_if(ForwardIterator first, ForwardIterator last,
755
  Predicate pred, const T& new_value);
756
  template<class ExecutionPolicy, class ForwardIterator, class Predicate, class T>
757
  void replace_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
758
  ForwardIterator first, ForwardIterator last,
759
  Predicate pred, const T& new_value);
760
+
761
+ namespace ranges {
762
+ template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
763
+ requires indirectly_writable<I, const T2&> &&
764
+ indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
765
+ constexpr I
766
+ replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
767
+ template<input_range R, class T1, class T2, class Proj = identity>
768
+ requires indirectly_writable<iterator_t<R>, const T2&> &&
769
+ indirect_binary_predicate<ranges::equal_to,
770
+ projected<iterator_t<R>, Proj>, const T1*>
771
+ constexpr borrowed_iterator_t<R>
772
+ replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
773
+ template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
774
+ indirect_unary_predicate<projected<I, Proj>> Pred>
775
+ requires indirectly_writable<I, const T&>
776
+ constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
777
+ template<input_range R, class T, class Proj = identity,
778
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
779
+ requires indirectly_writable<iterator_t<R>, const T&>
780
+ constexpr borrowed_iterator_t<R>
781
+ replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
782
+ }
783
+
784
  template<class InputIterator, class OutputIterator, class T>
785
+ constexpr OutputIterator replace_copy(InputIterator first, InputIterator last,
786
  OutputIterator result,
787
  const T& old_value, const T& new_value);
788
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
789
  ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
790
  ForwardIterator1 first, ForwardIterator1 last,
791
  ForwardIterator2 result,
792
  const T& old_value, const T& new_value);
793
  template<class InputIterator, class OutputIterator, class Predicate, class T>
794
+ constexpr OutputIterator replace_copy_if(InputIterator first, InputIterator last,
795
  OutputIterator result,
796
  Predicate pred, const T& new_value);
797
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
798
  class Predicate, class T>
799
  ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
800
  ForwardIterator1 first, ForwardIterator1 last,
801
  ForwardIterator2 result,
802
  Predicate pred, const T& new_value);
803
 
804
+ namespace ranges {
805
+ template<class I, class O>
806
+ using replace_copy_result = in_out_result<I, O>;
807
+
808
+ template<input_iterator I, sentinel_for<I> S, class T1, class T2,
809
+ output_iterator<const T2&> O, class Proj = identity>
810
+ requires indirectly_copyable<I, O> &&
811
+ indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
812
+ constexpr replace_copy_result<I, O>
813
+ replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
814
+ Proj proj = {});
815
+ template<input_range R, class T1, class T2, output_iterator<const T2&> O,
816
+ class Proj = identity>
817
+ requires indirectly_copyable<iterator_t<R>, O> &&
818
+ indirect_binary_predicate<ranges::equal_to,
819
+ projected<iterator_t<R>, Proj>, const T1*>
820
+ constexpr replace_copy_result<borrowed_iterator_t<R>, O>
821
+ replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
822
+ Proj proj = {});
823
+
824
+ template<class I, class O>
825
+ using replace_copy_if_result = in_out_result<I, O>;
826
+
827
+ template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
828
+ class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
829
+ requires indirectly_copyable<I, O>
830
+ constexpr replace_copy_if_result<I, O>
831
+ replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
832
+ Proj proj = {});
833
+ template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
834
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
835
+ requires indirectly_copyable<iterator_t<R>, O>
836
+ constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
837
+ replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
838
+ Proj proj = {});
839
+ }
840
+
841
  // [alg.fill], fill
842
  template<class ForwardIterator, class T>
843
+ constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value);
844
+ template<class ExecutionPolicy, class ForwardIterator, class T>
 
845
  void fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
846
  ForwardIterator first, ForwardIterator last, const T& value);
847
  template<class OutputIterator, class Size, class T>
848
+ constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value);
849
  template<class ExecutionPolicy, class ForwardIterator,
850
  class Size, class T>
851
  ForwardIterator fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
852
  ForwardIterator first, Size n, const T& value);
853
 
854
+ namespace ranges {
855
+ template<class T, output_iterator<const T&> O, sentinel_for<O> S>
856
+ constexpr O fill(O first, S last, const T& value);
857
+ template<class T, output_range<const T&> R>
858
+ constexpr borrowed_iterator_t<R> fill(R&& r, const T& value);
859
+ template<class T, output_iterator<const T&> O>
860
+ constexpr O fill_n(O first, iter_difference_t<O> n, const T& value);
861
+ }
862
+
863
  // [alg.generate], generate
864
  template<class ForwardIterator, class Generator>
865
+ constexpr void generate(ForwardIterator first, ForwardIterator last,
866
  Generator gen);
867
  template<class ExecutionPolicy, class ForwardIterator, class Generator>
868
  void generate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
869
  ForwardIterator first, ForwardIterator last,
870
  Generator gen);
871
  template<class OutputIterator, class Size, class Generator>
872
+ constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
873
  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
874
  ForwardIterator generate_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
875
  ForwardIterator first, Size n, Generator gen);
876
 
877
+ namespace ranges {
878
+ template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
879
+ requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
880
+ constexpr O generate(O first, S last, F gen);
881
+ template<class R, copy_constructible F>
882
+ requires invocable<F&> && output_range<R, invoke_result_t<F&>>
883
+ constexpr borrowed_iterator_t<R> generate(R&& r, F gen);
884
+ template<input_or_output_iterator O, copy_constructible F>
885
+ requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
886
+ constexpr O generate_n(O first, iter_difference_t<O> n, F gen);
887
+ }
888
+
889
  // [alg.remove], remove
890
  template<class ForwardIterator, class T>
891
+ constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last,
892
  const T& value);
893
  template<class ExecutionPolicy, class ForwardIterator, class T>
894
  ForwardIterator remove(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
895
  ForwardIterator first, ForwardIterator last,
896
  const T& value);
897
  template<class ForwardIterator, class Predicate>
898
+ constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
899
  Predicate pred);
900
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
901
  ForwardIterator remove_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
902
  ForwardIterator first, ForwardIterator last,
903
  Predicate pred);
904
+
905
+ namespace ranges {
906
+ template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
907
+ requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
908
+ constexpr subrange<I> remove(I first, S last, const T& value, Proj proj = {});
909
+ template<forward_range R, class T, class Proj = identity>
910
+ requires permutable<iterator_t<R>> &&
911
+ indirect_binary_predicate<ranges::equal_to,
912
+ projected<iterator_t<R>, Proj>, const T*>
913
+ constexpr borrowed_subrange_t<R>
914
+ remove(R&& r, const T& value, Proj proj = {});
915
+ template<permutable I, sentinel_for<I> S, class Proj = identity,
916
+ indirect_unary_predicate<projected<I, Proj>> Pred>
917
+ constexpr subrange<I> remove_if(I first, S last, Pred pred, Proj proj = {});
918
+ template<forward_range R, class Proj = identity,
919
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
920
+ requires permutable<iterator_t<R>>
921
+ constexpr borrowed_subrange_t<R>
922
+ remove_if(R&& r, Pred pred, Proj proj = {});
923
+ }
924
+
925
  template<class InputIterator, class OutputIterator, class T>
926
+ constexpr OutputIterator
927
+ remove_copy(InputIterator first, InputIterator last,
928
  OutputIterator result, const T& value);
929
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
930
  class T>
931
+ ForwardIterator2
932
+ remove_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
933
  ForwardIterator1 first, ForwardIterator1 last,
934
  ForwardIterator2 result, const T& value);
935
  template<class InputIterator, class OutputIterator, class Predicate>
936
+ constexpr OutputIterator
937
+ remove_copy_if(InputIterator first, InputIterator last,
938
  OutputIterator result, Predicate pred);
939
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
940
  class Predicate>
941
+ ForwardIterator2
942
+ remove_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
943
  ForwardIterator1 first, ForwardIterator1 last,
944
  ForwardIterator2 result, Predicate pred);
945
 
946
+ namespace ranges {
947
+ template<class I, class O>
948
+ using remove_copy_result = in_out_result<I, O>;
949
+
950
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
951
+ class Proj = identity>
952
+ requires indirectly_copyable<I, O> &&
953
+ indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
954
+ constexpr remove_copy_result<I, O>
955
+ remove_copy(I first, S last, O result, const T& value, Proj proj = {});
956
+ template<input_range R, weakly_incrementable O, class T, class Proj = identity>
957
+ requires indirectly_copyable<iterator_t<R>, O> &&
958
+ indirect_binary_predicate<ranges::equal_to,
959
+ projected<iterator_t<R>, Proj>, const T*>
960
+ constexpr remove_copy_result<borrowed_iterator_t<R>, O>
961
+ remove_copy(R&& r, O result, const T& value, Proj proj = {});
962
+
963
+ template<class I, class O>
964
+ using remove_copy_if_result = in_out_result<I, O>;
965
+
966
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
967
+ class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
968
+ requires indirectly_copyable<I, O>
969
+ constexpr remove_copy_if_result<I, O>
970
+ remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});
971
+ template<input_range R, weakly_incrementable O, class Proj = identity,
972
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
973
+ requires indirectly_copyable<iterator_t<R>, O>
974
+ constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
975
+ remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});
976
+ }
977
+
978
  // [alg.unique], unique
979
  template<class ForwardIterator>
980
+ constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last);
981
  template<class ForwardIterator, class BinaryPredicate>
982
+ constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last,
983
  BinaryPredicate pred);
984
  template<class ExecutionPolicy, class ForwardIterator>
985
  ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
986
  ForwardIterator first, ForwardIterator last);
987
  template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
988
  ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
989
  ForwardIterator first, ForwardIterator last,
990
  BinaryPredicate pred);
991
+
992
+ namespace ranges {
993
+ template<permutable I, sentinel_for<I> S, class Proj = identity,
994
+ indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
995
+ constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {});
996
+ template<forward_range R, class Proj = identity,
997
+ indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
998
+ requires permutable<iterator_t<R>>
999
+ constexpr borrowed_subrange_t<R>
1000
+ unique(R&& r, C comp = {}, Proj proj = {});
1001
+ }
1002
+
1003
  template<class InputIterator, class OutputIterator>
1004
+ constexpr OutputIterator
1005
+ unique_copy(InputIterator first, InputIterator last,
1006
  OutputIterator result);
1007
  template<class InputIterator, class OutputIterator, class BinaryPredicate>
1008
+ constexpr OutputIterator
1009
+ unique_copy(InputIterator first, InputIterator last,
1010
  OutputIterator result, BinaryPredicate pred);
1011
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
1012
+ ForwardIterator2
1013
+ unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1014
  ForwardIterator1 first, ForwardIterator1 last,
1015
  ForwardIterator2 result);
1016
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1017
  class BinaryPredicate>
1018
+ ForwardIterator2
1019
+ unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1020
  ForwardIterator1 first, ForwardIterator1 last,
1021
  ForwardIterator2 result, BinaryPredicate pred);
1022
 
1023
+ namespace ranges {
1024
+ template<class I, class O>
1025
+ using unique_copy_result = in_out_result<I, O>;
1026
+
1027
+ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1028
+ indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1029
+ requires indirectly_copyable<I, O> &&
1030
+ (forward_iterator<I> ||
1031
+ (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1032
+ indirectly_copyable_storable<I, O>)
1033
+ constexpr unique_copy_result<I, O>
1034
+ unique_copy(I first, S last, O result, C comp = {}, Proj proj = {});
1035
+ template<input_range R, weakly_incrementable O, class Proj = identity,
1036
+ indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1037
+ requires indirectly_copyable<iterator_t<R>, O> &&
1038
+ (forward_iterator<iterator_t<R>> ||
1039
+ (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1040
+ indirectly_copyable_storable<iterator_t<R>, O>)
1041
+ constexpr unique_copy_result<borrowed_iterator_t<R>, O>
1042
+ unique_copy(R&& r, O result, C comp = {}, Proj proj = {});
1043
+ }
1044
+
1045
  // [alg.reverse], reverse
1046
  template<class BidirectionalIterator>
1047
+ constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last);
1048
  template<class ExecutionPolicy, class BidirectionalIterator>
1049
  void reverse(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1050
  BidirectionalIterator first, BidirectionalIterator last);
1051
+
1052
+ namespace ranges {
1053
+ template<bidirectional_iterator I, sentinel_for<I> S>
1054
+ requires permutable<I>
1055
+ constexpr I reverse(I first, S last);
1056
+ template<bidirectional_range R>
1057
+ requires permutable<iterator_t<R>>
1058
+ constexpr borrowed_iterator_t<R> reverse(R&& r);
1059
+ }
1060
+
1061
  template<class BidirectionalIterator, class OutputIterator>
1062
+ constexpr OutputIterator
1063
+ reverse_copy(BidirectionalIterator first, BidirectionalIterator last,
1064
  OutputIterator result);
1065
  template<class ExecutionPolicy, class BidirectionalIterator, class ForwardIterator>
1066
+ ForwardIterator
1067
+ reverse_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1068
+ BidirectionalIterator first, BidirectionalIterator last,
1069
  ForwardIterator result);
1070
 
1071
+ namespace ranges {
1072
+ template<class I, class O>
1073
+ using reverse_copy_result = in_out_result<I, O>;
1074
+
1075
+ template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
1076
+ requires indirectly_copyable<I, O>
1077
+ constexpr reverse_copy_result<I, O>
1078
+ reverse_copy(I first, S last, O result);
1079
+ template<bidirectional_range R, weakly_incrementable O>
1080
+ requires indirectly_copyable<iterator_t<R>, O>
1081
+ constexpr reverse_copy_result<borrowed_iterator_t<R>, O>
1082
+ reverse_copy(R&& r, O result);
1083
+ }
1084
+
1085
  // [alg.rotate], rotate
1086
  template<class ForwardIterator>
1087
+ constexpr ForwardIterator rotate(ForwardIterator first,
1088
  ForwardIterator middle,
1089
  ForwardIterator last);
1090
  template<class ExecutionPolicy, class ForwardIterator>
1091
  ForwardIterator rotate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1092
  ForwardIterator first,
1093
  ForwardIterator middle,
1094
  ForwardIterator last);
1095
+
1096
+ namespace ranges {
1097
+ template<permutable I, sentinel_for<I> S>
1098
+ constexpr subrange<I> rotate(I first, I middle, S last);
1099
+ template<forward_range R>
1100
+ requires permutable<iterator_t<R>>
1101
+ constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);
1102
+ }
1103
+
1104
  template<class ForwardIterator, class OutputIterator>
1105
+ constexpr OutputIterator
1106
+ rotate_copy(ForwardIterator first, ForwardIterator middle,
1107
  ForwardIterator last, OutputIterator result);
1108
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
1109
+ ForwardIterator2
1110
+ rotate_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1111
  ForwardIterator1 first, ForwardIterator1 middle,
1112
  ForwardIterator1 last, ForwardIterator2 result);
1113
 
1114
+ namespace ranges {
1115
+ template<class I, class O>
1116
+ using rotate_copy_result = in_out_result<I, O>;
1117
+
1118
+ template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
1119
+ requires indirectly_copyable<I, O>
1120
+ constexpr rotate_copy_result<I, O>
1121
+ rotate_copy(I first, I middle, S last, O result);
1122
+ template<forward_range R, weakly_incrementable O>
1123
+ requires indirectly_copyable<iterator_t<R>, O>
1124
+ constexpr rotate_copy_result<borrowed_iterator_t<R>, O>
1125
+ rotate_copy(R&& r, iterator_t<R> middle, O result);
1126
+ }
1127
+
1128
  // [alg.random.sample], sample
1129
  template<class PopulationIterator, class SampleIterator,
1130
  class Distance, class UniformRandomBitGenerator>
1131
  SampleIterator sample(PopulationIterator first, PopulationIterator last,
1132
  SampleIterator out, Distance n,
1133
  UniformRandomBitGenerator&& g);
1134
 
1135
+ namespace ranges {
1136
+ template<input_iterator I, sentinel_for<I> S,
1137
+ weakly_incrementable O, class Gen>
1138
+ requires (forward_iterator<I> || random_access_iterator<O>) &&
1139
+ indirectly_copyable<I, O> &&
1140
+ uniform_random_bit_generator<remove_reference_t<Gen>>
1141
+ O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g);
1142
+ template<input_range R, weakly_incrementable O, class Gen>
1143
+ requires (forward_range<R> || random_access_iterator<O>) &&
1144
+ indirectly_copyable<iterator_t<R>, O> &&
1145
+ uniform_random_bit_generator<remove_reference_t<Gen>>
1146
+ O sample(R&& r, O out, range_difference_t<R> n, Gen&& g);
1147
+ }
1148
+
1149
  // [alg.random.shuffle], shuffle
1150
  template<class RandomAccessIterator, class UniformRandomBitGenerator>
1151
  void shuffle(RandomAccessIterator first,
1152
  RandomAccessIterator last,
1153
  UniformRandomBitGenerator&& g);
1154
 
1155
+ namespace ranges {
1156
+ template<random_access_iterator I, sentinel_for<I> S, class Gen>
1157
+ requires permutable<I> &&
1158
+ uniform_random_bit_generator<remove_reference_t<Gen>>
1159
+ I shuffle(I first, S last, Gen&& g);
1160
+ template<random_access_range R, class Gen>
1161
+ requires permutable<iterator_t<R>> &&
1162
+ uniform_random_bit_generator<remove_reference_t<Gen>>
1163
+ borrowed_iterator_t<R> shuffle(R&& r, Gen&& g);
1164
+ }
1165
+
1166
+ // [alg.shift], shift
1167
+ template<class ForwardIterator>
1168
+ constexpr ForwardIterator
1169
+ shift_left(ForwardIterator first, ForwardIterator last,
1170
+ typename iterator_traits<ForwardIterator>::difference_type n);
1171
+ template<class ExecutionPolicy, class ForwardIterator>
1172
+ ForwardIterator
1173
+ shift_left(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1174
+ ForwardIterator first, ForwardIterator last,
1175
+ typename iterator_traits<ForwardIterator>::difference_type n);
1176
+ template<class ForwardIterator>
1177
+ constexpr ForwardIterator
1178
+ shift_right(ForwardIterator first, ForwardIterator last,
1179
+ typename iterator_traits<ForwardIterator>::difference_type n);
1180
+ template<class ExecutionPolicy, class ForwardIterator>
1181
+ ForwardIterator
1182
+ shift_right(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1183
+ ForwardIterator first, ForwardIterator last,
1184
+ typename iterator_traits<ForwardIterator>::difference_type n);
1185
+
1186
+ // [alg.sorting], sorting and related operations
1187
+ // [alg.sort], sorting
1188
+ template<class RandomAccessIterator>
1189
+ constexpr void sort(RandomAccessIterator first, RandomAccessIterator last);
1190
+ template<class RandomAccessIterator, class Compare>
1191
+ constexpr void sort(RandomAccessIterator first, RandomAccessIterator last,
1192
+ Compare comp);
1193
+ template<class ExecutionPolicy, class RandomAccessIterator>
1194
+ void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1195
+ RandomAccessIterator first, RandomAccessIterator last);
1196
+ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1197
+ void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1198
+ RandomAccessIterator first, RandomAccessIterator last,
1199
+ Compare comp);
1200
+
1201
+ namespace ranges {
1202
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1203
+ class Proj = identity>
1204
+ requires sortable<I, Comp, Proj>
1205
+ constexpr I
1206
+ sort(I first, S last, Comp comp = {}, Proj proj = {});
1207
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1208
+ requires sortable<iterator_t<R>, Comp, Proj>
1209
+ constexpr borrowed_iterator_t<R>
1210
+ sort(R&& r, Comp comp = {}, Proj proj = {});
1211
+ }
1212
+
1213
+ template<class RandomAccessIterator>
1214
+ void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1215
+ template<class RandomAccessIterator, class Compare>
1216
+ void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
1217
+ Compare comp);
1218
+ template<class ExecutionPolicy, class RandomAccessIterator>
1219
+ void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1220
+ RandomAccessIterator first, RandomAccessIterator last);
1221
+ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1222
+ void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1223
+ RandomAccessIterator first, RandomAccessIterator last,
1224
+ Compare comp);
1225
+
1226
+ namespace ranges {
1227
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1228
+ class Proj = identity>
1229
+ requires sortable<I, Comp, Proj>
1230
+ I stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
1231
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1232
+ requires sortable<iterator_t<R>, Comp, Proj>
1233
+ borrowed_iterator_t<R>
1234
+ stable_sort(R&& r, Comp comp = {}, Proj proj = {});
1235
+ }
1236
+
1237
+ template<class RandomAccessIterator>
1238
+ constexpr void partial_sort(RandomAccessIterator first,
1239
+ RandomAccessIterator middle,
1240
+ RandomAccessIterator last);
1241
+ template<class RandomAccessIterator, class Compare>
1242
+ constexpr void partial_sort(RandomAccessIterator first,
1243
+ RandomAccessIterator middle,
1244
+ RandomAccessIterator last, Compare comp);
1245
+ template<class ExecutionPolicy, class RandomAccessIterator>
1246
+ void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1247
+ RandomAccessIterator first,
1248
+ RandomAccessIterator middle,
1249
+ RandomAccessIterator last);
1250
+ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1251
+ void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1252
+ RandomAccessIterator first,
1253
+ RandomAccessIterator middle,
1254
+ RandomAccessIterator last, Compare comp);
1255
+
1256
+ namespace ranges {
1257
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1258
+ class Proj = identity>
1259
+ requires sortable<I, Comp, Proj>
1260
+ constexpr I
1261
+ partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});
1262
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1263
+ requires sortable<iterator_t<R>, Comp, Proj>
1264
+ constexpr borrowed_iterator_t<R>
1265
+ partial_sort(R&& r, iterator_t<R> middle, Comp comp = {},
1266
+ Proj proj = {});
1267
+ }
1268
+
1269
+ template<class InputIterator, class RandomAccessIterator>
1270
+ constexpr RandomAccessIterator
1271
+ partial_sort_copy(InputIterator first, InputIterator last,
1272
+ RandomAccessIterator result_first,
1273
+ RandomAccessIterator result_last);
1274
+ template<class InputIterator, class RandomAccessIterator, class Compare>
1275
+ constexpr RandomAccessIterator
1276
+ partial_sort_copy(InputIterator first, InputIterator last,
1277
+ RandomAccessIterator result_first,
1278
+ RandomAccessIterator result_last,
1279
+ Compare comp);
1280
+ template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator>
1281
+ RandomAccessIterator
1282
+ partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1283
+ ForwardIterator first, ForwardIterator last,
1284
+ RandomAccessIterator result_first,
1285
+ RandomAccessIterator result_last);
1286
+ template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator,
1287
+ class Compare>
1288
+ RandomAccessIterator
1289
+ partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1290
+ ForwardIterator first, ForwardIterator last,
1291
+ RandomAccessIterator result_first,
1292
+ RandomAccessIterator result_last,
1293
+ Compare comp);
1294
+
1295
+ namespace ranges {
1296
+ template<class I, class O>
1297
+ using partial_sort_copy_result = in_out_result<I, O>;
1298
+
1299
+ template<input_iterator I1, sentinel_for<I1> S1,
1300
+ random_access_iterator I2, sentinel_for<I2> S2,
1301
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1302
+ requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
1303
+ indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
1304
+ constexpr partial_sort_copy_result<I1, I2>
1305
+ partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
1306
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1307
+ template<input_range R1, random_access_range R2, class Comp = ranges::less,
1308
+ class Proj1 = identity, class Proj2 = identity>
1309
+ requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
1310
+ sortable<iterator_t<R2>, Comp, Proj2> &&
1311
+ indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
1312
+ projected<iterator_t<R2>, Proj2>>
1313
+ constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
1314
+ partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
1315
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1316
+ }
1317
+
1318
+ template<class ForwardIterator>
1319
+ constexpr bool is_sorted(ForwardIterator first, ForwardIterator last);
1320
+ template<class ForwardIterator, class Compare>
1321
+ constexpr bool is_sorted(ForwardIterator first, ForwardIterator last,
1322
+ Compare comp);
1323
+ template<class ExecutionPolicy, class ForwardIterator>
1324
+ bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1325
+ ForwardIterator first, ForwardIterator last);
1326
+ template<class ExecutionPolicy, class ForwardIterator, class Compare>
1327
+ bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1328
+ ForwardIterator first, ForwardIterator last,
1329
+ Compare comp);
1330
+
1331
+ namespace ranges {
1332
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
1333
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
1334
+ constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {});
1335
+ template<forward_range R, class Proj = identity,
1336
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
1337
+ constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {});
1338
+ }
1339
+
1340
+ template<class ForwardIterator>
1341
+ constexpr ForwardIterator
1342
+ is_sorted_until(ForwardIterator first, ForwardIterator last);
1343
+ template<class ForwardIterator, class Compare>
1344
+ constexpr ForwardIterator
1345
+ is_sorted_until(ForwardIterator first, ForwardIterator last,
1346
+ Compare comp);
1347
+ template<class ExecutionPolicy, class ForwardIterator>
1348
+ ForwardIterator
1349
+ is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1350
+ ForwardIterator first, ForwardIterator last);
1351
+ template<class ExecutionPolicy, class ForwardIterator, class Compare>
1352
+ ForwardIterator
1353
+ is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1354
+ ForwardIterator first, ForwardIterator last,
1355
+ Compare comp);
1356
+
1357
+ namespace ranges {
1358
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
1359
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
1360
+ constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});
1361
+ template<forward_range R, class Proj = identity,
1362
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
1363
+ constexpr borrowed_iterator_t<R>
1364
+ is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});
1365
+ }
1366
+
1367
+ // [alg.nth.element], Nth element
1368
+ template<class RandomAccessIterator>
1369
+ constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
1370
+ RandomAccessIterator last);
1371
+ template<class RandomAccessIterator, class Compare>
1372
+ constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
1373
+ RandomAccessIterator last, Compare comp);
1374
+ template<class ExecutionPolicy, class RandomAccessIterator>
1375
+ void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1376
+ RandomAccessIterator first, RandomAccessIterator nth,
1377
+ RandomAccessIterator last);
1378
+ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1379
+ void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1380
+ RandomAccessIterator first, RandomAccessIterator nth,
1381
+ RandomAccessIterator last, Compare comp);
1382
+
1383
+ namespace ranges {
1384
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1385
+ class Proj = identity>
1386
+ requires sortable<I, Comp, Proj>
1387
+ constexpr I
1388
+ nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
1389
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1390
+ requires sortable<iterator_t<R>, Comp, Proj>
1391
+ constexpr borrowed_iterator_t<R>
1392
+ nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});
1393
+ }
1394
+
1395
+ // [alg.binary.search], binary search
1396
+ template<class ForwardIterator, class T>
1397
+ constexpr ForwardIterator
1398
+ lower_bound(ForwardIterator first, ForwardIterator last,
1399
+ const T& value);
1400
+ template<class ForwardIterator, class T, class Compare>
1401
+ constexpr ForwardIterator
1402
+ lower_bound(ForwardIterator first, ForwardIterator last,
1403
+ const T& value, Compare comp);
1404
+
1405
+ namespace ranges {
1406
+ template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
1407
+ indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
1408
+ constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
1409
+ Proj proj = {});
1410
+ template<forward_range R, class T, class Proj = identity,
1411
+ indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
1412
+ ranges::less>
1413
+ constexpr borrowed_iterator_t<R>
1414
+ lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
1415
+ }
1416
+
1417
+ template<class ForwardIterator, class T>
1418
+ constexpr ForwardIterator
1419
+ upper_bound(ForwardIterator first, ForwardIterator last,
1420
+ const T& value);
1421
+ template<class ForwardIterator, class T, class Compare>
1422
+ constexpr ForwardIterator
1423
+ upper_bound(ForwardIterator first, ForwardIterator last,
1424
+ const T& value, Compare comp);
1425
+
1426
+ namespace ranges {
1427
+ template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
1428
+ indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
1429
+ constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
1430
+ template<forward_range R, class T, class Proj = identity,
1431
+ indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
1432
+ ranges::less>
1433
+ constexpr borrowed_iterator_t<R>
1434
+ upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
1435
+ }
1436
+
1437
+ template<class ForwardIterator, class T>
1438
+ constexpr pair<ForwardIterator, ForwardIterator>
1439
+ equal_range(ForwardIterator first, ForwardIterator last,
1440
+ const T& value);
1441
+ template<class ForwardIterator, class T, class Compare>
1442
+ constexpr pair<ForwardIterator, ForwardIterator>
1443
+ equal_range(ForwardIterator first, ForwardIterator last,
1444
+ const T& value, Compare comp);
1445
+
1446
+ namespace ranges {
1447
+ template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
1448
+ indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
1449
+ constexpr subrange<I>
1450
+ equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
1451
+ template<forward_range R, class T, class Proj = identity,
1452
+ indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
1453
+ ranges::less>
1454
+ constexpr borrowed_subrange_t<R>
1455
+ equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});
1456
+ }
1457
+
1458
+ template<class ForwardIterator, class T>
1459
+ constexpr bool
1460
+ binary_search(ForwardIterator first, ForwardIterator last,
1461
+ const T& value);
1462
+ template<class ForwardIterator, class T, class Compare>
1463
+ constexpr bool
1464
+ binary_search(ForwardIterator first, ForwardIterator last,
1465
+ const T& value, Compare comp);
1466
+
1467
+ namespace ranges {
1468
+ template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
1469
+ indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
1470
+ constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
1471
+ Proj proj = {});
1472
+ template<forward_range R, class T, class Proj = identity,
1473
+ indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
1474
+ ranges::less>
1475
+ constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
1476
+ Proj proj = {});
1477
+ }
1478
+
1479
  // [alg.partitions], partitions
1480
  template<class InputIterator, class Predicate>
1481
+ constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1482
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
1483
  bool is_partitioned(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1484
  ForwardIterator first, ForwardIterator last, Predicate pred);
1485
 
1486
+ namespace ranges {
1487
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
1488
+ indirect_unary_predicate<projected<I, Proj>> Pred>
1489
+ constexpr bool is_partitioned(I first, S last, Pred pred, Proj proj = {});
1490
+ template<input_range R, class Proj = identity,
1491
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1492
+ constexpr bool is_partitioned(R&& r, Pred pred, Proj proj = {});
1493
+ }
1494
+
1495
  template<class ForwardIterator, class Predicate>
1496
+ constexpr ForwardIterator partition(ForwardIterator first,
1497
  ForwardIterator last,
1498
  Predicate pred);
1499
  template<class ExecutionPolicy, class ForwardIterator, class Predicate>
1500
  ForwardIterator partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1501
  ForwardIterator first,
1502
  ForwardIterator last,
1503
  Predicate pred);
1504
+
1505
+ namespace ranges {
1506
+ template<permutable I, sentinel_for<I> S, class Proj = identity,
1507
+ indirect_unary_predicate<projected<I, Proj>> Pred>
1508
+ constexpr subrange<I>
1509
+ partition(I first, S last, Pred pred, Proj proj = {});
1510
+ template<forward_range R, class Proj = identity,
1511
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1512
+ requires permutable<iterator_t<R>>
1513
+ constexpr borrowed_subrange_t<R>
1514
+ partition(R&& r, Pred pred, Proj proj = {});
1515
+ }
1516
+
1517
  template<class BidirectionalIterator, class Predicate>
1518
  BidirectionalIterator stable_partition(BidirectionalIterator first,
1519
  BidirectionalIterator last,
1520
  Predicate pred);
1521
  template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
1522
  BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1523
  BidirectionalIterator first,
1524
  BidirectionalIterator last,
1525
  Predicate pred);
1526
+
1527
+ namespace ranges {
1528
+ template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
1529
+ indirect_unary_predicate<projected<I, Proj>> Pred>
1530
+ requires permutable<I>
1531
+ subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});
1532
+ template<bidirectional_range R, class Proj = identity,
1533
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1534
+ requires permutable<iterator_t<R>>
1535
+ borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});
1536
+ }
1537
+
1538
  template<class InputIterator, class OutputIterator1,
1539
  class OutputIterator2, class Predicate>
1540
+ constexpr pair<OutputIterator1, OutputIterator2>
1541
  partition_copy(InputIterator first, InputIterator last,
1542
  OutputIterator1 out_true, OutputIterator2 out_false,
1543
  Predicate pred);
1544
  template<class ExecutionPolicy, class ForwardIterator, class ForwardIterator1,
1545
  class ForwardIterator2, class Predicate>
1546
  pair<ForwardIterator1, ForwardIterator2>
1547
  partition_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1548
  ForwardIterator first, ForwardIterator last,
1549
  ForwardIterator1 out_true, ForwardIterator2 out_false,
1550
  Predicate pred);
1551
+
1552
+ namespace ranges {
1553
+ template<class I, class O1, class O2>
1554
+ using partition_copy_result = in_out_out_result<I, O1, O2>;
1555
+
1556
+ template<input_iterator I, sentinel_for<I> S,
1557
+ weakly_incrementable O1, weakly_incrementable O2,
1558
+ class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1559
+ requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
1560
+ constexpr partition_copy_result<I, O1, O2>
1561
+ partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
1562
+ Proj proj = {});
1563
+ template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
1564
+ class Proj = identity,
1565
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1566
+ requires indirectly_copyable<iterator_t<R>, O1> &&
1567
+ indirectly_copyable<iterator_t<R>, O2>
1568
+ constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
1569
+ partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});
1570
+ }
1571
+
1572
  template<class ForwardIterator, class Predicate>
1573
+ constexpr ForwardIterator
1574
+ partition_point(ForwardIterator first, ForwardIterator last,
1575
  Predicate pred);
1576
 
1577
+ namespace ranges {
1578
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
1579
+ indirect_unary_predicate<projected<I, Proj>> Pred>
1580
+ constexpr I partition_point(I first, S last, Pred pred, Proj proj = {});
1581
+ template<forward_range R, class Proj = identity,
1582
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1583
+ constexpr borrowed_iterator_t<R>
1584
+ partition_point(R&& r, Pred pred, Proj proj = {});
1585
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1586
 
1587
  // [alg.merge], merge
1588
  template<class InputIterator1, class InputIterator2, class OutputIterator>
1589
+ constexpr OutputIterator
1590
+ merge(InputIterator1 first1, InputIterator1 last1,
1591
  InputIterator2 first2, InputIterator2 last2,
1592
  OutputIterator result);
1593
  template<class InputIterator1, class InputIterator2, class OutputIterator,
1594
  class Compare>
1595
+ constexpr OutputIterator
1596
+ merge(InputIterator1 first1, InputIterator1 last1,
1597
  InputIterator2 first2, InputIterator2 last2,
1598
  OutputIterator result, Compare comp);
1599
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1600
  class ForwardIterator>
1601
+ ForwardIterator
1602
+ merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1603
  ForwardIterator1 first1, ForwardIterator1 last1,
1604
  ForwardIterator2 first2, ForwardIterator2 last2,
1605
  ForwardIterator result);
1606
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1607
  class ForwardIterator, class Compare>
1608
+ ForwardIterator
1609
+ merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1610
  ForwardIterator1 first1, ForwardIterator1 last1,
1611
  ForwardIterator2 first2, ForwardIterator2 last2,
1612
  ForwardIterator result, Compare comp);
1613
 
1614
+ namespace ranges {
1615
+ template<class I1, class I2, class O>
1616
+ using merge_result = in_in_out_result<I1, I2, O>;
1617
+
1618
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1619
+ weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
1620
+ class Proj2 = identity>
1621
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1622
+ constexpr merge_result<I1, I2, O>
1623
+ merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
1624
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1625
+ template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
1626
+ class Proj1 = identity, class Proj2 = identity>
1627
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1628
+ constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1629
+ merge(R1&& r1, R2&& r2, O result,
1630
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1631
+ }
1632
+
1633
  template<class BidirectionalIterator>
1634
  void inplace_merge(BidirectionalIterator first,
1635
  BidirectionalIterator middle,
1636
  BidirectionalIterator last);
1637
  template<class BidirectionalIterator, class Compare>
 
1647
  void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1648
  BidirectionalIterator first,
1649
  BidirectionalIterator middle,
1650
  BidirectionalIterator last, Compare comp);
1651
 
1652
+ namespace ranges {
1653
+ template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1654
+ class Proj = identity>
1655
+ requires sortable<I, Comp, Proj>
1656
+ I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
1657
+ template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1658
+ requires sortable<iterator_t<R>, Comp, Proj>
1659
+ borrowed_iterator_t<R>
1660
+ inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
1661
+ Proj proj = {});
1662
+ }
1663
+
1664
  // [alg.set.operations], set operations
1665
  template<class InputIterator1, class InputIterator2>
1666
+ constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
1667
  InputIterator2 first2, InputIterator2 last2);
1668
  template<class InputIterator1, class InputIterator2, class Compare>
1669
+ constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
1670
+ InputIterator2 first2, InputIterator2 last2,
1671
+ Compare comp);
1672
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
1673
  bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1674
  ForwardIterator1 first1, ForwardIterator1 last1,
1675
  ForwardIterator2 first2, ForwardIterator2 last2);
1676
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1677
  class Compare>
1678
  bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1679
  ForwardIterator1 first1, ForwardIterator1 last1,
1680
+ ForwardIterator2 first2, ForwardIterator2 last2,
1681
+ Compare comp);
1682
+
1683
+ namespace ranges {
1684
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1685
+ class Proj1 = identity, class Proj2 = identity,
1686
+ indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1687
+ ranges::less>
1688
+ constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
1689
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1690
+ template<input_range R1, input_range R2, class Proj1 = identity,
1691
+ class Proj2 = identity,
1692
+ indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1693
+ projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1694
+ constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
1695
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1696
+ }
1697
 
1698
  template<class InputIterator1, class InputIterator2, class OutputIterator>
1699
+ constexpr OutputIterator
1700
+ set_union(InputIterator1 first1, InputIterator1 last1,
1701
  InputIterator2 first2, InputIterator2 last2,
1702
  OutputIterator result);
1703
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1704
+ constexpr OutputIterator
1705
+ set_union(InputIterator1 first1, InputIterator1 last1,
1706
  InputIterator2 first2, InputIterator2 last2,
1707
  OutputIterator result, Compare comp);
1708
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1709
  class ForwardIterator>
1710
+ ForwardIterator
1711
+ set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1712
  ForwardIterator1 first1, ForwardIterator1 last1,
1713
  ForwardIterator2 first2, ForwardIterator2 last2,
1714
  ForwardIterator result);
1715
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1716
  class ForwardIterator, class Compare>
1717
+ ForwardIterator
1718
+ set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1719
  ForwardIterator1 first1, ForwardIterator1 last1,
1720
  ForwardIterator2 first2, ForwardIterator2 last2,
1721
  ForwardIterator result, Compare comp);
1722
 
1723
+ namespace ranges {
1724
+ template<class I1, class I2, class O>
1725
+ using set_union_result = in_in_out_result<I1, I2, O>;
1726
+
1727
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1728
+ weakly_incrementable O, class Comp = ranges::less,
1729
+ class Proj1 = identity, class Proj2 = identity>
1730
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1731
+ constexpr set_union_result<I1, I2, O>
1732
+ set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1733
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1734
+ template<input_range R1, input_range R2, weakly_incrementable O,
1735
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1736
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1737
+ constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1738
+ set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1739
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1740
+ }
1741
+
1742
  template<class InputIterator1, class InputIterator2, class OutputIterator>
1743
+ constexpr OutputIterator
1744
+ set_intersection(InputIterator1 first1, InputIterator1 last1,
1745
  InputIterator2 first2, InputIterator2 last2,
1746
  OutputIterator result);
1747
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1748
+ constexpr OutputIterator
1749
+ set_intersection(InputIterator1 first1, InputIterator1 last1,
1750
  InputIterator2 first2, InputIterator2 last2,
1751
  OutputIterator result, Compare comp);
1752
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1753
  class ForwardIterator>
1754
+ ForwardIterator
1755
+ set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1756
  ForwardIterator1 first1, ForwardIterator1 last1,
1757
  ForwardIterator2 first2, ForwardIterator2 last2,
1758
  ForwardIterator result);
1759
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1760
  class ForwardIterator, class Compare>
1761
+ ForwardIterator
1762
+ set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1763
  ForwardIterator1 first1, ForwardIterator1 last1,
1764
  ForwardIterator2 first2, ForwardIterator2 last2,
1765
  ForwardIterator result, Compare comp);
1766
 
1767
+ namespace ranges {
1768
+ template<class I1, class I2, class O>
1769
+ using set_intersection_result = in_in_out_result<I1, I2, O>;
1770
+
1771
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1772
+ weakly_incrementable O, class Comp = ranges::less,
1773
+ class Proj1 = identity, class Proj2 = identity>
1774
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1775
+ constexpr set_intersection_result<I1, I2, O>
1776
+ set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
1777
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1778
+ template<input_range R1, input_range R2, weakly_incrementable O,
1779
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1780
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1781
+ constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1782
+ set_intersection(R1&& r1, R2&& r2, O result,
1783
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1784
+ }
1785
+
1786
  template<class InputIterator1, class InputIterator2, class OutputIterator>
1787
+ constexpr OutputIterator
1788
+ set_difference(InputIterator1 first1, InputIterator1 last1,
1789
  InputIterator2 first2, InputIterator2 last2,
1790
  OutputIterator result);
1791
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1792
+ constexpr OutputIterator
1793
+ set_difference(InputIterator1 first1, InputIterator1 last1,
1794
  InputIterator2 first2, InputIterator2 last2,
1795
  OutputIterator result, Compare comp);
1796
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1797
  class ForwardIterator>
1798
+ ForwardIterator
1799
+ set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1800
  ForwardIterator1 first1, ForwardIterator1 last1,
1801
  ForwardIterator2 first2, ForwardIterator2 last2,
1802
  ForwardIterator result);
1803
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1804
  class ForwardIterator, class Compare>
1805
+ ForwardIterator
1806
+ set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1807
  ForwardIterator1 first1, ForwardIterator1 last1,
1808
  ForwardIterator2 first2, ForwardIterator2 last2,
1809
  ForwardIterator result, Compare comp);
1810
 
1811
+ namespace ranges {
1812
+ template<class I, class O>
1813
+ using set_difference_result = in_out_result<I, O>;
1814
+
1815
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1816
+ weakly_incrementable O, class Comp = ranges::less,
1817
+ class Proj1 = identity, class Proj2 = identity>
1818
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1819
+ constexpr set_difference_result<I1, O>
1820
+ set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
1821
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1822
+ template<input_range R1, input_range R2, weakly_incrementable O,
1823
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1824
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1825
+ constexpr set_difference_result<borrowed_iterator_t<R1>, O>
1826
+ set_difference(R1&& r1, R2&& r2, O result,
1827
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
1828
+ }
1829
+
1830
  template<class InputIterator1, class InputIterator2, class OutputIterator>
1831
+ constexpr OutputIterator
1832
+ set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1833
  InputIterator2 first2, InputIterator2 last2,
1834
  OutputIterator result);
1835
  template<class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1836
+ constexpr OutputIterator
1837
+ set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1838
  InputIterator2 first2, InputIterator2 last2,
1839
  OutputIterator result, Compare comp);
1840
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1841
  class ForwardIterator>
1842
+ ForwardIterator
1843
+ set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1844
  ForwardIterator1 first1, ForwardIterator1 last1,
1845
  ForwardIterator2 first2, ForwardIterator2 last2,
1846
  ForwardIterator result);
1847
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
1848
  class ForwardIterator, class Compare>
1849
+ ForwardIterator
1850
+ set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1851
  ForwardIterator1 first1, ForwardIterator1 last1,
1852
  ForwardIterator2 first2, ForwardIterator2 last2,
1853
  ForwardIterator result, Compare comp);
1854
 
1855
+ namespace ranges {
1856
+ template<class I1, class I2, class O>
1857
+ using set_symmetric_difference_result = in_in_out_result<I1, I2, O>;
1858
+
1859
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1860
+ weakly_incrementable O, class Comp = ranges::less,
1861
+ class Proj1 = identity, class Proj2 = identity>
1862
+ requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1863
+ constexpr set_symmetric_difference_result<I1, I2, O>
1864
+ set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
1865
+ Comp comp = {}, Proj1 proj1 = {},
1866
+ Proj2 proj2 = {});
1867
+ template<input_range R1, input_range R2, weakly_incrementable O,
1868
+ class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1869
+ requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1870
+ constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
1871
+ borrowed_iterator_t<R2>, O>
1872
+ set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
1873
+ Proj1 proj1 = {}, Proj2 proj2 = {});
1874
+ }
1875
+
1876
  // [alg.heap.operations], heap operations
1877
  template<class RandomAccessIterator>
1878
+ constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last);
1879
  template<class RandomAccessIterator, class Compare>
1880
+ constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last,
1881
  Compare comp);
1882
 
1883
+ namespace ranges {
1884
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1885
+ class Proj = identity>
1886
+ requires sortable<I, Comp, Proj>
1887
+ constexpr I
1888
+ push_heap(I first, S last, Comp comp = {}, Proj proj = {});
1889
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1890
+ requires sortable<iterator_t<R>, Comp, Proj>
1891
+ constexpr borrowed_iterator_t<R>
1892
+ push_heap(R&& r, Comp comp = {}, Proj proj = {});
1893
+ }
1894
+
1895
  template<class RandomAccessIterator>
1896
+ constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1897
  template<class RandomAccessIterator, class Compare>
1898
+ constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last,
1899
  Compare comp);
1900
 
1901
+ namespace ranges {
1902
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1903
+ class Proj = identity>
1904
+ requires sortable<I, Comp, Proj>
1905
+ constexpr I
1906
+ pop_heap(I first, S last, Comp comp = {}, Proj proj = {});
1907
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1908
+ requires sortable<iterator_t<R>, Comp, Proj>
1909
+ constexpr borrowed_iterator_t<R>
1910
+ pop_heap(R&& r, Comp comp = {}, Proj proj = {});
1911
+ }
1912
+
1913
  template<class RandomAccessIterator>
1914
+ constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last);
1915
  template<class RandomAccessIterator, class Compare>
1916
+ constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last,
1917
  Compare comp);
1918
 
1919
+ namespace ranges {
1920
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1921
+ class Proj = identity>
1922
+ requires sortable<I, Comp, Proj>
1923
+ constexpr I
1924
+ make_heap(I first, S last, Comp comp = {}, Proj proj = {});
1925
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1926
+ requires sortable<iterator_t<R>, Comp, Proj>
1927
+ constexpr borrowed_iterator_t<R>
1928
+ make_heap(R&& r, Comp comp = {}, Proj proj = {});
1929
+ }
1930
+
1931
  template<class RandomAccessIterator>
1932
+ constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1933
  template<class RandomAccessIterator, class Compare>
1934
+ constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last,
1935
  Compare comp);
1936
 
1937
+ namespace ranges {
1938
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1939
+ class Proj = identity>
1940
+ requires sortable<I, Comp, Proj>
1941
+ constexpr I
1942
+ sort_heap(I first, S last, Comp comp = {}, Proj proj = {});
1943
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
1944
+ requires sortable<iterator_t<R>, Comp, Proj>
1945
+ constexpr borrowed_iterator_t<R>
1946
+ sort_heap(R&& r, Comp comp = {}, Proj proj = {});
1947
+ }
1948
+
1949
  template<class RandomAccessIterator>
1950
+ constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
1951
  template<class RandomAccessIterator, class Compare>
1952
+ constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last,
1953
+ Compare comp);
1954
  template<class ExecutionPolicy, class RandomAccessIterator>
1955
  bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1956
  RandomAccessIterator first, RandomAccessIterator last);
1957
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1958
  bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1959
+ RandomAccessIterator first, RandomAccessIterator last,
1960
+ Compare comp);
1961
+
1962
+ namespace ranges {
1963
+ template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
1964
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
1965
+ constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});
1966
+ template<random_access_range R, class Proj = identity,
1967
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
1968
+ constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});
1969
+ }
1970
+
1971
  template<class RandomAccessIterator>
1972
+ constexpr RandomAccessIterator
1973
+ is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
1974
  template<class RandomAccessIterator, class Compare>
1975
+ constexpr RandomAccessIterator
1976
+ is_heap_until(RandomAccessIterator first, RandomAccessIterator last,
1977
  Compare comp);
1978
  template<class ExecutionPolicy, class RandomAccessIterator>
1979
+ RandomAccessIterator
1980
+ is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1981
  RandomAccessIterator first, RandomAccessIterator last);
1982
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
1983
+ RandomAccessIterator
1984
+ is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
1985
  RandomAccessIterator first, RandomAccessIterator last,
1986
  Compare comp);
1987
 
1988
+ namespace ranges {
1989
+ template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
1990
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
1991
+ constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});
1992
+ template<random_access_range R, class Proj = identity,
1993
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
1994
+ constexpr borrowed_iterator_t<R>
1995
+ is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
1996
+ }
1997
+
1998
  // [alg.min.max], minimum and maximum
1999
  template<class T> constexpr const T& min(const T& a, const T& b);
2000
  template<class T, class Compare>
2001
  constexpr const T& min(const T& a, const T& b, Compare comp);
2002
  template<class T>
2003
  constexpr T min(initializer_list<T> t);
2004
  template<class T, class Compare>
2005
  constexpr T min(initializer_list<T> t, Compare comp);
2006
 
2007
+ namespace ranges {
2008
+ template<class T, class Proj = identity,
2009
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2010
+ constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {});
2011
+ template<copyable T, class Proj = identity,
2012
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2013
+ constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {});
2014
+ template<input_range R, class Proj = identity,
2015
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2016
+ requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
2017
+ constexpr range_value_t<R>
2018
+ min(R&& r, Comp comp = {}, Proj proj = {});
2019
+ }
2020
+
2021
  template<class T> constexpr const T& max(const T& a, const T& b);
2022
  template<class T, class Compare>
2023
  constexpr const T& max(const T& a, const T& b, Compare comp);
2024
  template<class T>
2025
  constexpr T max(initializer_list<T> t);
2026
  template<class T, class Compare>
2027
  constexpr T max(initializer_list<T> t, Compare comp);
2028
 
2029
+ namespace ranges {
2030
+ template<class T, class Proj = identity,
2031
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2032
+ constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {});
2033
+ template<copyable T, class Proj = identity,
2034
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2035
+ constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {});
2036
+ template<input_range R, class Proj = identity,
2037
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2038
+ requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
2039
+ constexpr range_value_t<R>
2040
+ max(R&& r, Comp comp = {}, Proj proj = {});
2041
+ }
2042
+
2043
  template<class T> constexpr pair<const T&, const T&> minmax(const T& a, const T& b);
2044
  template<class T, class Compare>
2045
  constexpr pair<const T&, const T&> minmax(const T& a, const T& b, Compare comp);
2046
  template<class T>
2047
  constexpr pair<T, T> minmax(initializer_list<T> t);
2048
  template<class T, class Compare>
2049
  constexpr pair<T, T> minmax(initializer_list<T> t, Compare comp);
2050
 
2051
+ namespace ranges {
2052
+ template<class T>
2053
+ using minmax_result = min_max_result<T>;
2054
+
2055
+ template<class T, class Proj = identity,
2056
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2057
+ constexpr minmax_result<const T&>
2058
+ minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});
2059
+ template<copyable T, class Proj = identity,
2060
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2061
+ constexpr minmax_result<T>
2062
+ minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {});
2063
+ template<input_range R, class Proj = identity,
2064
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2065
+ requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
2066
+ constexpr minmax_result<range_value_t<R>>
2067
+ minmax(R&& r, Comp comp = {}, Proj proj = {});
2068
+ }
2069
+
2070
  template<class ForwardIterator>
2071
  constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
2072
  template<class ForwardIterator, class Compare>
2073
  constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
2074
  Compare comp);
 
2077
  ForwardIterator first, ForwardIterator last);
2078
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
2079
  ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
2080
  ForwardIterator first, ForwardIterator last,
2081
  Compare comp);
2082
+
2083
+ namespace ranges {
2084
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
2085
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
2086
+ constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
2087
+ template<forward_range R, class Proj = identity,
2088
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2089
+ constexpr borrowed_iterator_t<R>
2090
+ min_element(R&& r, Comp comp = {}, Proj proj = {});
2091
+ }
2092
+
2093
  template<class ForwardIterator>
2094
  constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
2095
  template<class ForwardIterator, class Compare>
2096
  constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
2097
  Compare comp);
 
2100
  ForwardIterator first, ForwardIterator last);
2101
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
2102
  ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
2103
  ForwardIterator first, ForwardIterator last,
2104
  Compare comp);
2105
+
2106
+ namespace ranges {
2107
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
2108
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
2109
+ constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {});
2110
+ template<forward_range R, class Proj = identity,
2111
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2112
+ constexpr borrowed_iterator_t<R>
2113
+ max_element(R&& r, Comp comp = {}, Proj proj = {});
2114
+ }
2115
+
2116
  template<class ForwardIterator>
2117
  constexpr pair<ForwardIterator, ForwardIterator>
2118
  minmax_element(ForwardIterator first, ForwardIterator last);
2119
  template<class ForwardIterator, class Compare>
2120
  constexpr pair<ForwardIterator, ForwardIterator>
 
2126
  template<class ExecutionPolicy, class ForwardIterator, class Compare>
2127
  pair<ForwardIterator, ForwardIterator>
2128
  minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
2129
  ForwardIterator first, ForwardIterator last, Compare comp);
2130
 
2131
+ namespace ranges {
2132
+ template<class I>
2133
+ using minmax_element_result = min_max_result<I>;
2134
+
2135
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
2136
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
2137
+ constexpr minmax_element_result<I>
2138
+ minmax_element(I first, S last, Comp comp = {}, Proj proj = {});
2139
+ template<forward_range R, class Proj = identity,
2140
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
2141
+ constexpr minmax_element_result<borrowed_iterator_t<R>>
2142
+ minmax_element(R&& r, Comp comp = {}, Proj proj = {});
2143
+ }
2144
+
2145
  // [alg.clamp], bounded value
2146
  template<class T>
2147
  constexpr const T& clamp(const T& v, const T& lo, const T& hi);
2148
  template<class T, class Compare>
2149
  constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp);
2150
 
2151
+ namespace ranges {
2152
+ template<class T, class Proj = identity,
2153
+ indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
2154
+ constexpr const T&
2155
+ clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {});
2156
+ }
2157
+
2158
  // [alg.lex.comparison], lexicographical comparison
2159
  template<class InputIterator1, class InputIterator2>
2160
+ constexpr bool
2161
+ lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
2162
  InputIterator2 first2, InputIterator2 last2);
2163
  template<class InputIterator1, class InputIterator2, class Compare>
2164
+ constexpr bool
2165
+ lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
2166
  InputIterator2 first2, InputIterator2 last2,
2167
  Compare comp);
2168
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
2169
+ bool
2170
+ lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
2171
  ForwardIterator1 first1, ForwardIterator1 last1,
2172
  ForwardIterator2 first2, ForwardIterator2 last2);
2173
  template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
2174
  class Compare>
2175
+ bool
2176
+ lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
2177
  ForwardIterator1 first1, ForwardIterator1 last1,
2178
  ForwardIterator2 first2, ForwardIterator2 last2,
2179
  Compare comp);
2180
 
2181
+ namespace ranges {
2182
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
2183
+ class Proj1 = identity, class Proj2 = identity,
2184
+ indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
2185
+ ranges::less>
2186
+ constexpr bool
2187
+ lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
2188
+ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
2189
+ template<input_range R1, input_range R2, class Proj1 = identity,
2190
+ class Proj2 = identity,
2191
+ indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
2192
+ projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
2193
+ constexpr bool
2194
+ lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
2195
+ Proj1 proj1 = {}, Proj2 proj2 = {});
2196
+ }
2197
+
2198
+ // [alg.three.way], three-way comparison algorithms
2199
+ template<class InputIterator1, class InputIterator2, class Cmp>
2200
+ constexpr auto
2201
+ lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
2202
+ InputIterator2 b2, InputIterator2 e2,
2203
+ Cmp comp)
2204
+ -> decltype(comp(*b1, *b2));
2205
+ template<class InputIterator1, class InputIterator2>
2206
+ constexpr auto
2207
+ lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
2208
+ InputIterator2 b2, InputIterator2 e2);
2209
+
2210
  // [alg.permutation.generators], permutations
2211
  template<class BidirectionalIterator>
2212
+ constexpr bool next_permutation(BidirectionalIterator first,
2213
  BidirectionalIterator last);
2214
  template<class BidirectionalIterator, class Compare>
2215
+ constexpr bool next_permutation(BidirectionalIterator first,
2216
  BidirectionalIterator last, Compare comp);
2217
+
2218
+ namespace ranges {
2219
+ template<class I>
2220
+ using next_permutation_result = in_found_result<I>;
2221
+
2222
+ template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
2223
+ class Proj = identity>
2224
+ requires sortable<I, Comp, Proj>
2225
+ constexpr next_permutation_result<I>
2226
+ next_permutation(I first, S last, Comp comp = {}, Proj proj = {});
2227
+ template<bidirectional_range R, class Comp = ranges::less,
2228
+ class Proj = identity>
2229
+ requires sortable<iterator_t<R>, Comp, Proj>
2230
+ constexpr next_permutation_result<borrowed_iterator_t<R>>
2231
+ next_permutation(R&& r, Comp comp = {}, Proj proj = {});
2232
+ }
2233
+
2234
  template<class BidirectionalIterator>
2235
+ constexpr bool prev_permutation(BidirectionalIterator first,
2236
  BidirectionalIterator last);
2237
  template<class BidirectionalIterator, class Compare>
2238
+ constexpr bool prev_permutation(BidirectionalIterator first,
2239
  BidirectionalIterator last, Compare comp);
2240
+
2241
+ namespace ranges {
2242
+ template<class I>
2243
+ using prev_permutation_result = in_found_result<I>;
2244
+
2245
+ template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
2246
+ class Proj = identity>
2247
+ requires sortable<I, Comp, Proj>
2248
+ constexpr prev_permutation_result<I>
2249
+ prev_permutation(I first, S last, Comp comp = {}, Proj proj = {});
2250
+ template<bidirectional_range R, class Comp = ranges::less,
2251
+ class Proj = identity>
2252
+ requires sortable<iterator_t<R>, Comp, Proj>
2253
+ constexpr prev_permutation_result<borrowed_iterator_t<R>>
2254
+ prev_permutation(R&& r, Comp comp = {}, Proj proj = {});
2255
+ }
2256
  }
2257
  ```
2258