xref: /freebsd/contrib/llvm-project/libcxx/modules/std/algorithm.inc (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10export namespace std {
11  namespace ranges {
12    // [algorithms.results], algorithm result types
13    using std::ranges::in_found_result;
14    using std::ranges::in_fun_result;
15    using std::ranges::in_in_out_result;
16    using std::ranges::in_in_result;
17    using std::ranges::in_out_out_result;
18    using std::ranges::in_out_result;
19#if _LIBCPP_STD_VER >= 23
20    using std::ranges::in_value_result;
21#endif
22    using std::ranges::min_max_result;
23    // using std::ranges::out_value_result;
24  } // namespace ranges
25
26  // [alg.nonmodifying], non-modifying sequence operations
27  // [alg.all.of], all of
28  using std::all_of;
29  namespace ranges {
30    using std::ranges::all_of;
31  }
32
33  // [alg.any.of], any of
34  using std::any_of;
35  namespace ranges {
36    using std::ranges::any_of;
37  }
38
39  // [alg.none.of], none of
40  using std::none_of;
41  namespace ranges {
42    using std::ranges::none_of;
43  }
44
45#if _LIBCPP_STD_VER >= 23
46  // [alg.contains], contains
47  namespace ranges {
48    using std::ranges::contains;
49    using std::ranges::contains_subrange;
50  } // namespace ranges
51#endif // _LIBCPP_STD_VER >= 23
52
53  // [alg.foreach], for each
54  using std::for_each;
55
56  namespace ranges {
57    using std::ranges::for_each;
58    using std::ranges::for_each_result;
59  } // namespace ranges
60
61  using std::for_each_n;
62
63  namespace ranges {
64    using std::ranges::for_each_n_result;
65
66    using std::ranges::for_each_n;
67  } // namespace ranges
68
69  // [alg.find], find
70  using std::find;
71  using std::find_if;
72  using std::find_if_not;
73
74  namespace ranges {
75    using std::ranges::find;
76    using std::ranges::find_if;
77    using std::ranges::find_if_not;
78  } // namespace ranges
79
80#if _LIBCPP_STD_VER >= 23
81  // [alg.find.last], find last
82  namespace ranges {
83    using std::ranges::find_last;
84    using std::ranges::find_last_if;
85    using std::ranges::find_last_if_not;
86  } // namespace ranges
87#endif
88
89  // [alg.find.end], find end
90  using std::find_end;
91
92  namespace ranges {
93    using std::ranges::find_end;
94  }
95
96  // [alg.find.first.of], find first
97  using std::find_first_of;
98
99  namespace ranges {
100    using std::ranges::find_first_of;
101  }
102
103  // [alg.adjacent.find], adjacent find
104  using std::adjacent_find;
105
106  namespace ranges {
107    using std::ranges::adjacent_find;
108  }
109
110  // [alg.count], count
111  using std::count;
112  using std::count_if;
113
114  namespace ranges {
115    using std::ranges::count;
116    using std::ranges::count_if;
117  } // namespace ranges
118
119  // [mismatch], mismatch
120  using std::mismatch;
121
122  namespace ranges {
123    using std::ranges::mismatch_result;
124
125    using std::ranges::mismatch;
126  } // namespace ranges
127
128  // [alg.equal], equal
129  using std::equal;
130
131  namespace ranges {
132    using std::ranges::equal;
133  }
134
135  // [alg.is.permutation], is permutation
136  using std::is_permutation;
137
138  namespace ranges {
139    using std::ranges::is_permutation;
140  }
141
142  // [alg.search], search
143  using std::search;
144
145  namespace ranges {
146    using std::ranges::search;
147  }
148
149  using std::search_n;
150
151  namespace ranges {
152    using std::ranges::search_n;
153  }
154
155  namespace ranges {
156#if _LIBCPP_STD_VER >= 23
157    // [alg.starts.with], starts with
158    using std::ranges::starts_with;
159
160    // [alg.ends.with], ends with
161    using std::ranges::ends_with;
162
163    // [alg.fold], fold
164    using std::ranges::fold_left;
165    using std::ranges::fold_left_with_iter;
166    using std::ranges::fold_left_with_iter_result;
167#  if 0
168    using std::ranges::fold_left_first;
169    using std::ranges::fold_right;
170    using std::ranges::fold_right_last;
171    using std::ranges::fold_left_with_iter;
172    using std::ranges::fold_left_first_with_iter;
173    using std::ranges::fold_left_first_with_iter;
174#  endif
175#endif // _LIBCPP_STD_VER >= 23
176  }    // namespace ranges
177
178  // [alg.modifying.operations], mutating sequence operations
179  // [alg.copy], copy
180  using std::copy;
181
182  namespace ranges {
183    using std::ranges::copy;
184    using std::ranges::copy_result;
185  } // namespace ranges
186
187  using std::copy_n;
188
189  namespace ranges {
190    using std::ranges::copy_n;
191    using std::ranges::copy_n_result;
192  } // namespace ranges
193
194  using std::copy_if;
195
196  namespace ranges {
197    using std::ranges::copy_if;
198    using std::ranges::copy_if_result;
199  } // namespace ranges
200
201  using std::copy_backward;
202
203  namespace ranges {
204    using std::ranges::copy_backward;
205    using std::ranges::copy_backward_result;
206  } // namespace ranges
207
208  // [alg.move], move
209  using std::move;
210
211  namespace ranges {
212    using std::ranges::move;
213    using std::ranges::move_result;
214  } // namespace ranges
215
216  using std::move_backward;
217
218  namespace ranges {
219    using std::ranges::move_backward;
220    using std::ranges::move_backward_result;
221  } // namespace ranges
222
223  // [alg.swap], swap
224  using std::swap_ranges;
225
226  namespace ranges {
227    using std::ranges::swap_ranges;
228    using std::ranges::swap_ranges_result;
229  } // namespace ranges
230
231  using std::iter_swap;
232
233  // [alg.transform], transform
234  using std::transform;
235
236  namespace ranges {
237    using std::ranges::binary_transform_result;
238    using std::ranges::unary_transform_result;
239
240    using std::ranges::transform;
241
242  } // namespace ranges
243
244  using std::replace;
245  using std::replace_if;
246
247  namespace ranges {
248    using std::ranges::replace;
249    using std::ranges::replace_if;
250  } // namespace ranges
251
252  using std::replace_copy;
253  using std::replace_copy_if;
254
255  namespace ranges {
256    using std::ranges::replace_copy;
257    using std::ranges::replace_copy_if;
258    using std::ranges::replace_copy_if_result;
259    using std::ranges::replace_copy_result;
260  } // namespace ranges
261
262  // [alg.fill], fill
263  using std::fill;
264  using std::fill_n;
265
266  namespace ranges {
267    using std::ranges::fill;
268    using std::ranges::fill_n;
269  } // namespace ranges
270
271  // [alg.generate], generate
272  using std::generate;
273  using std::generate_n;
274
275  namespace ranges {
276    using std::ranges::generate;
277    using std::ranges::generate_n;
278  } // namespace ranges
279
280  // [alg.remove], remove
281  using std::remove;
282  using std::remove_if;
283
284  namespace ranges {
285    using std::ranges::remove;
286    using std::ranges::remove_if;
287  } // namespace ranges
288
289  using std::remove_copy;
290  using std::remove_copy_if;
291  namespace ranges {
292    using std::ranges::remove_copy;
293    using std::ranges::remove_copy_if;
294    using std::ranges::remove_copy_if_result;
295    using std::ranges::remove_copy_result;
296  } // namespace ranges
297
298  // [alg.unique], unique
299  using std::unique;
300
301  namespace ranges {
302    using std::ranges::unique;
303  }
304
305  using std::unique_copy;
306
307  namespace ranges {
308    using std::ranges::unique_copy;
309    using std::ranges::unique_copy_result;
310  } // namespace ranges
311
312  // [alg.reverse], reverse
313  using std::reverse;
314
315  namespace ranges {
316    using std::ranges::reverse;
317  }
318
319  using std::reverse_copy;
320
321  namespace ranges {
322    using std::ranges::reverse_copy;
323    using std::ranges::reverse_copy_result;
324  } // namespace ranges
325
326  // [alg.rotate], rotate
327  using std::rotate;
328
329  namespace ranges {
330    using std::ranges::rotate;
331  }
332
333  using std::rotate_copy;
334
335  namespace ranges {
336    using std::ranges::rotate_copy;
337    using std::ranges::rotate_copy_result;
338  } // namespace ranges
339
340  // [alg.random.sample], sample
341  using std::sample;
342
343  namespace ranges {
344    using std::ranges::sample;
345  }
346
347  // [alg.random.shuffle], shuffle
348  using std::shuffle;
349
350  namespace ranges {
351    using std::ranges::shuffle;
352  }
353
354  // [alg.shift], shift
355  using std::shift_left;
356
357  namespace ranges {
358    // using std::ranges::shift_left;
359  }
360
361  using std::shift_right;
362
363  namespace ranges {
364    // using std::ranges::shift_right;
365  }
366
367  // [alg.sorting], sorting and related operations
368  // [alg.sort], sorting
369  using std::sort;
370
371  namespace ranges {
372    using std::ranges::sort;
373  }
374
375  using std::stable_sort;
376
377  namespace ranges {
378    using std::ranges::stable_sort;
379  }
380
381  using std::partial_sort;
382
383  namespace ranges {
384    using std::ranges::partial_sort;
385  }
386  using std::partial_sort_copy;
387
388  namespace ranges {
389    using std::ranges::partial_sort_copy;
390    using std::ranges::partial_sort_copy_result;
391  } // namespace ranges
392
393  using std::is_sorted;
394  using std::is_sorted_until;
395
396  namespace ranges {
397    using std::ranges::is_sorted;
398    using std::ranges::is_sorted_until;
399  } // namespace ranges
400
401  // [alg.nth.element], Nth element
402  using std::nth_element;
403
404  namespace ranges {
405    using std::ranges::nth_element;
406  }
407
408  // [alg.binary.search], binary search
409  using std::lower_bound;
410
411  namespace ranges {
412    using std::ranges::lower_bound;
413  }
414
415  using std::upper_bound;
416
417  namespace ranges {
418    using std::ranges::upper_bound;
419  }
420
421  using std::equal_range;
422
423  namespace ranges {
424    using std::ranges::equal_range;
425  }
426
427  using std::binary_search;
428
429  namespace ranges {
430    using std::ranges::binary_search;
431  }
432
433  // [alg.partitions], partitions
434  using std::is_partitioned;
435
436  namespace ranges {
437    using std::ranges::is_partitioned;
438  }
439
440  using std::partition;
441
442  namespace ranges {
443    using std::ranges::partition;
444  }
445
446  using std::stable_partition;
447
448  namespace ranges {
449    using std::ranges::stable_partition;
450  }
451
452  using std::partition_copy;
453
454  namespace ranges {
455    using std::ranges::partition_copy;
456    using std::ranges::partition_copy_result;
457  } // namespace ranges
458
459  using std::partition_point;
460
461  namespace ranges {
462    using std::ranges::partition_point;
463  }
464  // [alg.merge], merge
465  using std::merge;
466  namespace ranges {
467    using std::ranges::merge;
468    using std::ranges::merge_result;
469  } // namespace ranges
470
471  using std::inplace_merge;
472
473  namespace ranges {
474    using std::ranges::inplace_merge;
475  }
476
477  // [alg.set.operations], set operations
478  using std::includes;
479  namespace ranges {
480    using std::ranges::includes;
481  }
482
483  using std::set_union;
484
485  namespace ranges {
486    using std::ranges::set_union;
487    using std::ranges::set_union_result;
488  } // namespace ranges
489
490  using std::set_intersection;
491  namespace ranges {
492    using std::ranges::set_intersection;
493    using std::ranges::set_intersection_result;
494  } // namespace ranges
495
496  using std::set_difference;
497
498  namespace ranges {
499    using std::ranges::set_difference;
500    using std::ranges::set_difference_result;
501  } // namespace ranges
502
503  using std::set_symmetric_difference;
504
505  namespace ranges {
506    using std::ranges::set_symmetric_difference_result;
507
508    using std::ranges::set_symmetric_difference;
509  } // namespace ranges
510
511  // [alg.heap.operations], heap operations
512  using std::push_heap;
513
514  namespace ranges {
515    using std::ranges::push_heap;
516  }
517
518  using std::pop_heap;
519
520  namespace ranges {
521    using std::ranges::pop_heap;
522  }
523
524  using std::make_heap;
525
526  namespace ranges {
527    using std::ranges::make_heap;
528  }
529
530  using std::sort_heap;
531
532  namespace ranges {
533    using std::ranges::sort_heap;
534  }
535
536  using std::is_heap;
537
538  namespace ranges {
539    using std::ranges::is_heap;
540  }
541
542  using std::is_heap_until;
543
544  namespace ranges {
545    using std::ranges::is_heap_until;
546  }
547
548  // [alg.min.max], minimum and maximum
549  using std::min;
550
551  namespace ranges {
552    using std::ranges::min;
553  }
554
555  using std::max;
556
557  namespace ranges {
558    using std::ranges::max;
559  }
560
561  using std::minmax;
562
563  namespace ranges {
564    using std::ranges::minmax_result;
565
566    using std::ranges::minmax;
567  } // namespace ranges
568
569  using std::min_element;
570
571  namespace ranges {
572    using std::ranges::min_element;
573  }
574
575  using std::max_element;
576
577  namespace ranges {
578    using std::ranges::max_element;
579  }
580
581  using std::minmax_element;
582
583  namespace ranges {
584    using std::ranges::minmax_element_result;
585
586    using std::ranges::minmax_element;
587  } // namespace ranges
588    // [alg.clamp], bounded value
589  using std::clamp;
590
591  namespace ranges {
592    using std::ranges::clamp;
593  }
594
595  // [alg.lex.comparison], lexicographical comparison
596  using std::lexicographical_compare;
597
598  namespace ranges {
599    using std::ranges::lexicographical_compare;
600  }
601
602  // [alg.three.way], three-way comparison algorithms
603  using std::lexicographical_compare_three_way;
604
605  // [alg.permutation.generators], permutations
606  using std::next_permutation;
607
608  namespace ranges {
609    using std::ranges::next_permutation_result;
610
611    using std::ranges::next_permutation;
612  } // namespace ranges
613
614  using std::prev_permutation;
615
616  namespace ranges {
617    using std::ranges::prev_permutation_result;
618
619    using std::ranges::prev_permutation;
620  } // namespace ranges
621
622} // namespace std
623