xref: /freebsd/contrib/llvm-project/libcxx/include/algorithm (revision 700637cbb5e582861067a11aaca4d053546871d2)
10b57cec5SDimitry Andric// -*- C++ -*-
2349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
30b57cec5SDimitry Andric//
40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric//
80b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric
100b57cec5SDimitry Andric#ifndef _LIBCPP_ALGORITHM
110b57cec5SDimitry Andric#define _LIBCPP_ALGORITHM
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric/*
140b57cec5SDimitry Andric    algorithm synopsis
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric#include <initializer_list>
170b57cec5SDimitry Andric
180b57cec5SDimitry Andricnamespace std
190b57cec5SDimitry Andric{
200b57cec5SDimitry Andric
2104eeddc0SDimitry Andricnamespace ranges {
2281ad6265SDimitry Andric
2381ad6265SDimitry Andric  // [algorithms.results], algorithm result types
2481ad6265SDimitry Andric  template <class I, class F>
2581ad6265SDimitry Andric    struct in_fun_result;                // since C++20
2681ad6265SDimitry Andric
2704eeddc0SDimitry Andric  template <class I1, class I2>
2804eeddc0SDimitry Andric    struct in_in_result;                 // since C++20
291fd87a68SDimitry Andric
3081ad6265SDimitry Andric  template <class I, class O>
3181ad6265SDimitry Andric    struct in_out_result;                // since C++20
3281ad6265SDimitry Andric
331fd87a68SDimitry Andric  template <class I1, class I2, class O>
341fd87a68SDimitry Andric    struct in_in_out_result;             // since C++20
3581ad6265SDimitry Andric
3681ad6265SDimitry Andric  template <class I, class O1, class O2>
3781ad6265SDimitry Andric    struct in_out_out_result;            // since C++20
3881ad6265SDimitry Andric
3981ad6265SDimitry Andric  template <class I1, class I2>
4081ad6265SDimitry Andric    struct min_max_result;               // since C++20
4181ad6265SDimitry Andric
4281ad6265SDimitry Andric  template <class I>
4381ad6265SDimitry Andric    struct in_found_result;              // since C++20
4481ad6265SDimitry Andric
45cb14a3feSDimitry Andric  template <class I, class T>
46cb14a3feSDimitry Andric    struct in_value_result;              // since C++23
47cb14a3feSDimitry Andric
48*700637cbSDimitry Andric  template <class O, class T>
49*700637cbSDimitry Andric    struct out_value_result;             // since C++23
50*700637cbSDimitry Andric
5181ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
5281ad6265SDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>                                   // since C++20
5381ad6265SDimitry Andric  constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
5481ad6265SDimitry Andric
5581ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
5681ad6265SDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>                       // since C++20
5781ad6265SDimitry Andric  constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
5881ad6265SDimitry Andric
5981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
6081ad6265SDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
6181ad6265SDimitry Andric  constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {});                       // since C++20
6281ad6265SDimitry Andric
6381ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
6481ad6265SDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
6581ad6265SDimitry Andric  constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {});            // since C++20
6681ad6265SDimitry Andric
6781ad6265SDimitry Andric  template<class I1, class I2>
6881ad6265SDimitry Andric    using mismatch_result = in_in_result<I1, I2>;
6981ad6265SDimitry Andric
7081ad6265SDimitry Andric  template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
7181ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
7281ad6265SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
7306c3fb27SDimitry Andric  constexpr mismatch_result<_I1, _I2>                                                                     // since C++20
7406c3fb27SDimitry Andric  mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
7581ad6265SDimitry Andric
7681ad6265SDimitry Andric  template <input_range R1, input_range R2,
7781ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
7881ad6265SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
7981ad6265SDimitry Andric  constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
8081ad6265SDimitry Andric  mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})                          // since C++20
8181ad6265SDimitry Andric
8281ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
8381ad6265SDimitry Andric    constexpr I find(I first, S last, const T& value, Proj proj = {});                                    // since C++20
8481ad6265SDimitry Andric
8581ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity>
8681ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
8781ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
8881ad6265SDimitry Andric      find(R&& r, const T& value, Proj proj = {});                                                        // since C++20
8981ad6265SDimitry Andric
9081ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
9181ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
9281ad6265SDimitry Andric    constexpr I find_if(I first, S last, Pred pred, Proj proj = {});                                      // since C++20
9381ad6265SDimitry Andric
9481ad6265SDimitry Andric  template<input_range R, class Proj = identity,
9581ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
9681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
9781ad6265SDimitry Andric      find_if(R&& r, Pred pred, Proj proj = {});                                                          // since C++20
9881ad6265SDimitry Andric
9981ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
10081ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
10181ad6265SDimitry Andric    constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});                                  // since C++20
10281ad6265SDimitry Andric
10381ad6265SDimitry Andric  template<input_range R, class Proj = identity,
10481ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
10581ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
10681ad6265SDimitry Andric      find_if_not(R&& r, Pred pred, Proj proj = {});                                                      // since C++20
10781ad6265SDimitry Andric
1080fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
1090fca6ea1SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1100fca6ea1SDimitry Andric    constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {});                     // since C++23
1110fca6ea1SDimitry Andric
1120fca6ea1SDimitry Andric  template<forward_range R, class T, class Proj = identity>
1130fca6ea1SDimitry Andric    requires
1140fca6ea1SDimitry Andric      indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
1150fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {});                   // since C++23
1160fca6ea1SDimitry Andric
1170fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
1180fca6ea1SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
1190fca6ea1SDimitry Andric    constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {});                      // since C++23
1200fca6ea1SDimitry Andric
1210fca6ea1SDimitry Andric  template<forward_range R, class Proj = identity,
1220fca6ea1SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1230fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {});                     // since C++23
1240fca6ea1SDimitry Andric
1250fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
1260fca6ea1SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
1270fca6ea1SDimitry Andric    constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {});                  // since C++23
1280fca6ea1SDimitry Andric
1290fca6ea1SDimitry Andric  template<forward_range R, class Proj = identity,
1300fca6ea1SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1310fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {});                 // since C++23
1320fca6ea1SDimitry Andric
13381ad6265SDimitry Andric  template<class T, class Proj = identity,
13481ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
13581ad6265SDimitry Andric    constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
13681ad6265SDimitry Andric
13781ad6265SDimitry Andric  template<copyable T, class Proj = identity,
13881ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
13981ad6265SDimitry Andric    constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
14081ad6265SDimitry Andric
14181ad6265SDimitry Andric template<input_range R, class Proj = identity,
14281ad6265SDimitry Andric          indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
14381ad6265SDimitry Andric   requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
14481ad6265SDimitry Andric   constexpr range_value_t<R>
14581ad6265SDimitry Andric     min(R&& r, Comp comp = {}, Proj proj = {});                                                          // since C++20
14681ad6265SDimitry Andric
14781ad6265SDimitry Andric  template<class T, class Proj = identity,
14881ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
14981ad6265SDimitry Andric    constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
15081ad6265SDimitry Andric
15181ad6265SDimitry Andric  template<copyable T, class Proj = identity,
15281ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
15381ad6265SDimitry Andric    constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
15481ad6265SDimitry Andric
15581ad6265SDimitry Andric  template<input_range R, class Proj = identity,
15681ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
15781ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
15881ad6265SDimitry Andric    constexpr range_value_t<R>
15981ad6265SDimitry Andric      max(R&& r, Comp comp = {}, Proj proj = {});                                                         // since C++20
16081ad6265SDimitry Andric
16181ad6265SDimitry Andric  template<class I, class O>
16281ad6265SDimitry Andric    using unary_transform_result = in_out_result<I, O>;                                                   // since C++20
16381ad6265SDimitry Andric
16481ad6265SDimitry Andric  template<class I1, class I2, class O>
16581ad6265SDimitry Andric    using binary_transform_result = in_in_out_result<I1, I2, O>;                                          // since C++20
16681ad6265SDimitry Andric
16781ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
16881ad6265SDimitry Andric           copy_constructible F, class Proj = identity>
16981ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
17081ad6265SDimitry Andric    constexpr ranges::unary_transform_result<I, O>
17181ad6265SDimitry Andric      transform(I first1, S last1, O result, F op, Proj proj = {});                                       // since C++20
17281ad6265SDimitry Andric
17381ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, copy_constructible F,
17481ad6265SDimitry Andric           class Proj = identity>
17581ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
17681ad6265SDimitry Andric    constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
17781ad6265SDimitry Andric      transform(R&& r, O result, F op, Proj proj = {});                                                   // since C++20
17881ad6265SDimitry Andric
17981ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
18081ad6265SDimitry Andric           weakly_incrementable O, copy_constructible F, class Proj1 = identity,
18181ad6265SDimitry Andric           class Proj2 = identity>
18281ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
18381ad6265SDimitry Andric                                           projected<I2, Proj2>>>
18481ad6265SDimitry Andric    constexpr ranges::binary_transform_result<I1, I2, O>
18581ad6265SDimitry Andric      transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
18681ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
18781ad6265SDimitry Andric
18881ad6265SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
18981ad6265SDimitry Andric           copy_constructible F, class Proj1 = identity, class Proj2 = identity>
19081ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
19181ad6265SDimitry Andric                                           projected<iterator_t<R2>, Proj2>>>
19281ad6265SDimitry Andric    constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
19381ad6265SDimitry Andric      transform(R1&& r1, R2&& r2, O result,
19481ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
19581ad6265SDimitry Andric
19681ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
19781ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
19881ad6265SDimitry Andric    constexpr iter_difference_t<I>
19981ad6265SDimitry Andric      count(I first, S last, const T& value, Proj proj = {});                                             // since C++20
20081ad6265SDimitry Andric
20181ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity>
20281ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
20381ad6265SDimitry Andric    constexpr range_difference_t<R>
20481ad6265SDimitry Andric      count(R&& r, const T& value, Proj proj = {});                                                       // since C++20
20581ad6265SDimitry Andric
20681ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
20781ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
20881ad6265SDimitry Andric    constexpr iter_difference_t<I>
20981ad6265SDimitry Andric      count_if(I first, S last, Pred pred, Proj proj = {});                                               // since C++20
21081ad6265SDimitry Andric
21181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
21281ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
21381ad6265SDimitry Andric    constexpr range_difference_t<R>
21481ad6265SDimitry Andric      count_if(R&& r, Pred pred, Proj proj = {});                                                         // since C++20
21581ad6265SDimitry Andric
21681ad6265SDimitry Andric  template<class T>
21781ad6265SDimitry Andric  using minmax_result = min_max_result<T>;
21881ad6265SDimitry Andric
21981ad6265SDimitry Andric  template<class T, class Proj = identity,
22081ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
22181ad6265SDimitry Andric    constexpr ranges::minmax_result<const T&>
22281ad6265SDimitry Andric      minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});                                     // since C++20
22381ad6265SDimitry Andric
22481ad6265SDimitry Andric  template<copyable T, class Proj = identity,
22581ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
22681ad6265SDimitry Andric    constexpr ranges::minmax_result<T>
22781ad6265SDimitry Andric      minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {});                                      // since C++20
22881ad6265SDimitry Andric
22981ad6265SDimitry Andric  template<input_range R, class Proj = identity,
23081ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
23181ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
23281ad6265SDimitry Andric    constexpr ranges::minmax_result<range_value_t<R>>
23381ad6265SDimitry Andric      minmax(R&& r, Comp comp = {}, Proj proj = {});                                                      // since C++20
23481ad6265SDimitry Andric
23581ad6265SDimitry Andric  template<class I>
23681ad6265SDimitry Andric  using minmax_element_result = min_max_result<I>;
23781ad6265SDimitry Andric
23881ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
23981ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
24081ad6265SDimitry Andric    constexpr ranges::minmax_element_result<I>
24181ad6265SDimitry Andric      minmax_element(I first, S last, Comp comp = {}, Proj proj = {});                                    // since C++20
24281ad6265SDimitry Andric
24381ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
24481ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
24581ad6265SDimitry Andric    constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
24681ad6265SDimitry Andric      minmax_element(R&& r, Comp comp = {}, Proj proj = {});                                              // since C++20
24781ad6265SDimitry Andric
2480fca6ea1SDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1,
2490fca6ea1SDimitry Andric           forward_iterator I2, sentinel_for<I2> S2,
2500fca6ea1SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
2510fca6ea1SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
2520fca6ea1SDimitry Andric    constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
2530fca6ea1SDimitry Andric                                     Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
2540fca6ea1SDimitry Andric
2550fca6ea1SDimitry Andric  template<forward_range R1, forward_range R2,
2560fca6ea1SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
2570fca6ea1SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
2580fca6ea1SDimitry Andric    constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
2590fca6ea1SDimitry Andric                                     Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++23
2600fca6ea1SDimitry Andric
26181ad6265SDimitry Andric  template<class I, class O>
26281ad6265SDimitry Andric    using copy_result = in_out_result<I, O>;                                                // since C++20
26381ad6265SDimitry Andric
26481ad6265SDimitry Andric  template<class I, class O>
26581ad6265SDimitry Andric    using copy_n_result = in_out_result<I, O>;                                              // since C++20
26681ad6265SDimitry Andric
26781ad6265SDimitry Andric  template<class I, class O>
26881ad6265SDimitry Andric    using copy_if_result = in_out_result<I, O>;                                             // since C++20
26981ad6265SDimitry Andric
27081ad6265SDimitry Andric  template<class I1, class I2>
27181ad6265SDimitry Andric    using copy_backward_result = in_out_result<I1, I2>;                                     // since C++20
27281ad6265SDimitry Andric
273cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
274cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
275cb14a3feSDimitry Andric    constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});       // since C++23
276cb14a3feSDimitry Andric
277cb14a3feSDimitry Andric  template<input_range R, class T, class Proj = identity>
278cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
279cb14a3feSDimitry Andric    constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});                 // since C++23
280cb14a3feSDimitry Andric
28181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
28281ad6265SDimitry Andric    requires indirectly_copyable<I, O>
28381ad6265SDimitry Andric    constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);            // since C++20
28481ad6265SDimitry Andric
28581ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
28681ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
28781ad6265SDimitry Andric    constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
28881ad6265SDimitry Andric
28981ad6265SDimitry Andric  template<input_iterator I, weakly_incrementable O>
29081ad6265SDimitry Andric    requires indirectly_copyable<I, O>
29181ad6265SDimitry Andric    constexpr ranges::copy_n_result<I, O>
29281ad6265SDimitry Andric      ranges::copy_n(I first, iter_difference_t<I> n, O result);                            // since C++20
29381ad6265SDimitry Andric
29481ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
29581ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
29681ad6265SDimitry Andric    requires indirectly_copyable<I, O>
29781ad6265SDimitry Andric    constexpr ranges::copy_if_result<I, O>
29881ad6265SDimitry Andric      ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {});                // since C++20
29981ad6265SDimitry Andric
30081ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
30181ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
30281ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
30381ad6265SDimitry Andric    constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
30481ad6265SDimitry Andric      ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});                          // since C++20
30581ad6265SDimitry Andric
30681ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
30781ad6265SDimitry Andric    requires indirectly_copyable<I1, I2>
30881ad6265SDimitry Andric    constexpr ranges::copy_backward_result<I1, I2>
30981ad6265SDimitry Andric      ranges::copy_backward(I1 first, S1 last, I2 result);                                  // since C++20
31081ad6265SDimitry Andric
31181ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
31281ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, I>
31381ad6265SDimitry Andric    constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
31481ad6265SDimitry Andric      ranges::copy_backward(R&& r, I result);                                               // since C++20
31581ad6265SDimitry Andric
31681ad6265SDimitry Andric  template<class I, class F>
31781ad6265SDimitry Andric    using for_each_result = in_fun_result<I, F>;                                            // since C++20
31881ad6265SDimitry Andric
319*700637cbSDimitry Andric  template<class I, class F>
320*700637cbSDimitry Andric    using for_each_n_result = in_fun_result<I, F>;                                          // since C++20
321*700637cbSDimitry Andric
32281ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
32381ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
32481ad6265SDimitry Andric    constexpr ranges::for_each_result<I, Fun>
32581ad6265SDimitry Andric      ranges::for_each(I first, S last, Fun f, Proj proj = {});                             // since C++20
32681ad6265SDimitry Andric
32781ad6265SDimitry Andric  template<input_range R, class Proj = identity,
32881ad6265SDimitry Andric           indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
32981ad6265SDimitry Andric    constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
33081ad6265SDimitry Andric      ranges::for_each(R&& r, Fun f, Proj proj = {});                                       // since C++20
33181ad6265SDimitry Andric
33281ad6265SDimitry Andric  template<input_iterator I, class Proj = identity,
33381ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
33481ad6265SDimitry Andric    constexpr ranges::for_each_n_result<I, Fun>
33581ad6265SDimitry Andric      ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});           // since C++20
33681ad6265SDimitry Andric
33781ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
33881ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
33981ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});      // since C++20
34081ad6265SDimitry Andric
34181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
34281ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
34381ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});                // since C++20
34481ad6265SDimitry Andric
345753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
346753f127fSDimitry Andric          class Proj = identity>
347753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
348753f127fSDimitry Andric    constexpr I
349753f127fSDimitry Andric      ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
350753f127fSDimitry Andric
351753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
352753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
353753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
354753f127fSDimitry Andric      ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
355753f127fSDimitry Andric
356753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
357753f127fSDimitry Andric          class Proj = identity>
358753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
359753f127fSDimitry Andric    constexpr I
360753f127fSDimitry Andric      ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {});                    // since C++20
361753f127fSDimitry Andric
362753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
363753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
364753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
365753f127fSDimitry Andric      ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {});                              // since C++20
366753f127fSDimitry Andric
367753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
368753f127fSDimitry Andric          class Proj = identity>
369753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
370753f127fSDimitry Andric    constexpr I
371753f127fSDimitry Andric      ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
372753f127fSDimitry Andric
373753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
374753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
375753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
376753f127fSDimitry Andric      ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
377753f127fSDimitry Andric
378753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
379753f127fSDimitry Andric          class Proj = identity>
380753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
381753f127fSDimitry Andric    constexpr I
382753f127fSDimitry Andric      ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
383753f127fSDimitry Andric
384753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
385753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
386753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
387753f127fSDimitry Andric      ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
388753f127fSDimitry Andric
389972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
390972a253aSDimitry Andric            indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
39106c3fb27SDimitry Andric    constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});                // since C++20
392972a253aSDimitry Andric
393972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
394972a253aSDimitry Andric            indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
39506c3fb27SDimitry Andric    constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});                          // since C++20
396972a253aSDimitry Andric
397972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
398972a253aSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
39906c3fb27SDimitry Andric    constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});             // since C++20
400972a253aSDimitry Andric
401972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
402972a253aSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
403972a253aSDimitry Andric    constexpr borrowed_iterator_t<R>
40406c3fb27SDimitry Andric      is_heap_until(R&& r, Comp comp = {}, Proj proj = {});                                 // since C++20
405972a253aSDimitry Andric
40681ad6265SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S>
40781ad6265SDimitry Andric    requires permutable<I>
40881ad6265SDimitry Andric    constexpr I ranges::reverse(I first, S last);                                           // since C++20
40981ad6265SDimitry Andric
41081ad6265SDimitry Andric  template<bidirectional_range R>
41181ad6265SDimitry Andric    requires permutable<iterator_t<R>>
41281ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);                                // since C++20
41381ad6265SDimitry Andric
41481ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
41581ad6265SDimitry Andric            class Proj = identity>
41681ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
41781ad6265SDimitry Andric    constexpr I
41881ad6265SDimitry Andric      ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});                        // since C++20
41981ad6265SDimitry Andric
42081ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
42181ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
42281ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
42381ad6265SDimitry Andric      ranges::sort(R&& r, Comp comp = {}, Proj proj = {});                                  // since C++20
42481ad6265SDimitry Andric
42581ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
42681ad6265SDimitry Andric          class Proj = identity>
42781ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
428*700637cbSDimitry Andric    constexpr I                                                                             // constexpr since C++26
429*700637cbSDimitry Andric      ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});                 // since C++20
43081ad6265SDimitry Andric
43181ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
43281ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
433*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>                                                        // constexpr since C++26
43481ad6265SDimitry Andric      ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});                           // since C++20
43581ad6265SDimitry Andric
436fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
437fcaf7f86SDimitry Andric           class Proj = identity>
438fcaf7f86SDimitry Andric    requires sortable<I, Comp, Proj>
439fcaf7f86SDimitry Andric    constexpr I
440fcaf7f86SDimitry Andric      ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});      // since C++20
441fcaf7f86SDimitry Andric
442fcaf7f86SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
443fcaf7f86SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
444fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
445fcaf7f86SDimitry Andric      ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});    // since C++20
446fcaf7f86SDimitry Andric
44781ad6265SDimitry Andric  template<class T, output_iterator<const T&> O, sentinel_for<O> S>
44881ad6265SDimitry Andric    constexpr O ranges::fill(O first, S last, const T& value);                              // since C++20
44981ad6265SDimitry Andric
45081ad6265SDimitry Andric  template<class T, output_range<const T&> R>
45181ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);                   // since C++20
45281ad6265SDimitry Andric
45381ad6265SDimitry Andric  template<class T, output_iterator<const T&> O>
45481ad6265SDimitry Andric    constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);            // since C++20
45581ad6265SDimitry Andric
456972a253aSDimitry Andric  template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
457972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
45806c3fb27SDimitry Andric    constexpr O generate(O first, S last, F gen);                                           // since C++20
45906c3fb27SDimitry Andric
46006c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Generator>
46106c3fb27SDimitry Andric    void generate(ExecutionPolicy&& exec,
46206c3fb27SDimitry Andric                  ForwardIterator first, ForwardIterator last,
46306c3fb27SDimitry Andric                  Generator gen);                                                           // since C++17
464972a253aSDimitry Andric
465972a253aSDimitry Andric  template<class R, copy_constructible F>
466972a253aSDimitry Andric    requires invocable<F&> && output_range<R, invoke_result_t<F&>>
46706c3fb27SDimitry Andric    constexpr borrowed_iterator_t<R> generate(R&& r, F gen);                                // since C++20
468972a253aSDimitry Andric
469972a253aSDimitry Andric  template<input_or_output_iterator O, copy_constructible F>
470972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
47106c3fb27SDimitry Andric    constexpr O generate_n(O first, iter_difference_t<O> n, F gen);                         // since C++20
47206c3fb27SDimitry Andric
47306c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
47406c3fb27SDimitry Andric    ForwardIterator generate_n(ExecutionPolicy&& exec,
47506c3fb27SDimitry Andric                               ForwardIterator first, Size n, Generator gen);               // since C++17
476972a253aSDimitry Andric
47781ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
47881ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
47981ad6265SDimitry Andric   requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
48081ad6265SDimitry Andric   constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
48181ad6265SDimitry Andric                                Pred pred = {},
48281ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
48381ad6265SDimitry Andric
48481ad6265SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to,
48581ad6265SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
48681ad6265SDimitry Andric   requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
48781ad6265SDimitry Andric   constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
48881ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
48981ad6265SDimitry Andric
49081ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
49181ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
49281ad6265SDimitry Andric    constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
49381ad6265SDimitry Andric
49481ad6265SDimitry Andric  template<input_range R, class Proj = identity,
49581ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
49681ad6265SDimitry Andric    constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
49781ad6265SDimitry Andric
49881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
49981ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
50081ad6265SDimitry Andric    constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
50181ad6265SDimitry Andric
50281ad6265SDimitry Andric  template<input_range R, class Proj = identity,
50381ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
50481ad6265SDimitry Andric    constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
50581ad6265SDimitry Andric
5065f757f3fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
5075f757f3fSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
5085f757f3fSDimitry Andric    requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
5095f757f3fSDimitry Andric           (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
5105f757f3fSDimitry Andric           indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
5115f757f3fSDimitry Andric    constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
5125f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
5135f757f3fSDimitry Andric
5145f757f3fSDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
5155f757f3fSDimitry Andric          class Proj2 = identity>
5165f757f3fSDimitry Andric    requires (forward_range<R1> || sized_range<R1>) &&
5175f757f3fSDimitry Andric           (forward_range<R2> || sized_range<R2>) &&
5185f757f3fSDimitry Andric           indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
5195f757f3fSDimitry Andric    constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
5205f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
5215f757f3fSDimitry Andric
52281ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
52381ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
52481ad6265SDimitry Andric    constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});             // since C++20
52581ad6265SDimitry Andric
52681ad6265SDimitry Andric  template<input_range R, class Proj = identity,
52781ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
52881ad6265SDimitry Andric    constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});                       // since C++20
52981ad6265SDimitry Andric
53006c3fb27SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
53106c3fb27SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
53206c3fb27SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
53306c3fb27SDimitry Andric    constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
53406c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++23
53506c3fb27SDimitry Andric
53606c3fb27SDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
53706c3fb27SDimitry Andric          class Proj2 = identity>
53806c3fb27SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
53906c3fb27SDimitry Andric    constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
54006c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
54106c3fb27SDimitry Andric
54261cfbce3SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1,
54361cfbce3SDimitry Andric          random_access_iterator I2, sentinel_for<I2> S2,
54461cfbce3SDimitry Andric          class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
54561cfbce3SDimitry Andric    requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
54661cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
54761cfbce3SDimitry Andric    constexpr partial_sort_copy_result<I1, I2>
54861cfbce3SDimitry Andric      partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
54906c3fb27SDimitry Andric                        Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++20
55061cfbce3SDimitry Andric
55161cfbce3SDimitry Andric  template<input_range R1, random_access_range R2, class Comp = ranges::less,
55261cfbce3SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
55361cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
55461cfbce3SDimitry Andric            sortable<iterator_t<R2>, Comp, Proj2> &&
55561cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
55661cfbce3SDimitry Andric                                        projected<iterator_t<R2>, Proj2>>
55761cfbce3SDimitry Andric    constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
55861cfbce3SDimitry Andric      partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
55906c3fb27SDimitry Andric                        Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++20
56061cfbce3SDimitry Andric
56181ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
56281ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
56381ad6265SDimitry Andric    constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {});      // since C++20
56481ad6265SDimitry Andric
56581ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
56681ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
56781ad6265SDimitry Andric    constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {});                // since C++20
56881ad6265SDimitry Andric
56981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57081ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
57181ad6265SDimitry Andric    constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});   // since C++20
57281ad6265SDimitry Andric
57381ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
57481ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
57581ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
57681ad6265SDimitry Andric      ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});                       // since C++20
57781ad6265SDimitry Andric
578753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
579753f127fSDimitry Andric          class Proj = identity>
580753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
581753f127fSDimitry Andric    constexpr I
582753f127fSDimitry Andric      ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});          // since C++20
583753f127fSDimitry Andric
584753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
585753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
586753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
587753f127fSDimitry Andric      ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});        // since C++20
588753f127fSDimitry Andric
58981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
59006c3fb27SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>    // since C++20
59106c3fb27SDimitry Andric    constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
59281ad6265SDimitry Andric
59381ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
59481ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
59581ad6265SDimitry Andric             ranges::less>
59681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
59781ad6265SDimitry Andric      upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
59881ad6265SDimitry Andric
59981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
60081ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
60181ad6265SDimitry Andric    constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
60281ad6265SDimitry Andric                                    Proj proj = {});                                        // since C++20
60381ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
60481ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
60581ad6265SDimitry Andric             ranges::less>
60681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
60781ad6265SDimitry Andric      lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
60881ad6265SDimitry Andric
60981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
61081ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
61181ad6265SDimitry Andric    constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
61281ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
61381ad6265SDimitry Andric
61481ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
61581ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
61681ad6265SDimitry Andric             ranges::less>
61781ad6265SDimitry Andric    constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
61881ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
619fcaf7f86SDimitry Andric
620fcaf7f86SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
621fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
622fcaf7f86SDimitry Andric    constexpr subrange<I>
62306c3fb27SDimitry Andric      partition(I first, S last, Pred pred, Proj proj = {});                                // since C++20
624fcaf7f86SDimitry Andric
625fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
626fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
627fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
628fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
62906c3fb27SDimitry Andric      partition(R&& r, Pred pred, Proj proj = {});                                          // since C++20
630fcaf7f86SDimitry Andric
631fcaf7f86SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
632fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
633fcaf7f86SDimitry Andric    requires permutable<I>
634*700637cbSDimitry Andric    constexpr subrange<I>                                                                   // constexpr since C++26
635*700637cbSDimitry Andric      stable_partition(I first, S last, Pred pred, Proj proj = {});                         // since C++20
636fcaf7f86SDimitry Andric
637fcaf7f86SDimitry Andric  template<bidirectional_range R, class Proj = identity,
638fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
639fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
640*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>                                                        // constexpr since C++26
641*700637cbSDimitry Andric      stable_partition(R&& r, Pred pred, Proj proj = {});                                   // since C++20
642fcaf7f86SDimitry Andric
64381ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
64481ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
64581ad6265SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
64681ad6265SDimitry Andric    constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
64781ad6265SDimitry Andric                                       Pred pred = {},
64881ad6265SDimitry Andric                                       Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++20
64981ad6265SDimitry Andric
65081ad6265SDimitry Andric  template<input_range R1, forward_range R2,
65181ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
65281ad6265SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
65381ad6265SDimitry Andric    constexpr borrowed_iterator_t<R1>
65481ad6265SDimitry Andric      ranges::find_first_of(R1&& r1, R2&& r2,
65581ad6265SDimitry Andric                            Pred pred = {},
65681ad6265SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                            // since C++20
65781ad6265SDimitry Andric
65881ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
65981ad6265SDimitry Andric           indirect_binary_predicate<projected<I, Proj>,
66081ad6265SDimitry Andric                                     projected<I, Proj>> Pred = ranges::equal_to>
66106c3fb27SDimitry Andric    constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});     // since C++20
66281ad6265SDimitry Andric
66381ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
66481ad6265SDimitry Andric           indirect_binary_predicate<projected<iterator_t<R>, Proj>,
66581ad6265SDimitry Andric                                     projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
66681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});  // since C++20
66781ad6265SDimitry Andric
66881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
66981ad6265SDimitry Andric    requires indirectly_writable<I, const T2&> &&
67081ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
67181ad6265SDimitry Andric    constexpr I
67281ad6265SDimitry Andric      ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});   // since C++20
67381ad6265SDimitry Andric
67481ad6265SDimitry Andric  template<input_range R, class T1, class T2, class Proj = identity>
67581ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T2&> &&
67681ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
67781ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
67881ad6265SDimitry Andric      ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});             // since C++20
67981ad6265SDimitry Andric
68081ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
68181ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
68281ad6265SDimitry Andric    requires indirectly_writable<I, const T&>
68381ad6265SDimitry Andric    constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
68481ad6265SDimitry Andric
68581ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity,
68681ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
68781ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T&>
68881ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
68981ad6265SDimitry Andric      ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});                     // since C++20
69081ad6265SDimitry Andric
69161cfbce3SDimitry Andric  template<class T, class Proj = identity,
69261cfbce3SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
69361cfbce3SDimitry Andric    constexpr const T&
69461cfbce3SDimitry Andric      ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {});          // since C++20
69561cfbce3SDimitry Andric
69681ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
69781ad6265SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
69881ad6265SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>,
69981ad6265SDimitry Andric                                      projected<I2, Proj2>> Comp = ranges::less>
70081ad6265SDimitry Andric    constexpr bool
70181ad6265SDimitry Andric      ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
70281ad6265SDimitry Andric                                      Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});          // since C++20
70381ad6265SDimitry Andric
70481ad6265SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
70581ad6265SDimitry Andric           class Proj2 = identity,
70681ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
70781ad6265SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
70881ad6265SDimitry Andric    constexpr bool
70981ad6265SDimitry Andric      ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
71081ad6265SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                          // since C++20
71181ad6265SDimitry Andric
712*700637cbSDimitry Andric  template<class I, class O>
713*700637cbSDimitry Andric    using move_result = in_out_result<I, O>;                                                        // since C++20
714*700637cbSDimitry Andric
715*700637cbSDimitry Andric  template<class I, class O>
716*700637cbSDimitry Andric    using move_backward_result = in_out_result<I, O>;                                               // since C++20
717*700637cbSDimitry Andric
71881ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
71981ad6265SDimitry Andric    requires indirectly_movable<I1, I2>
72081ad6265SDimitry Andric    constexpr ranges::move_backward_result<I1, I2>
72181ad6265SDimitry Andric      ranges::move_backward(I1 first, S1 last, I2 result);                                          // since C++20
72281ad6265SDimitry Andric
72381ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
72481ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, I>
72581ad6265SDimitry Andric    constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
72681ad6265SDimitry Andric      ranges::move_backward(R&& r, I result);                                                       // since C++20
72781ad6265SDimitry Andric
72881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
72981ad6265SDimitry Andric    requires indirectly_movable<I, O>
73081ad6265SDimitry Andric    constexpr ranges::move_result<I, O>
73181ad6265SDimitry Andric      ranges::move(I first, S last, O result);                                                      // since C++20
73281ad6265SDimitry Andric
73381ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
73481ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, O>
73581ad6265SDimitry Andric    constexpr ranges::move_result<borrowed_iterator_t<R>, O>
73681ad6265SDimitry Andric      ranges::move(R&& r, O result);                                                                // since C++20
73781ad6265SDimitry Andric
738fcaf7f86SDimitry Andric  template<class I, class O1, class O2>
739fcaf7f86SDimitry Andric      using partition_copy_result = in_out_out_result<I, O1, O2>;                                   // since C++20
740fcaf7f86SDimitry Andric
741fcaf7f86SDimitry Andric  template<input_iterator I, sentinel_for<I> S,
742fcaf7f86SDimitry Andric          weakly_incrementable O1, weakly_incrementable O2,
743fcaf7f86SDimitry Andric          class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
744fcaf7f86SDimitry Andric    requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
745fcaf7f86SDimitry Andric    constexpr partition_copy_result<I, O1, O2>
746fcaf7f86SDimitry Andric      partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
74706c3fb27SDimitry Andric                    Proj proj = {});                                                                // since C++20
748fcaf7f86SDimitry Andric
749fcaf7f86SDimitry Andric  template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
750fcaf7f86SDimitry Andric          class Proj = identity,
751fcaf7f86SDimitry Andric          indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
752fcaf7f86SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O1> &&
753fcaf7f86SDimitry Andric            indirectly_copyable<iterator_t<R>, O2>
754fcaf7f86SDimitry Andric    constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
75506c3fb27SDimitry Andric      partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});                  // since C++20
756fcaf7f86SDimitry Andric
757fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
758fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
75906c3fb27SDimitry Andric    constexpr I partition_point(I first, S last, Pred pred, Proj proj = {});                        // since C++20
760fcaf7f86SDimitry Andric
761fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
762fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
763fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
76406c3fb27SDimitry Andric      partition_point(R&& r, Pred pred, Proj proj = {});                                            // since C++20
765fcaf7f86SDimitry Andric
766753f127fSDimitry Andric  template<class I1, class I2, class O>
767753f127fSDimitry Andric    using merge_result = in_in_out_result<I1, I2, O>;                                               // since C++20
768753f127fSDimitry Andric
769753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
770753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
771753f127fSDimitry Andric           class Proj2 = identity>
772753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
773753f127fSDimitry Andric    constexpr merge_result<I1, I2, O>
774753f127fSDimitry Andric      merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
775753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
776753f127fSDimitry Andric
777753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
778753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
779753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
780753f127fSDimitry Andric    constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
781753f127fSDimitry Andric      merge(R1&& r1, R2&& r2, O result,
782753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
783753f127fSDimitry Andric
784753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
785753f127fSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
786753f127fSDimitry Andric    constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});          // since C++20
787753f127fSDimitry Andric
788753f127fSDimitry Andric  template<forward_range R, class T, class Proj = identity>
789753f127fSDimitry Andric    requires permutable<iterator_t<R>> &&
790753f127fSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
791753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
792753f127fSDimitry Andric      ranges::remove(R&& r, const T& value, Proj proj = {});                                        // since C++20
793753f127fSDimitry Andric
794753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
795753f127fSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
796753f127fSDimitry Andric    constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});            // since C++20
797753f127fSDimitry Andric
798753f127fSDimitry Andric  template<forward_range R, class Proj = identity,
799753f127fSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
800753f127fSDimitry Andric    requires permutable<iterator_t<R>>
801753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
802753f127fSDimitry Andric      ranges::remove_if(R&& r, Pred pred, Proj proj = {});                                          // since C++20
803753f127fSDimitry Andric
804753f127fSDimitry Andric  template<class I, class O>
805753f127fSDimitry Andric    using set_difference_result = in_out_result<I, O>;                                              // since C++20
806753f127fSDimitry Andric
807753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
808753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
809753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
810753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
811753f127fSDimitry Andric    constexpr set_difference_result<I1, O>
812753f127fSDimitry Andric      set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
813753f127fSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
814753f127fSDimitry Andric
815753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
816753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
817753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
818753f127fSDimitry Andric    constexpr set_difference_result<borrowed_iterator_t<R1>, O>
819753f127fSDimitry Andric      set_difference(R1&& r1, R2&& r2, O result,
820753f127fSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
821753f127fSDimitry Andric
822753f127fSDimitry Andric  template<class I1, class I2, class O>
823753f127fSDimitry Andric    using set_intersection_result = in_in_out_result<I1, I2, O>;                                    // since C++20
824753f127fSDimitry Andric
825753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
826753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
827753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
828753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
829753f127fSDimitry Andric    constexpr set_intersection_result<I1, I2, O>
830753f127fSDimitry Andric      set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
831753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
832753f127fSDimitry Andric
833753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
834753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
835753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
836753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
837753f127fSDimitry Andric    constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
838753f127fSDimitry Andric      set_intersection(R1&& r1, R2&& r2, O result,
839753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
840753f127fSDimitry Andric
841753f127fSDimitry Andric  template <class _InIter, class _OutIter>
842753f127fSDimitry Andric  using reverse_copy_result = in_out_result<_InIter, _OutIter>;                                     // since C++20
843753f127fSDimitry Andric
844753f127fSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
845753f127fSDimitry Andric    requires indirectly_copyable<I, O>
846753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<I, O>
847753f127fSDimitry Andric      ranges::reverse_copy(I first, S last, O result);                                              // since C++20
848753f127fSDimitry Andric
849753f127fSDimitry Andric  template<bidirectional_range R, weakly_incrementable O>
850753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
851753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
852753f127fSDimitry Andric      ranges::reverse_copy(R&& r, O result);                                                        // since C++20
853753f127fSDimitry Andric
85461cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S>
85561cfbce3SDimitry Andric    constexpr subrange<I> rotate(I first, I middle, S last);                                        // since C++20
85661cfbce3SDimitry Andric
85761cfbce3SDimitry Andric  template<forward_range R>
85861cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
85906c3fb27SDimitry Andric    constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);                           // since C++20
86061cfbce3SDimitry Andric
861753f127fSDimitry Andric  template <class _InIter, class _OutIter>
862753f127fSDimitry Andric  using rotate_copy_result = in_out_result<_InIter, _OutIter>;                                      // since C++20
863753f127fSDimitry Andric
864753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
865753f127fSDimitry Andric    requires indirectly_copyable<I, O>
866753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<I, O>
867753f127fSDimitry Andric      ranges::rotate_copy(I first, I middle, S last, O result);                                     // since C++20
868753f127fSDimitry Andric
869753f127fSDimitry Andric  template<forward_range R, weakly_incrementable O>
870753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
871753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
872753f127fSDimitry Andric      ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);                                   // since C++20
873753f127fSDimitry Andric
87461cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
87561cfbce3SDimitry Andric    requires (forward_iterator<I> || random_access_iterator<O>) &&
87661cfbce3SDimitry Andric            indirectly_copyable<I, O> &&
87761cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
87806c3fb27SDimitry Andric    O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g);                              // since C++20
87961cfbce3SDimitry Andric
88061cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Gen>
88161cfbce3SDimitry Andric    requires (forward_range<R> || random_access_iterator<O>) &&
88261cfbce3SDimitry Andric            indirectly_copyable<iterator_t<R>, O> &&
88361cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
88406c3fb27SDimitry Andric    O sample(R&& r, O out, range_difference_t<R> n, Gen&& g);                                       // since C++20
88561cfbce3SDimitry Andric
886fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Gen>
887fcaf7f86SDimitry Andric    requires permutable<I> &&
888fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
88906c3fb27SDimitry Andric    I shuffle(I first, S last, Gen&& g);                                                            // since C++20
890fcaf7f86SDimitry Andric
891fcaf7f86SDimitry Andric  template<random_access_range R, class Gen>
892fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>> &&
893fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
89406c3fb27SDimitry Andric    borrowed_iterator_t<R> shuffle(R&& r, Gen&& g);                                                 // since C++20
895fcaf7f86SDimitry Andric
896753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
89761cfbce3SDimitry Andric         sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
89861cfbce3SDimitry Andric         indirect_equivalence_relation<projected<I1, Proj1>,
89961cfbce3SDimitry Andric                                       projected<I2, Proj2>> Pred = ranges::equal_to>
90061cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
90161cfbce3SDimitry Andric                                        Pred pred = {},
90206c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
90361cfbce3SDimitry Andric
90461cfbce3SDimitry Andric  template<forward_range R1, forward_range R2,
90561cfbce3SDimitry Andric         class Proj1 = identity, class Proj2 = identity,
90661cfbce3SDimitry Andric         indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
90761cfbce3SDimitry Andric                                       projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
90861cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
90906c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
91061cfbce3SDimitry Andric
91161cfbce3SDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
912753f127fSDimitry Andric           sentinel_for<I2> S2, class Pred = ranges::equal_to,
913753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
914753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
915753f127fSDimitry Andric    constexpr subrange<I1>
916753f127fSDimitry Andric      ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
917753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
918753f127fSDimitry Andric
919753f127fSDimitry Andric  template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
920753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
921753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
922753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
923753f127fSDimitry Andric      ranges::search(R1&& r1, R2&& r2, Pred pred = {},
924753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
925753f127fSDimitry Andric
926753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T,
927753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj = identity>
928753f127fSDimitry Andric    requires indirectly_comparable<I, const T*, Pred, Proj>
929753f127fSDimitry Andric    constexpr subrange<I>
930753f127fSDimitry Andric      ranges::search_n(I first, S last, iter_difference_t<I> count,
931753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
932753f127fSDimitry Andric
933753f127fSDimitry Andric  template<forward_range R, class T, class Pred = ranges::equal_to,
934753f127fSDimitry Andric           class Proj = identity>
935753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
936753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
937753f127fSDimitry Andric      ranges::search_n(R&& r, range_difference_t<R> count,
938753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
939753f127fSDimitry Andric
940cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
941cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
942cb14a3feSDimitry Andric    constexpr auto ranges::fold_left(I first, S last, T init, F f);                                 // since C++23
943cb14a3feSDimitry Andric
944cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
945cb14a3feSDimitry Andric    constexpr auto fold_left(R&& r, T init, F f);                                                   // since C++23
946cb14a3feSDimitry Andric
947cb14a3feSDimitry Andric  template<class I, class T>
948cb14a3feSDimitry Andric    using fold_left_with_iter_result = in_value_result<I, T>;                                       // since C++23
949cb14a3feSDimitry Andric
950cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
951cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
952cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(I first, S last, T init, F f);                          // since C++23
953cb14a3feSDimitry Andric
954cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
955cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(R&& r, T init, F f);                                    // since C++23
956cb14a3feSDimitry Andric
957753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
958753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
959753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
960753f127fSDimitry Andric    constexpr subrange<I1>
961753f127fSDimitry Andric      ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
962753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
963753f127fSDimitry Andric
964753f127fSDimitry Andric  template<forward_range R1, forward_range R2,
965753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
966753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
967753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
968753f127fSDimitry Andric      ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
969753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
970753f127fSDimitry Andric
971753f127fSDimitry Andric  template<class I1, class I2, class O>
972753f127fSDimitry Andric    using set_symmetric_difference_result = in_in_out_result<I1, I2, O>;                            // since C++20
973753f127fSDimitry Andric
974753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
975753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
976753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
977753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
978753f127fSDimitry Andric    constexpr set_symmetric_difference_result<I1, I2, O>
979753f127fSDimitry Andric      set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
980753f127fSDimitry Andric                               Comp comp = {}, Proj1 proj1 = {},
981753f127fSDimitry Andric                               Proj2 proj2 = {});                                                   // since C++20
982753f127fSDimitry Andric
983753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
984753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
985753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
986753f127fSDimitry Andric    constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
987753f127fSDimitry Andric                                                      borrowed_iterator_t<R2>, O>
988753f127fSDimitry Andric      set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
989753f127fSDimitry Andric                               Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
99081ad6265SDimitry Andric
991fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
992fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
993fcaf7f86SDimitry Andric    constexpr subrange<I>
994fcaf7f86SDimitry Andric      equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});                 // since C++20
995fcaf7f86SDimitry Andric
996fcaf7f86SDimitry Andric  template<forward_range R, class T, class Proj = identity,
997fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
998fcaf7f86SDimitry Andric             ranges::less>
999fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
1000fcaf7f86SDimitry Andric      equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});                           // since C++20
1001fcaf7f86SDimitry Andric
1002fcaf7f86SDimitry Andric  template<class I1, class I2, class O>
1003fcaf7f86SDimitry Andric    using set_union_result = in_in_out_result<I1, I2, O>;                                           // since C++20
1004fcaf7f86SDimitry Andric
1005fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006fcaf7f86SDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
1007fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity>
1008fcaf7f86SDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
1009fcaf7f86SDimitry Andric    constexpr set_union_result<I1, I2, O>
1010fcaf7f86SDimitry Andric      set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
1011fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
1012fcaf7f86SDimitry Andric
1013fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
1014fcaf7f86SDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1015fcaf7f86SDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1016fcaf7f86SDimitry Andric    constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1017fcaf7f86SDimitry Andric      set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1018fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
1019fcaf7f86SDimitry Andric
1020fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1021fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
1022fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1023fcaf7f86SDimitry Andric             ranges::less>
1024fcaf7f86SDimitry Andric    constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
102506c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
1026fcaf7f86SDimitry Andric
1027fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
1028fcaf7f86SDimitry Andric           class Proj2 = identity,
1029fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1030fcaf7f86SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1031fcaf7f86SDimitry Andric    constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
103206c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
103361cfbce3SDimitry Andric
103461cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
103561cfbce3SDimitry Andric           class Proj = identity>
103661cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
1037*700637cbSDimitry Andric    constexpr I                                                                            // constexpr since C++26
1038*700637cbSDimitry Andric      inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});            // since C++20
103961cfbce3SDimitry Andric
104061cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
104161cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
1042*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>                                                       // constexpr since C++26
104361cfbce3SDimitry Andric      inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
104406c3fb27SDimitry Andric                    Proj proj = {});                                                       // since C++20
104561cfbce3SDimitry Andric
104661cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
104761cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
104806c3fb27SDimitry Andric    constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {});                    // since C++20
104961cfbce3SDimitry Andric
105061cfbce3SDimitry Andric  template<forward_range R, class Proj = identity,
105161cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
105261cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
105361cfbce3SDimitry Andric    constexpr borrowed_subrange_t<R>
105406c3fb27SDimitry Andric      unique(R&& r, C comp = {}, Proj proj = {});                                                  // since C++20
105561cfbce3SDimitry Andric
105661cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
105761cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
105861cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
105961cfbce3SDimitry Andric             (forward_iterator<I> ||
106061cfbce3SDimitry Andric              (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
106161cfbce3SDimitry Andric              indirectly_copyable_storable<I, O>)
106261cfbce3SDimitry Andric    constexpr unique_copy_result<I, O>
106306c3fb27SDimitry Andric      unique_copy(I first, S last, O result, C comp = {}, Proj proj = {});                         // since C++20
106461cfbce3SDimitry Andric
106561cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
106661cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
106761cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
106861cfbce3SDimitry Andric             (forward_iterator<iterator_t<R>> ||
106961cfbce3SDimitry Andric              (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
107061cfbce3SDimitry Andric              indirectly_copyable_storable<iterator_t<R>, O>)
107161cfbce3SDimitry Andric    constexpr unique_copy_result<borrowed_iterator_t<R>, O>
107206c3fb27SDimitry Andric      unique_copy(R&& r, O result, C comp = {}, Proj proj = {});                                   // since C++20
107361cfbce3SDimitry Andric
107461cfbce3SDimitry Andric  template<class I, class O>
107506c3fb27SDimitry Andric      using remove_copy_result = in_out_result<I, O>;                                              // since C++20
107661cfbce3SDimitry Andric
107761cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
107861cfbce3SDimitry Andric           class Proj = identity>
107961cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
108061cfbce3SDimitry Andric    constexpr remove_copy_result<I, O>
108106c3fb27SDimitry Andric      remove_copy(I first, S last, O result, const T& value, Proj proj = {});                      // since C++20
108261cfbce3SDimitry Andric
108361cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class T, class Proj = identity>
108461cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
108561cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
108661cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T*>
108761cfbce3SDimitry Andric    constexpr remove_copy_result<borrowed_iterator_t<R>, O>
108806c3fb27SDimitry Andric      remove_copy(R&& r, O result, const T& value, Proj proj = {});                                // since C++20
108961cfbce3SDimitry Andric
109061cfbce3SDimitry Andric  template<class I, class O>
109106c3fb27SDimitry Andric      using remove_copy_if_result = in_out_result<I, O>;                                           // since C++20
109261cfbce3SDimitry Andric
109361cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
109461cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
109561cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
109661cfbce3SDimitry Andric    constexpr remove_copy_if_result<I, O>
109706c3fb27SDimitry Andric      remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});                        // since C++20
109861cfbce3SDimitry Andric
109961cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
110061cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
110161cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
110261cfbce3SDimitry Andric    constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
110306c3fb27SDimitry Andric      remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});                                  // since C++20
110461cfbce3SDimitry Andric
110561cfbce3SDimitry Andric  template<class I, class O>
110606c3fb27SDimitry Andric      using replace_copy_result = in_out_result<I, O>;                                             // since C++20
110761cfbce3SDimitry Andric
110861cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2,
110961cfbce3SDimitry Andric           output_iterator<const T2&> O, class Proj = identity>
111061cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
111161cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
111261cfbce3SDimitry Andric    constexpr replace_copy_result<I, O>
111361cfbce3SDimitry Andric      replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
111406c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
111561cfbce3SDimitry Andric
111661cfbce3SDimitry Andric  template<input_range R, class T1, class T2, output_iterator<const T2&> O,
111761cfbce3SDimitry Andric           class Proj = identity>
111861cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
111961cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
112061cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T1*>
112161cfbce3SDimitry Andric    constexpr replace_copy_result<borrowed_iterator_t<R>, O>
112261cfbce3SDimitry Andric      replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
112306c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
112461cfbce3SDimitry Andric
112561cfbce3SDimitry Andric  template<class I, class O>
112606c3fb27SDimitry Andric      using replace_copy_if_result = in_out_result<I, O>;                                          // since C++20
112761cfbce3SDimitry Andric
112861cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
112961cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
113061cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
113161cfbce3SDimitry Andric    constexpr replace_copy_if_result<I, O>
113261cfbce3SDimitry Andric      replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
113306c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
113461cfbce3SDimitry Andric
113561cfbce3SDimitry Andric  template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
113661cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
113761cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
113861cfbce3SDimitry Andric    constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
113961cfbce3SDimitry Andric      replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
114006c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
114161cfbce3SDimitry Andric
114261cfbce3SDimitry Andric  template<class I>
114306c3fb27SDimitry Andric    using prev_permutation_result = in_found_result<I>;                                            // since C++20
114461cfbce3SDimitry Andric
114561cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
114661cfbce3SDimitry Andric           class Proj = identity>
114761cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
114861cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<I>
114906c3fb27SDimitry Andric      ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
115061cfbce3SDimitry Andric
115161cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
115261cfbce3SDimitry Andric           class Proj = identity>
115361cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
115461cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
115506c3fb27SDimitry Andric      ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
115661cfbce3SDimitry Andric
115761cfbce3SDimitry Andric  template<class I>
115806c3fb27SDimitry Andric    using next_permutation_result = in_found_result<I>;                                            // since C++20
115961cfbce3SDimitry Andric
116061cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
116161cfbce3SDimitry Andric           class Proj = identity>
116261cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
116361cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<I>
116406c3fb27SDimitry Andric      ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
116561cfbce3SDimitry Andric
116661cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
116761cfbce3SDimitry Andric           class Proj = identity>
116861cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
116961cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
117006c3fb27SDimitry Andric      ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
117161cfbce3SDimitry Andric
117204eeddc0SDimitry Andric}
117304eeddc0SDimitry Andric
117461cfbce3SDimitry Andrictemplate <class InputIterator, class Predicate>
1175*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
11760b57cec5SDimitry Andric    all_of(InputIterator first, InputIterator last, Predicate pred);
11770b57cec5SDimitry Andric
11780b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
1179*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
11800b57cec5SDimitry Andric    any_of(InputIterator first, InputIterator last, Predicate pred);
11810b57cec5SDimitry Andric
11820b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
1183*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
11840b57cec5SDimitry Andric    none_of(InputIterator first, InputIterator last, Predicate pred);
11850b57cec5SDimitry Andric
11860b57cec5SDimitry Andrictemplate <class InputIterator, class Function>
1187*700637cbSDimitry Andric    constexpr Function          // constexpr since C++20
11880b57cec5SDimitry Andric    for_each(InputIterator first, InputIterator last, Function f);
11890b57cec5SDimitry Andric
11900b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class Function>
1191*700637cbSDimitry Andric    constexpr InputIterator     // constexpr since C++20
11920b57cec5SDimitry Andric    for_each_n(InputIterator first, Size n, Function f); // C++17
11930b57cec5SDimitry Andric
11940b57cec5SDimitry Andrictemplate <class InputIterator, class T>
1195*700637cbSDimitry Andric    constexpr InputIterator     // constexpr since C++20
11960b57cec5SDimitry Andric    find(InputIterator first, InputIterator last, const T& value);
11970b57cec5SDimitry Andric
11980b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
1199*700637cbSDimitry Andric    constexpr InputIterator     // constexpr since C++20
12000b57cec5SDimitry Andric    find_if(InputIterator first, InputIterator last, Predicate pred);
12010b57cec5SDimitry Andric
12020b57cec5SDimitry Andrictemplate<class InputIterator, class Predicate>
1203*700637cbSDimitry Andric    constexpr InputIterator     // constexpr since C++20
12040b57cec5SDimitry Andric    find_if_not(InputIterator first, InputIterator last, Predicate pred);
12050b57cec5SDimitry Andric
12060b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1207*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr since C++20
12080b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
12090b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2);
12100b57cec5SDimitry Andric
12110b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1212*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr since C++20
12130b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
12140b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
12150b57cec5SDimitry Andric
12160b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1217*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr since C++20
12180b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
12190b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2);
12200b57cec5SDimitry Andric
12210b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1222*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr since C++20
12230b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
12240b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
12250b57cec5SDimitry Andric
12260b57cec5SDimitry Andrictemplate <class ForwardIterator>
1227*700637cbSDimitry Andric    constexpr ForwardIterator   // constexpr since C++20
12280b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last);
12290b57cec5SDimitry Andric
12300b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1231*700637cbSDimitry Andric    constexpr ForwardIterator   // constexpr since C++20
12320b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
12330b57cec5SDimitry Andric
12340b57cec5SDimitry Andrictemplate <class InputIterator, class T>
1235*700637cbSDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type  // constexpr since C++20
12360b57cec5SDimitry Andric    count(InputIterator first, InputIterator last, const T& value);
12370b57cec5SDimitry Andric
12380b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
1239*700637cbSDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++20
12400b57cec5SDimitry Andric    count_if(InputIterator first, InputIterator last, Predicate pred);
12410b57cec5SDimitry Andric
12420b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1243*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr since C++20
12440b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
12450b57cec5SDimitry Andric
12460b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1247*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>
12480b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
1249*700637cbSDimitry Andric             InputIterator2 first2, InputIterator2 last2);              // since C++14, constexpr since C++20
12500b57cec5SDimitry Andric
12510b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1252*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr since C++20
12530b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12540b57cec5SDimitry Andric             InputIterator2 first2, BinaryPredicate pred);
12550b57cec5SDimitry Andric
12560b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1257*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>
12580b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12590b57cec5SDimitry Andric             InputIterator2 first2, InputIterator2 last2,
1260*700637cbSDimitry Andric             BinaryPredicate pred);                                     // since C++14, constexpr since C++20
12610b57cec5SDimitry Andric
12620b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1263*700637cbSDimitry Andric    constexpr bool      // constexpr since C++20
12640b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
12650b57cec5SDimitry Andric
12660b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1267*700637cbSDimitry Andric    constexpr bool
12680b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
1269*700637cbSDimitry Andric          InputIterator2 first2, InputIterator2 last2);                 // since C++14, constexpr since C++20
12700b57cec5SDimitry Andric
12710b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1272*700637cbSDimitry Andric    constexpr bool      // constexpr since C++20
12730b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12740b57cec5SDimitry Andric          InputIterator2 first2, BinaryPredicate pred);
12750b57cec5SDimitry Andric
12760b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1277*700637cbSDimitry Andric    constexpr bool
12780b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12790b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2,
1280*700637cbSDimitry Andric          BinaryPredicate pred);                                        // since C++14, constexpr since C++20
12810b57cec5SDimitry Andric
12820b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
1283*700637cbSDimitry Andric    constexpr bool      // constexpr since C++20
12840b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12850b57cec5SDimitry Andric                   ForwardIterator2 first2);
12860b57cec5SDimitry Andric
12870b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
1288*700637cbSDimitry Andric    constexpr bool
12890b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1290*700637cbSDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2);    // since C++14, constexpr since C++20
12910b57cec5SDimitry Andric
12920b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1293*700637cbSDimitry Andric    constexpr bool      // constexpr since C++20
12940b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12950b57cec5SDimitry Andric                   ForwardIterator2 first2, BinaryPredicate pred);
12960b57cec5SDimitry Andric
12970b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1298*700637cbSDimitry Andric    constexpr bool
12990b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
13000b57cec5SDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2,
1301*700637cbSDimitry Andric                   BinaryPredicate pred);                               // since C++14, constexpr since C++20
13020b57cec5SDimitry Andric
13030b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1304*700637cbSDimitry Andric    constexpr ForwardIterator1      // constexpr since C++20
13050b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
13060b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2);
13070b57cec5SDimitry Andric
13080b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1309*700637cbSDimitry Andric    constexpr ForwardIterator1      // constexpr since C++20
13100b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
13110b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
13120b57cec5SDimitry Andric
13130b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T>
1314*700637cbSDimitry Andric    constexpr ForwardIterator       // constexpr since C++20
13150b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
13160b57cec5SDimitry Andric
13170b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate>
1318*700637cbSDimitry Andric    constexpr ForwardIterator       // constexpr since C++20
13190b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last,
13200b57cec5SDimitry Andric             Size count, const T& value, BinaryPredicate pred);
13210b57cec5SDimitry Andric
13220b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1323*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13240b57cec5SDimitry Andric    copy(InputIterator first, InputIterator last, OutputIterator result);
13250b57cec5SDimitry Andric
13260b57cec5SDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate>
1327*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13280b57cec5SDimitry Andric    copy_if(InputIterator first, InputIterator last,
13290b57cec5SDimitry Andric            OutputIterator result, Predicate pred);
13300b57cec5SDimitry Andric
13310b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator>
1332*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13330b57cec5SDimitry Andric    copy_n(InputIterator first, Size n, OutputIterator result);
13340b57cec5SDimitry Andric
13350b57cec5SDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2>
1336*700637cbSDimitry Andric    constexpr BidirectionalIterator2      // constexpr since C++20
13370b57cec5SDimitry Andric    copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
13380b57cec5SDimitry Andric                  BidirectionalIterator2 result);
13390b57cec5SDimitry Andric
134081ad6265SDimitry Andric// [alg.move], move
134181ad6265SDimitry Andrictemplate<class InputIterator, class OutputIterator>
134281ad6265SDimitry Andric    constexpr OutputIterator move(InputIterator first, InputIterator last,
134381ad6265SDimitry Andric                                OutputIterator result);
134481ad6265SDimitry Andric
134581ad6265SDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2>
134681ad6265SDimitry Andric    constexpr BidirectionalIterator2
134781ad6265SDimitry Andric    move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
134881ad6265SDimitry Andric                  BidirectionalIterator2 result);
134981ad6265SDimitry Andric
13500b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1351*700637cbSDimitry Andric    constexpr ForwardIterator2    // constexpr since C++20
13520b57cec5SDimitry Andric    swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
13530b57cec5SDimitry Andric
135481ad6265SDimitry Andricnamespace ranges {
135581ad6265SDimitry Andric    template<class I1, class I2>
135681ad6265SDimitry Andric    using swap_ranges_result = in_in_result<I1, I2>;
135781ad6265SDimitry Andric
135881ad6265SDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
135981ad6265SDimitry Andric        requires indirectly_swappable<I1, I2>
136081ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<I1, I2>
136181ad6265SDimitry Andric        swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
136281ad6265SDimitry Andric
136381ad6265SDimitry Andrictemplate<input_range R1, input_range R2>
136481ad6265SDimitry Andric        requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
136581ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
136681ad6265SDimitry Andric        swap_ranges(R1&& r1, R2&& r2);
136781ad6265SDimitry Andric}
136881ad6265SDimitry Andric
13690b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1370*700637cbSDimitry Andric    constexpr void                // constexpr since C++20
13710b57cec5SDimitry Andric    iter_swap(ForwardIterator1 a, ForwardIterator2 b);
13720b57cec5SDimitry Andric
13730b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation>
1374*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13750b57cec5SDimitry Andric    transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
13760b57cec5SDimitry Andric
13770b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
1378*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13790b57cec5SDimitry Andric    transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
13800b57cec5SDimitry Andric              OutputIterator result, BinaryOperation binary_op);
13810b57cec5SDimitry Andric
13820b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1383*700637cbSDimitry Andric    constexpr void      // constexpr since C++20
13840b57cec5SDimitry Andric    replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
13850b57cec5SDimitry Andric
13860b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate, class T>
1387*700637cbSDimitry Andric    constexpr void      // constexpr since C++20
13880b57cec5SDimitry Andric    replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
13890b57cec5SDimitry Andric
13900b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
1391*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13920b57cec5SDimitry Andric    replace_copy(InputIterator first, InputIterator last, OutputIterator result,
13930b57cec5SDimitry Andric                 const T& old_value, const T& new_value);
13940b57cec5SDimitry Andric
13950b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T>
1396*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
13970b57cec5SDimitry Andric    replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
13980b57cec5SDimitry Andric
13990b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1400*700637cbSDimitry Andric    constexpr void      // constexpr since C++20
14010b57cec5SDimitry Andric    fill(ForwardIterator first, ForwardIterator last, const T& value);
14020b57cec5SDimitry Andric
14030b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class T>
1404*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
14050b57cec5SDimitry Andric    fill_n(OutputIterator first, Size n, const T& value);
14060b57cec5SDimitry Andric
14070b57cec5SDimitry Andrictemplate <class ForwardIterator, class Generator>
1408*700637cbSDimitry Andric    constexpr void      // constexpr since C++20
14090b57cec5SDimitry Andric    generate(ForwardIterator first, ForwardIterator last, Generator gen);
14100b57cec5SDimitry Andric
14110b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class Generator>
1412*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr since C++20
14130b57cec5SDimitry Andric    generate_n(OutputIterator first, Size n, Generator gen);
14140b57cec5SDimitry Andric
14150b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1416*700637cbSDimitry Andric    constexpr ForwardIterator     // constexpr since C++20
14170b57cec5SDimitry Andric    remove(ForwardIterator first, ForwardIterator last, const T& value);
14180b57cec5SDimitry Andric
14190b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
1420*700637cbSDimitry Andric    constexpr ForwardIterator     // constexpr since C++20
14210b57cec5SDimitry Andric    remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
14220b57cec5SDimitry Andric
14230b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
1424*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr since C++20
14250b57cec5SDimitry Andric    remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
14260b57cec5SDimitry Andric
14270b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate>
1428*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr since C++20
14290b57cec5SDimitry Andric    remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
14300b57cec5SDimitry Andric
14310b57cec5SDimitry Andrictemplate <class ForwardIterator>
1432*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr since C++20
14330b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last);
14340b57cec5SDimitry Andric
14350b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1436*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr since C++20
14370b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
14380b57cec5SDimitry Andric
14390b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1440*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr since C++20
14410b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result);
14420b57cec5SDimitry Andric
14430b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate>
1444*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr since C++20
14450b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
14460b57cec5SDimitry Andric
14470b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1448*700637cbSDimitry Andric    constexpr void               // constexpr since C++20
14490b57cec5SDimitry Andric    reverse(BidirectionalIterator first, BidirectionalIterator last);
14500b57cec5SDimitry Andric
14510b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator>
1452*700637cbSDimitry Andric    constexpr OutputIterator       // constexpr since C++20
14530b57cec5SDimitry Andric    reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
14540b57cec5SDimitry Andric
14550b57cec5SDimitry Andrictemplate <class ForwardIterator>
1456*700637cbSDimitry Andric    constexpr ForwardIterator      // constexpr since C++20
14570b57cec5SDimitry Andric    rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
14580b57cec5SDimitry Andric
14590b57cec5SDimitry Andrictemplate <class ForwardIterator, class OutputIterator>
1460*700637cbSDimitry Andric    constexpr OutputIterator       // constexpr since C++20
14610b57cec5SDimitry Andric    rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
14620b57cec5SDimitry Andric
14630b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
14640b57cec5SDimitry Andric    void
14650b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
14660b57cec5SDimitry Andric
14670b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator>
14680b57cec5SDimitry Andric    void
14690b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
14700b57cec5SDimitry Andric                   RandomNumberGenerator& rand);  // deprecated in C++14, removed in C++17
14710b57cec5SDimitry Andric
14720b57cec5SDimitry Andrictemplate<class PopulationIterator, class SampleIterator,
14730b57cec5SDimitry Andric         class Distance, class UniformRandomBitGenerator>
14740b57cec5SDimitry Andric    SampleIterator sample(PopulationIterator first, PopulationIterator last,
14750b57cec5SDimitry Andric                          SampleIterator out, Distance n,
14760b57cec5SDimitry Andric                          UniformRandomBitGenerator&& g); // C++17
14770b57cec5SDimitry Andric
14780b57cec5SDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator>
14790b57cec5SDimitry Andric    void shuffle(RandomAccessIterator first, RandomAccessIterator last,
14800b57cec5SDimitry Andric                 UniformRandomNumberGenerator&& g);
14810b57cec5SDimitry Andric
1482e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1483e8d8bef9SDimitry Andric  constexpr ForwardIterator
1484e8d8bef9SDimitry Andric    shift_left(ForwardIterator first, ForwardIterator last,
1485e8d8bef9SDimitry Andric               typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1486e8d8bef9SDimitry Andric
1487e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1488e8d8bef9SDimitry Andric  constexpr ForwardIterator
1489e8d8bef9SDimitry Andric    shift_right(ForwardIterator first, ForwardIterator last,
1490e8d8bef9SDimitry Andric                typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1491e8d8bef9SDimitry Andric
14920b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
1493*700637cbSDimitry Andric    constexpr bool  // constexpr since C++20
14940b57cec5SDimitry Andric    is_partitioned(InputIterator first, InputIterator last, Predicate pred);
14950b57cec5SDimitry Andric
14960b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
1497*700637cbSDimitry Andric    constexpr ForwardIterator  // constexpr since C++20
14980b57cec5SDimitry Andric    partition(ForwardIterator first, ForwardIterator last, Predicate pred);
14990b57cec5SDimitry Andric
15000b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator1,
15010b57cec5SDimitry Andric          class OutputIterator2, class Predicate>
1502*700637cbSDimitry Andric    constexpr pair<OutputIterator1, OutputIterator2>   // constexpr since C++20
15030b57cec5SDimitry Andric    partition_copy(InputIterator first, InputIterator last,
15040b57cec5SDimitry Andric                   OutputIterator1 out_true, OutputIterator2 out_false,
15050b57cec5SDimitry Andric                   Predicate pred);
15060b57cec5SDimitry Andric
15070b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
1508*700637cbSDimitry Andric    constexpr ForwardIterator                          // constexpr since C++26
15090b57cec5SDimitry Andric    stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
15100b57cec5SDimitry Andric
15110b57cec5SDimitry Andrictemplate<class ForwardIterator, class Predicate>
1512*700637cbSDimitry Andric    constexpr ForwardIterator  // constexpr since C++20
15130b57cec5SDimitry Andric    partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
15140b57cec5SDimitry Andric
15150b57cec5SDimitry Andrictemplate <class ForwardIterator>
1516*700637cbSDimitry Andric    constexpr bool  // constexpr since C++20
15170b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last);
15180b57cec5SDimitry Andric
15190b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1520*700637cbSDimitry Andric    constexpr bool  // constexpr since C++20
15210b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
15220b57cec5SDimitry Andric
15230b57cec5SDimitry Andrictemplate<class ForwardIterator>
1524*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr since C++20
15250b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last);
15260b57cec5SDimitry Andric
15270b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1528*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr since C++20
15290b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
15300b57cec5SDimitry Andric
15310b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1532*700637cbSDimitry Andric    constexpr void               // constexpr since C++20
15330b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last);
15340b57cec5SDimitry Andric
15350b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1536*700637cbSDimitry Andric    constexpr void               // constexpr since C++20
15370b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
15380b57cec5SDimitry Andric
15390b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1540*700637cbSDimitry Andric    constexpr void               // constexpr since C++26
15410b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last);
15420b57cec5SDimitry Andric
15430b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1544*700637cbSDimitry Andric    constexpr void               // constexpr since C++26
15450b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
15460b57cec5SDimitry Andric
15470b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1548*700637cbSDimitry Andric    constexpr void                    // constexpr since C++20
15490b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
15500b57cec5SDimitry Andric
15510b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1552*700637cbSDimitry Andric    constexpr void                    // constexpr since C++20
15530b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
15540b57cec5SDimitry Andric
15550b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator>
1556*700637cbSDimitry Andric    constexpr RandomAccessIterator    // constexpr since C++20
15570b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15580b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last);
15590b57cec5SDimitry Andric
15600b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare>
1561*700637cbSDimitry Andric    constexpr RandomAccessIterator    // constexpr since C++20
15620b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15630b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
15640b57cec5SDimitry Andric
15650b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1566*700637cbSDimitry Andric    constexpr void                    // constexpr since C++20
15670b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
15680b57cec5SDimitry Andric
15690b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1570*700637cbSDimitry Andric    constexpr void                    // constexpr since C++20
15710b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
15720b57cec5SDimitry Andric
15730b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1574*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr since C++20
15750b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
15760b57cec5SDimitry Andric
15770b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1578*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr since C++20
15790b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15800b57cec5SDimitry Andric
15810b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1582*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr since C++20
15830b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
15840b57cec5SDimitry Andric
15850b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1586*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr since C++20
15870b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15880b57cec5SDimitry Andric
15890b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1590*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr since C++20
15910b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value);
15920b57cec5SDimitry Andric
15930b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1594*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr since C++20
15950b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15960b57cec5SDimitry Andric
15970b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
1598*700637cbSDimitry Andric    constexpr bool                                    // constexpr since C++20
15990b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value);
16000b57cec5SDimitry Andric
16010b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1602*700637cbSDimitry Andric    constexpr bool                                    // constexpr since C++20
16030b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
16040b57cec5SDimitry Andric
16050b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1606*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr since C++20
16070b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
16080b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16090b57cec5SDimitry Andric
16100b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1611*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr since C++20
16120b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
16130b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16140b57cec5SDimitry Andric
16150b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1616*700637cbSDimitry Andric    constexpr void                                    // constexpr since C++26
16170b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
16180b57cec5SDimitry Andric
16190b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1620*700637cbSDimitry Andric    constexpr void                                    // constexpr since C++26
16210b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
16220b57cec5SDimitry Andric
16230b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1624*700637cbSDimitry Andric    constexpr bool                                    // constexpr since C++20
16250b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
16260b57cec5SDimitry Andric
16270b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
1628*700637cbSDimitry Andric    constexpr bool                                    // constexpr since C++20
16290b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
16300b57cec5SDimitry Andric
16310b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1632*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr since C++20
16330b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
16340b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16350b57cec5SDimitry Andric
16360b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1637*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr since C++20
16380b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
16390b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16400b57cec5SDimitry Andric
16410b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1642*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16430b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
16440b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16450b57cec5SDimitry Andric
16460b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1647*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16480b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
16490b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16500b57cec5SDimitry Andric
16510b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1652*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16530b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16540b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16550b57cec5SDimitry Andric
16560b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1657*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16580b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16590b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16600b57cec5SDimitry Andric
16610b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1662*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16630b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16640b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16650b57cec5SDimitry Andric
16660b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1667*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr since C++20
16680b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16690b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16700b57cec5SDimitry Andric
16710b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1672*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16730b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last);
16740b57cec5SDimitry Andric
16750b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1676*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16770b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16780b57cec5SDimitry Andric
16790b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1680*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16810b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last);
16820b57cec5SDimitry Andric
16830b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1684*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16850b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16860b57cec5SDimitry Andric
16870b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1688*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16890b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last);
16900b57cec5SDimitry Andric
16910b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1692*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16930b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16940b57cec5SDimitry Andric
16950b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1696*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
16970b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last);
16980b57cec5SDimitry Andric
16990b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1700*700637cbSDimitry Andric    constexpr void                                   // constexpr since C++20
17010b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
17020b57cec5SDimitry Andric
17030b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1704*700637cbSDimitry Andric    constexpr bool   // constexpr since C++20
17050b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last);
17060b57cec5SDimitry Andric
17070b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1708*700637cbSDimitry Andric    constexpr bool   // constexpr since C++20
17090b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
17100b57cec5SDimitry Andric
17110b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1712*700637cbSDimitry Andric    constexpr RandomAccessIterator   // constexpr since C++20
17130b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
17140b57cec5SDimitry Andric
17150b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1716*700637cbSDimitry Andric    constexpr RandomAccessIterator   // constexpr since C++20
17170b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
17180b57cec5SDimitry Andric
17190b57cec5SDimitry Andrictemplate <class ForwardIterator>
1720*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr since C++14
1721e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last);
17220b57cec5SDimitry Andric
17230b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1724*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr since C++14
1725e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last, Compare comp);
17260b57cec5SDimitry Andric
17270b57cec5SDimitry Andrictemplate <class T>
1728*700637cbSDimitry Andric    constexpr const T&               // constexpr since C++14
1729e8d8bef9SDimitry Andric    min(const T& a, const T& b);
17300b57cec5SDimitry Andric
17310b57cec5SDimitry Andrictemplate <class T, class Compare>
1732*700637cbSDimitry Andric    constexpr const T&               // constexpr since C++14
1733e8d8bef9SDimitry Andric    min(const T& a, const T& b, Compare comp);
17340b57cec5SDimitry Andric
17350b57cec5SDimitry Andrictemplate<class T>
1736*700637cbSDimitry Andric    constexpr T                      // constexpr since C++14
1737e8d8bef9SDimitry Andric    min(initializer_list<T> t);
17380b57cec5SDimitry Andric
17390b57cec5SDimitry Andrictemplate<class T, class Compare>
1740*700637cbSDimitry Andric    constexpr T                      // constexpr since C++14
1741e8d8bef9SDimitry Andric    min(initializer_list<T> t, Compare comp);
17420b57cec5SDimitry Andric
17430b57cec5SDimitry Andrictemplate<class T>
17440b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi);               // C++17
17450b57cec5SDimitry Andric
17460b57cec5SDimitry Andrictemplate<class T, class Compare>
17470b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
17480b57cec5SDimitry Andric
17490b57cec5SDimitry Andrictemplate <class ForwardIterator>
1750*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr since C++14
1751e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last);
17520b57cec5SDimitry Andric
17530b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1754*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr since C++14
1755e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last, Compare comp);
17560b57cec5SDimitry Andric
17570b57cec5SDimitry Andrictemplate <class T>
1758*700637cbSDimitry Andric    constexpr const T&               // constexpr since C++14
1759e8d8bef9SDimitry Andric    max(const T& a, const T& b);
17600b57cec5SDimitry Andric
17610b57cec5SDimitry Andrictemplate <class T, class Compare>
1762*700637cbSDimitry Andric    constexpr const T&               // constexpr since C++14
1763e8d8bef9SDimitry Andric    max(const T& a, const T& b, Compare comp);
17640b57cec5SDimitry Andric
17650b57cec5SDimitry Andrictemplate<class T>
1766*700637cbSDimitry Andric    constexpr T                      // constexpr since C++14
1767e8d8bef9SDimitry Andric    max(initializer_list<T> t);
17680b57cec5SDimitry Andric
17690b57cec5SDimitry Andrictemplate<class T, class Compare>
1770*700637cbSDimitry Andric    constexpr T                      // constexpr since C++14
1771e8d8bef9SDimitry Andric    max(initializer_list<T> t, Compare comp);
17720b57cec5SDimitry Andric
17730b57cec5SDimitry Andrictemplate<class ForwardIterator>
1774*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr since C++14
1775e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last);
17760b57cec5SDimitry Andric
17770b57cec5SDimitry Andrictemplate<class ForwardIterator, class Compare>
1778*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr since C++14
1779e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
17800b57cec5SDimitry Andric
17810b57cec5SDimitry Andrictemplate<class T>
1782*700637cbSDimitry Andric    constexpr pair<const T&, const T&>  // constexpr since C++14
1783e8d8bef9SDimitry Andric    minmax(const T& a, const T& b);
17840b57cec5SDimitry Andric
17850b57cec5SDimitry Andrictemplate<class T, class Compare>
1786*700637cbSDimitry Andric    constexpr pair<const T&, const T&>  // constexpr since C++14
1787e8d8bef9SDimitry Andric    minmax(const T& a, const T& b, Compare comp);
17880b57cec5SDimitry Andric
17890b57cec5SDimitry Andrictemplate<class T>
1790*700637cbSDimitry Andric    constexpr pair<T, T>                // constexpr since C++14
1791e8d8bef9SDimitry Andric    minmax(initializer_list<T> t);
17920b57cec5SDimitry Andric
17930b57cec5SDimitry Andrictemplate<class T, class Compare>
1794*700637cbSDimitry Andric    constexpr pair<T, T>                // constexpr since C++14
1795e8d8bef9SDimitry Andric    minmax(initializer_list<T> t, Compare comp);
17960b57cec5SDimitry Andric
17970b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1798*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
17990b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
18000b57cec5SDimitry Andric
18010b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
1802*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
18030b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
18040b57cec5SDimitry Andric                            InputIterator2 first2, InputIterator2 last2, Compare comp);
18050b57cec5SDimitry Andric
180606c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2, class Cmp>
180706c3fb27SDimitry Andric    constexpr auto
180806c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
180906c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2,
181006c3fb27SDimitry Andric                                      Cmp comp)
181106c3fb27SDimitry Andric      -> decltype(comp(*b1, *b2));                                                        // since C++20
181206c3fb27SDimitry Andric
181306c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2>
181406c3fb27SDimitry Andric    constexpr auto
181506c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
181606c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2);      // since C++20
181706c3fb27SDimitry Andric
18180b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1819*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
18200b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last);
18210b57cec5SDimitry Andric
18220b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1823*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
18240b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
18250b57cec5SDimitry Andric
18260b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1827*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
18280b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
18290b57cec5SDimitry Andric
18300b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1831*700637cbSDimitry Andric    constexpr bool     // constexpr since C++20
18320b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
18330b57cec5SDimitry Andric}  // std
18340b57cec5SDimitry Andric
18350b57cec5SDimitry Andric*/
18360b57cec5SDimitry Andric
1837*700637cbSDimitry Andric#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1838*700637cbSDimitry Andric#  include <__cxx03/algorithm>
1839*700637cbSDimitry Andric#else
18400b57cec5SDimitry Andric#  include <__config>
18410b57cec5SDimitry Andric
1842fe6060f1SDimitry Andric#  include <__algorithm/adjacent_find.h>
1843fe6060f1SDimitry Andric#  include <__algorithm/all_of.h>
1844fe6060f1SDimitry Andric#  include <__algorithm/any_of.h>
1845fe6060f1SDimitry Andric#  include <__algorithm/binary_search.h>
1846fe6060f1SDimitry Andric#  include <__algorithm/copy.h>
1847fe6060f1SDimitry Andric#  include <__algorithm/copy_backward.h>
1848fe6060f1SDimitry Andric#  include <__algorithm/copy_if.h>
1849fe6060f1SDimitry Andric#  include <__algorithm/copy_n.h>
1850fe6060f1SDimitry Andric#  include <__algorithm/count.h>
1851fe6060f1SDimitry Andric#  include <__algorithm/count_if.h>
1852fe6060f1SDimitry Andric#  include <__algorithm/equal.h>
1853fe6060f1SDimitry Andric#  include <__algorithm/equal_range.h>
1854fe6060f1SDimitry Andric#  include <__algorithm/fill.h>
185504eeddc0SDimitry Andric#  include <__algorithm/fill_n.h>
1856fe6060f1SDimitry Andric#  include <__algorithm/find.h>
1857fe6060f1SDimitry Andric#  include <__algorithm/find_end.h>
1858fe6060f1SDimitry Andric#  include <__algorithm/find_first_of.h>
1859fe6060f1SDimitry Andric#  include <__algorithm/find_if.h>
1860fe6060f1SDimitry Andric#  include <__algorithm/find_if_not.h>
1861fe6060f1SDimitry Andric#  include <__algorithm/for_each.h>
1862fe6060f1SDimitry Andric#  include <__algorithm/generate.h>
186304eeddc0SDimitry Andric#  include <__algorithm/generate_n.h>
1864fe6060f1SDimitry Andric#  include <__algorithm/includes.h>
1865fe6060f1SDimitry Andric#  include <__algorithm/inplace_merge.h>
1866fe6060f1SDimitry Andric#  include <__algorithm/is_heap.h>
1867fe6060f1SDimitry Andric#  include <__algorithm/is_heap_until.h>
1868fe6060f1SDimitry Andric#  include <__algorithm/is_partitioned.h>
1869fe6060f1SDimitry Andric#  include <__algorithm/is_permutation.h>
1870fe6060f1SDimitry Andric#  include <__algorithm/is_sorted.h>
1871fe6060f1SDimitry Andric#  include <__algorithm/is_sorted_until.h>
1872fe6060f1SDimitry Andric#  include <__algorithm/iter_swap.h>
1873fe6060f1SDimitry Andric#  include <__algorithm/lexicographical_compare.h>
1874fe6060f1SDimitry Andric#  include <__algorithm/lower_bound.h>
1875fe6060f1SDimitry Andric#  include <__algorithm/make_heap.h>
1876fe6060f1SDimitry Andric#  include <__algorithm/max.h>
1877fe6060f1SDimitry Andric#  include <__algorithm/max_element.h>
1878fe6060f1SDimitry Andric#  include <__algorithm/merge.h>
1879fe6060f1SDimitry Andric#  include <__algorithm/min.h>
1880fe6060f1SDimitry Andric#  include <__algorithm/min_element.h>
1881fe6060f1SDimitry Andric#  include <__algorithm/minmax.h>
1882fe6060f1SDimitry Andric#  include <__algorithm/minmax_element.h>
1883fe6060f1SDimitry Andric#  include <__algorithm/mismatch.h>
1884fe6060f1SDimitry Andric#  include <__algorithm/move.h>
1885fe6060f1SDimitry Andric#  include <__algorithm/move_backward.h>
1886fe6060f1SDimitry Andric#  include <__algorithm/next_permutation.h>
1887fe6060f1SDimitry Andric#  include <__algorithm/none_of.h>
1888fe6060f1SDimitry Andric#  include <__algorithm/nth_element.h>
1889fe6060f1SDimitry Andric#  include <__algorithm/partial_sort.h>
1890fe6060f1SDimitry Andric#  include <__algorithm/partial_sort_copy.h>
1891fe6060f1SDimitry Andric#  include <__algorithm/partition.h>
1892fe6060f1SDimitry Andric#  include <__algorithm/partition_copy.h>
1893fe6060f1SDimitry Andric#  include <__algorithm/partition_point.h>
1894fe6060f1SDimitry Andric#  include <__algorithm/pop_heap.h>
1895fe6060f1SDimitry Andric#  include <__algorithm/prev_permutation.h>
1896fe6060f1SDimitry Andric#  include <__algorithm/push_heap.h>
18970fca6ea1SDimitry Andric#  include <__algorithm/remove.h>
18980fca6ea1SDimitry Andric#  include <__algorithm/remove_copy.h>
18990fca6ea1SDimitry Andric#  include <__algorithm/remove_copy_if.h>
19000fca6ea1SDimitry Andric#  include <__algorithm/remove_if.h>
19010fca6ea1SDimitry Andric#  include <__algorithm/replace.h>
19020fca6ea1SDimitry Andric#  include <__algorithm/replace_copy.h>
19030fca6ea1SDimitry Andric#  include <__algorithm/replace_copy_if.h>
19040fca6ea1SDimitry Andric#  include <__algorithm/replace_if.h>
19050fca6ea1SDimitry Andric#  include <__algorithm/reverse.h>
19060fca6ea1SDimitry Andric#  include <__algorithm/reverse_copy.h>
19070fca6ea1SDimitry Andric#  include <__algorithm/rotate.h>
19080fca6ea1SDimitry Andric#  include <__algorithm/rotate_copy.h>
19090fca6ea1SDimitry Andric#  include <__algorithm/search.h>
19100fca6ea1SDimitry Andric#  include <__algorithm/search_n.h>
19110fca6ea1SDimitry Andric#  include <__algorithm/set_difference.h>
19120fca6ea1SDimitry Andric#  include <__algorithm/set_intersection.h>
19130fca6ea1SDimitry Andric#  include <__algorithm/set_symmetric_difference.h>
19140fca6ea1SDimitry Andric#  include <__algorithm/set_union.h>
19150fca6ea1SDimitry Andric#  include <__algorithm/shuffle.h>
19160fca6ea1SDimitry Andric#  include <__algorithm/sort.h>
19170fca6ea1SDimitry Andric#  include <__algorithm/sort_heap.h>
19180fca6ea1SDimitry Andric#  include <__algorithm/stable_partition.h>
19190fca6ea1SDimitry Andric#  include <__algorithm/stable_sort.h>
19200fca6ea1SDimitry Andric#  include <__algorithm/swap_ranges.h>
19210fca6ea1SDimitry Andric#  include <__algorithm/transform.h>
19220fca6ea1SDimitry Andric#  include <__algorithm/unique.h>
19230fca6ea1SDimitry Andric#  include <__algorithm/unique_copy.h>
19240fca6ea1SDimitry Andric#  include <__algorithm/upper_bound.h>
19250fca6ea1SDimitry Andric
19260fca6ea1SDimitry Andric#  if _LIBCPP_STD_VER >= 17
19270fca6ea1SDimitry Andric#    include <__algorithm/clamp.h>
19280fca6ea1SDimitry Andric#    include <__algorithm/for_each_n.h>
19290fca6ea1SDimitry Andric#    include <__algorithm/pstl.h>
19300fca6ea1SDimitry Andric#    include <__algorithm/sample.h>
19310fca6ea1SDimitry Andric#  endif // _LIBCPP_STD_VER >= 17
19320fca6ea1SDimitry Andric
19330fca6ea1SDimitry Andric#  if _LIBCPP_STD_VER >= 20
19340fca6ea1SDimitry Andric#    include <__algorithm/in_found_result.h>
19350fca6ea1SDimitry Andric#    include <__algorithm/in_fun_result.h>
19360fca6ea1SDimitry Andric#    include <__algorithm/in_in_out_result.h>
19370fca6ea1SDimitry Andric#    include <__algorithm/in_in_result.h>
19380fca6ea1SDimitry Andric#    include <__algorithm/in_out_out_result.h>
19390fca6ea1SDimitry Andric#    include <__algorithm/in_out_result.h>
19400fca6ea1SDimitry Andric#    include <__algorithm/lexicographical_compare_three_way.h>
19410fca6ea1SDimitry Andric#    include <__algorithm/min_max_result.h>
1942*700637cbSDimitry Andric#    include <__algorithm/out_value_result.h>
194381ad6265SDimitry Andric#    include <__algorithm/ranges_adjacent_find.h>
194481ad6265SDimitry Andric#    include <__algorithm/ranges_all_of.h>
194581ad6265SDimitry Andric#    include <__algorithm/ranges_any_of.h>
194681ad6265SDimitry Andric#    include <__algorithm/ranges_binary_search.h>
194761cfbce3SDimitry Andric#    include <__algorithm/ranges_clamp.h>
1948cb14a3feSDimitry Andric#    include <__algorithm/ranges_contains.h>
194981ad6265SDimitry Andric#    include <__algorithm/ranges_copy.h>
195081ad6265SDimitry Andric#    include <__algorithm/ranges_copy_backward.h>
195181ad6265SDimitry Andric#    include <__algorithm/ranges_copy_if.h>
195281ad6265SDimitry Andric#    include <__algorithm/ranges_copy_n.h>
195381ad6265SDimitry Andric#    include <__algorithm/ranges_count.h>
195481ad6265SDimitry Andric#    include <__algorithm/ranges_count_if.h>
195581ad6265SDimitry Andric#    include <__algorithm/ranges_equal.h>
1956fcaf7f86SDimitry Andric#    include <__algorithm/ranges_equal_range.h>
195781ad6265SDimitry Andric#    include <__algorithm/ranges_fill.h>
195881ad6265SDimitry Andric#    include <__algorithm/ranges_fill_n.h>
195981ad6265SDimitry Andric#    include <__algorithm/ranges_find.h>
1960753f127fSDimitry Andric#    include <__algorithm/ranges_find_end.h>
196181ad6265SDimitry Andric#    include <__algorithm/ranges_find_first_of.h>
196281ad6265SDimitry Andric#    include <__algorithm/ranges_find_if.h>
196381ad6265SDimitry Andric#    include <__algorithm/ranges_find_if_not.h>
196481ad6265SDimitry Andric#    include <__algorithm/ranges_for_each.h>
196581ad6265SDimitry Andric#    include <__algorithm/ranges_for_each_n.h>
1966972a253aSDimitry Andric#    include <__algorithm/ranges_generate.h>
1967972a253aSDimitry Andric#    include <__algorithm/ranges_generate_n.h>
1968fcaf7f86SDimitry Andric#    include <__algorithm/ranges_includes.h>
196961cfbce3SDimitry Andric#    include <__algorithm/ranges_inplace_merge.h>
1970972a253aSDimitry Andric#    include <__algorithm/ranges_is_heap.h>
1971972a253aSDimitry Andric#    include <__algorithm/ranges_is_heap_until.h>
197281ad6265SDimitry Andric#    include <__algorithm/ranges_is_partitioned.h>
197361cfbce3SDimitry Andric#    include <__algorithm/ranges_is_permutation.h>
197481ad6265SDimitry Andric#    include <__algorithm/ranges_is_sorted.h>
197581ad6265SDimitry Andric#    include <__algorithm/ranges_is_sorted_until.h>
197681ad6265SDimitry Andric#    include <__algorithm/ranges_lexicographical_compare.h>
197781ad6265SDimitry Andric#    include <__algorithm/ranges_lower_bound.h>
1978753f127fSDimitry Andric#    include <__algorithm/ranges_make_heap.h>
197981ad6265SDimitry Andric#    include <__algorithm/ranges_max.h>
198081ad6265SDimitry Andric#    include <__algorithm/ranges_max_element.h>
1981753f127fSDimitry Andric#    include <__algorithm/ranges_merge.h>
198281ad6265SDimitry Andric#    include <__algorithm/ranges_min.h>
198381ad6265SDimitry Andric#    include <__algorithm/ranges_min_element.h>
198481ad6265SDimitry Andric#    include <__algorithm/ranges_minmax.h>
198581ad6265SDimitry Andric#    include <__algorithm/ranges_minmax_element.h>
198681ad6265SDimitry Andric#    include <__algorithm/ranges_mismatch.h>
198781ad6265SDimitry Andric#    include <__algorithm/ranges_move.h>
198881ad6265SDimitry Andric#    include <__algorithm/ranges_move_backward.h>
198961cfbce3SDimitry Andric#    include <__algorithm/ranges_next_permutation.h>
199081ad6265SDimitry Andric#    include <__algorithm/ranges_none_of.h>
1991753f127fSDimitry Andric#    include <__algorithm/ranges_nth_element.h>
1992fcaf7f86SDimitry Andric#    include <__algorithm/ranges_partial_sort.h>
199361cfbce3SDimitry Andric#    include <__algorithm/ranges_partial_sort_copy.h>
1994fcaf7f86SDimitry Andric#    include <__algorithm/ranges_partition.h>
1995fcaf7f86SDimitry Andric#    include <__algorithm/ranges_partition_copy.h>
1996fcaf7f86SDimitry Andric#    include <__algorithm/ranges_partition_point.h>
1997753f127fSDimitry Andric#    include <__algorithm/ranges_pop_heap.h>
199861cfbce3SDimitry Andric#    include <__algorithm/ranges_prev_permutation.h>
1999753f127fSDimitry Andric#    include <__algorithm/ranges_push_heap.h>
2000753f127fSDimitry Andric#    include <__algorithm/ranges_remove.h>
200161cfbce3SDimitry Andric#    include <__algorithm/ranges_remove_copy.h>
200261cfbce3SDimitry Andric#    include <__algorithm/ranges_remove_copy_if.h>
2003753f127fSDimitry Andric#    include <__algorithm/ranges_remove_if.h>
200481ad6265SDimitry Andric#    include <__algorithm/ranges_replace.h>
200561cfbce3SDimitry Andric#    include <__algorithm/ranges_replace_copy.h>
200661cfbce3SDimitry Andric#    include <__algorithm/ranges_replace_copy_if.h>
200781ad6265SDimitry Andric#    include <__algorithm/ranges_replace_if.h>
200881ad6265SDimitry Andric#    include <__algorithm/ranges_reverse.h>
2009753f127fSDimitry Andric#    include <__algorithm/ranges_reverse_copy.h>
201061cfbce3SDimitry Andric#    include <__algorithm/ranges_rotate.h>
2011753f127fSDimitry Andric#    include <__algorithm/ranges_rotate_copy.h>
201261cfbce3SDimitry Andric#    include <__algorithm/ranges_sample.h>
2013753f127fSDimitry Andric#    include <__algorithm/ranges_search.h>
2014753f127fSDimitry Andric#    include <__algorithm/ranges_search_n.h>
2015753f127fSDimitry Andric#    include <__algorithm/ranges_set_difference.h>
2016753f127fSDimitry Andric#    include <__algorithm/ranges_set_intersection.h>
2017753f127fSDimitry Andric#    include <__algorithm/ranges_set_symmetric_difference.h>
2018fcaf7f86SDimitry Andric#    include <__algorithm/ranges_set_union.h>
2019fcaf7f86SDimitry Andric#    include <__algorithm/ranges_shuffle.h>
202081ad6265SDimitry Andric#    include <__algorithm/ranges_sort.h>
2021753f127fSDimitry Andric#    include <__algorithm/ranges_sort_heap.h>
2022fcaf7f86SDimitry Andric#    include <__algorithm/ranges_stable_partition.h>
202381ad6265SDimitry Andric#    include <__algorithm/ranges_stable_sort.h>
202481ad6265SDimitry Andric#    include <__algorithm/ranges_swap_ranges.h>
202581ad6265SDimitry Andric#    include <__algorithm/ranges_transform.h>
202661cfbce3SDimitry Andric#    include <__algorithm/ranges_unique.h>
202761cfbce3SDimitry Andric#    include <__algorithm/ranges_unique_copy.h>
202881ad6265SDimitry Andric#    include <__algorithm/ranges_upper_bound.h>
2029fe6060f1SDimitry Andric#    include <__algorithm/shift_left.h>
2030fe6060f1SDimitry Andric#    include <__algorithm/shift_right.h>
20310fca6ea1SDimitry Andric#  endif
20320fca6ea1SDimitry Andric
20330fca6ea1SDimitry Andric#  if _LIBCPP_STD_VER >= 23
20340fca6ea1SDimitry Andric#    include <__algorithm/ranges_contains_subrange.h>
20350fca6ea1SDimitry Andric#    include <__algorithm/ranges_ends_with.h>
20360fca6ea1SDimitry Andric#    include <__algorithm/ranges_find_last.h>
2037*700637cbSDimitry Andric#    include <__algorithm/ranges_fold.h>
20380fca6ea1SDimitry Andric#    include <__algorithm/ranges_starts_with.h>
20390fca6ea1SDimitry Andric#  endif // _LIBCPP_STD_VER >= 23
20400fca6ea1SDimitry Andric
20410fca6ea1SDimitry Andric#  include <version>
20420b57cec5SDimitry Andric
204381ad6265SDimitry Andric// standard-mandated includes
2044bdd1243dSDimitry Andric
2045bdd1243dSDimitry Andric// [algorithm.syn]
204681ad6265SDimitry Andric#  include <initializer_list>
204781ad6265SDimitry Andric
20480b57cec5SDimitry Andric#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20490b57cec5SDimitry Andric#    pragma GCC system_header
20500b57cec5SDimitry Andric#  endif
20510b57cec5SDimitry Andric
20520fca6ea1SDimitry Andric#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
20530fca6ea1SDimitry Andric#    include <execution>
20540fca6ea1SDimitry Andric#  endif
20550fca6ea1SDimitry Andric
2056bdd1243dSDimitry Andric#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2057bdd1243dSDimitry Andric#    include <atomic>
205806c3fb27SDimitry Andric#    include <bit>
2059bdd1243dSDimitry Andric#    include <concepts>
206006c3fb27SDimitry Andric#    include <cstdlib>
2061bdd1243dSDimitry Andric#    include <cstring>
2062bdd1243dSDimitry Andric#    include <iterator>
2063bdd1243dSDimitry Andric#    include <memory>
2064*700637cbSDimitry Andric#    include <optional>
2065bdd1243dSDimitry Andric#    include <stdexcept>
206606c3fb27SDimitry Andric#    include <type_traits>
2067bdd1243dSDimitry Andric#    include <utility>
2068bdd1243dSDimitry Andric#  endif
2069*700637cbSDimitry Andric#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
2070bdd1243dSDimitry Andric
20710b57cec5SDimitry Andric#endif // _LIBCPP_ALGORITHM
2072