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