xref: /freebsd/contrib/llvm-project/libcxx/include/algorithm (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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
4881ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
4981ad6265SDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>                                   // since C++20
5081ad6265SDimitry Andric  constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
5181ad6265SDimitry Andric
5281ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
5381ad6265SDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>                       // since C++20
5481ad6265SDimitry Andric  constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
5581ad6265SDimitry Andric
5681ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
5781ad6265SDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
5881ad6265SDimitry Andric  constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {});                       // since C++20
5981ad6265SDimitry Andric
6081ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
6181ad6265SDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
6281ad6265SDimitry Andric  constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {});            // since C++20
6381ad6265SDimitry Andric
6481ad6265SDimitry Andric  template<class I1, class I2>
6581ad6265SDimitry Andric    using mismatch_result = in_in_result<I1, I2>;
6681ad6265SDimitry Andric
6781ad6265SDimitry Andric  template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
6881ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
6981ad6265SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
7006c3fb27SDimitry Andric  constexpr mismatch_result<_I1, _I2>                                                                     // since C++20
7106c3fb27SDimitry Andric  mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
7281ad6265SDimitry Andric
7381ad6265SDimitry Andric  template <input_range R1, input_range R2,
7481ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
7581ad6265SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
7681ad6265SDimitry Andric  constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
7781ad6265SDimitry Andric  mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})                          // since C++20
7881ad6265SDimitry Andric
7981ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
8081ad6265SDimitry Andric    constexpr I find(I first, S last, const T& value, Proj proj = {});                                    // since C++20
8181ad6265SDimitry Andric
8281ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity>
8381ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
8481ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
8581ad6265SDimitry Andric      find(R&& r, const T& value, Proj proj = {});                                                        // since C++20
8681ad6265SDimitry Andric
8781ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
8881ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
8981ad6265SDimitry Andric    constexpr I find_if(I first, S last, Pred pred, Proj proj = {});                                      // since C++20
9081ad6265SDimitry Andric
9181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
9281ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
9381ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
9481ad6265SDimitry Andric      find_if(R&& r, Pred pred, Proj proj = {});                                                          // since C++20
9581ad6265SDimitry Andric
9681ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
9781ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
9881ad6265SDimitry Andric    constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});                                  // since C++20
9981ad6265SDimitry Andric
10081ad6265SDimitry Andric  template<input_range R, class Proj = identity,
10181ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
10281ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
10381ad6265SDimitry Andric      find_if_not(R&& r, Pred pred, Proj proj = {});                                                      // since C++20
10481ad6265SDimitry Andric
105*0fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
106*0fca6ea1SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
107*0fca6ea1SDimitry Andric    constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {});                     // since C++23
108*0fca6ea1SDimitry Andric
109*0fca6ea1SDimitry Andric  template<forward_range R, class T, class Proj = identity>
110*0fca6ea1SDimitry Andric    requires
111*0fca6ea1SDimitry Andric      indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
112*0fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {});                   // since C++23
113*0fca6ea1SDimitry Andric
114*0fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
115*0fca6ea1SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
116*0fca6ea1SDimitry Andric    constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {});                      // since C++23
117*0fca6ea1SDimitry Andric
118*0fca6ea1SDimitry Andric  template<forward_range R, class Proj = identity,
119*0fca6ea1SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
120*0fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {});                     // since C++23
121*0fca6ea1SDimitry Andric
122*0fca6ea1SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
123*0fca6ea1SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
124*0fca6ea1SDimitry Andric    constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {});                  // since C++23
125*0fca6ea1SDimitry Andric
126*0fca6ea1SDimitry Andric  template<forward_range R, class Proj = identity,
127*0fca6ea1SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
128*0fca6ea1SDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {});                 // since C++23
129*0fca6ea1SDimitry Andric
13081ad6265SDimitry Andric  template<class T, class Proj = identity,
13181ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
13281ad6265SDimitry Andric    constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
13381ad6265SDimitry Andric
13481ad6265SDimitry Andric  template<copyable T, class Proj = identity,
13581ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
13681ad6265SDimitry Andric    constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
13781ad6265SDimitry Andric
13881ad6265SDimitry Andric template<input_range R, class Proj = identity,
13981ad6265SDimitry Andric          indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
14081ad6265SDimitry Andric   requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
14181ad6265SDimitry Andric   constexpr range_value_t<R>
14281ad6265SDimitry Andric     min(R&& r, Comp comp = {}, Proj proj = {});                                                          // since C++20
14381ad6265SDimitry Andric
14481ad6265SDimitry Andric  template<class T, class Proj = identity,
14581ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
14681ad6265SDimitry Andric    constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
14781ad6265SDimitry Andric
14881ad6265SDimitry Andric  template<copyable T, class Proj = identity,
14981ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
15081ad6265SDimitry Andric    constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
15181ad6265SDimitry Andric
15281ad6265SDimitry Andric  template<input_range R, class Proj = identity,
15381ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
15481ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
15581ad6265SDimitry Andric    constexpr range_value_t<R>
15681ad6265SDimitry Andric      max(R&& r, Comp comp = {}, Proj proj = {});                                                         // since C++20
15781ad6265SDimitry Andric
15881ad6265SDimitry Andric  template<class I, class O>
15981ad6265SDimitry Andric    using unary_transform_result = in_out_result<I, O>;                                                   // since C++20
16081ad6265SDimitry Andric
16181ad6265SDimitry Andric  template<class I1, class I2, class O>
16281ad6265SDimitry Andric    using binary_transform_result = in_in_out_result<I1, I2, O>;                                          // since C++20
16381ad6265SDimitry Andric
16481ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
16581ad6265SDimitry Andric           copy_constructible F, class Proj = identity>
16681ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
16781ad6265SDimitry Andric    constexpr ranges::unary_transform_result<I, O>
16881ad6265SDimitry Andric      transform(I first1, S last1, O result, F op, Proj proj = {});                                       // since C++20
16981ad6265SDimitry Andric
17081ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, copy_constructible F,
17181ad6265SDimitry Andric           class Proj = identity>
17281ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
17381ad6265SDimitry Andric    constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
17481ad6265SDimitry Andric      transform(R&& r, O result, F op, Proj proj = {});                                                   // since C++20
17581ad6265SDimitry Andric
17681ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
17781ad6265SDimitry Andric           weakly_incrementable O, copy_constructible F, class Proj1 = identity,
17881ad6265SDimitry Andric           class Proj2 = identity>
17981ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
18081ad6265SDimitry Andric                                           projected<I2, Proj2>>>
18181ad6265SDimitry Andric    constexpr ranges::binary_transform_result<I1, I2, O>
18281ad6265SDimitry Andric      transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
18381ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
18481ad6265SDimitry Andric
18581ad6265SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
18681ad6265SDimitry Andric           copy_constructible F, class Proj1 = identity, class Proj2 = identity>
18781ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
18881ad6265SDimitry Andric                                           projected<iterator_t<R2>, Proj2>>>
18981ad6265SDimitry Andric    constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
19081ad6265SDimitry Andric      transform(R1&& r1, R2&& r2, O result,
19181ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
19281ad6265SDimitry Andric
19381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
19481ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
19581ad6265SDimitry Andric    constexpr iter_difference_t<I>
19681ad6265SDimitry Andric      count(I first, S last, const T& value, Proj proj = {});                                             // since C++20
19781ad6265SDimitry Andric
19881ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity>
19981ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
20081ad6265SDimitry Andric    constexpr range_difference_t<R>
20181ad6265SDimitry Andric      count(R&& r, const T& value, Proj proj = {});                                                       // since C++20
20281ad6265SDimitry Andric
20381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
20481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
20581ad6265SDimitry Andric    constexpr iter_difference_t<I>
20681ad6265SDimitry Andric      count_if(I first, S last, Pred pred, Proj proj = {});                                               // since C++20
20781ad6265SDimitry Andric
20881ad6265SDimitry Andric  template<input_range R, class Proj = identity,
20981ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
21081ad6265SDimitry Andric    constexpr range_difference_t<R>
21181ad6265SDimitry Andric      count_if(R&& r, Pred pred, Proj proj = {});                                                         // since C++20
21281ad6265SDimitry Andric
21381ad6265SDimitry Andric  template<class T>
21481ad6265SDimitry Andric  using minmax_result = min_max_result<T>;
21581ad6265SDimitry Andric
21681ad6265SDimitry Andric  template<class T, class Proj = identity,
21781ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
21881ad6265SDimitry Andric    constexpr ranges::minmax_result<const T&>
21981ad6265SDimitry Andric      minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});                                     // since C++20
22081ad6265SDimitry Andric
22181ad6265SDimitry Andric  template<copyable T, class Proj = identity,
22281ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
22381ad6265SDimitry Andric    constexpr ranges::minmax_result<T>
22481ad6265SDimitry Andric      minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {});                                      // since C++20
22581ad6265SDimitry Andric
22681ad6265SDimitry Andric  template<input_range R, class Proj = identity,
22781ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
22881ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
22981ad6265SDimitry Andric    constexpr ranges::minmax_result<range_value_t<R>>
23081ad6265SDimitry Andric      minmax(R&& r, Comp comp = {}, Proj proj = {});                                                      // since C++20
23181ad6265SDimitry Andric
23281ad6265SDimitry Andric  template<class I>
23381ad6265SDimitry Andric  using minmax_element_result = min_max_result<I>;
23481ad6265SDimitry Andric
23581ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
23681ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
23781ad6265SDimitry Andric    constexpr ranges::minmax_element_result<I>
23881ad6265SDimitry Andric      minmax_element(I first, S last, Comp comp = {}, Proj proj = {});                                    // since C++20
23981ad6265SDimitry Andric
24081ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
24181ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
24281ad6265SDimitry Andric    constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
24381ad6265SDimitry Andric      minmax_element(R&& r, Comp comp = {}, Proj proj = {});                                              // since C++20
24481ad6265SDimitry Andric
245*0fca6ea1SDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1,
246*0fca6ea1SDimitry Andric           forward_iterator I2, sentinel_for<I2> S2,
247*0fca6ea1SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
248*0fca6ea1SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
249*0fca6ea1SDimitry Andric    constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
250*0fca6ea1SDimitry Andric                                     Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
251*0fca6ea1SDimitry Andric
252*0fca6ea1SDimitry Andric  template<forward_range R1, forward_range R2,
253*0fca6ea1SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
254*0fca6ea1SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
255*0fca6ea1SDimitry Andric    constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
256*0fca6ea1SDimitry Andric                                     Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++23
257*0fca6ea1SDimitry Andric
25881ad6265SDimitry Andric  template<class I, class O>
25981ad6265SDimitry Andric    using copy_result = in_out_result<I, O>;                                                // since C++20
26081ad6265SDimitry Andric
26181ad6265SDimitry Andric  template<class I, class O>
26281ad6265SDimitry Andric    using copy_n_result = in_out_result<I, O>;                                              // since C++20
26381ad6265SDimitry Andric
26481ad6265SDimitry Andric  template<class I, class O>
26581ad6265SDimitry Andric    using copy_if_result = in_out_result<I, O>;                                             // since C++20
26681ad6265SDimitry Andric
26781ad6265SDimitry Andric  template<class I1, class I2>
26881ad6265SDimitry Andric    using copy_backward_result = in_out_result<I1, I2>;                                     // since C++20
26981ad6265SDimitry Andric
270cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
271cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
272cb14a3feSDimitry Andric    constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});       // since C++23
273cb14a3feSDimitry Andric
274cb14a3feSDimitry Andric  template<input_range R, class T, class Proj = identity>
275cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
276cb14a3feSDimitry Andric    constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});                 // since C++23
277cb14a3feSDimitry Andric
27881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
27981ad6265SDimitry Andric    requires indirectly_copyable<I, O>
28081ad6265SDimitry Andric    constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);            // since C++20
28181ad6265SDimitry Andric
28281ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
28381ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
28481ad6265SDimitry Andric    constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
28581ad6265SDimitry Andric
28681ad6265SDimitry Andric  template<input_iterator I, weakly_incrementable O>
28781ad6265SDimitry Andric    requires indirectly_copyable<I, O>
28881ad6265SDimitry Andric    constexpr ranges::copy_n_result<I, O>
28981ad6265SDimitry Andric      ranges::copy_n(I first, iter_difference_t<I> n, O result);                            // since C++20
29081ad6265SDimitry Andric
29181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
29281ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
29381ad6265SDimitry Andric    requires indirectly_copyable<I, O>
29481ad6265SDimitry Andric    constexpr ranges::copy_if_result<I, O>
29581ad6265SDimitry Andric      ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {});                // since C++20
29681ad6265SDimitry Andric
29781ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
29881ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
29981ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
30081ad6265SDimitry Andric    constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
30181ad6265SDimitry Andric      ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});                          // since C++20
30281ad6265SDimitry Andric
30381ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
30481ad6265SDimitry Andric    requires indirectly_copyable<I1, I2>
30581ad6265SDimitry Andric    constexpr ranges::copy_backward_result<I1, I2>
30681ad6265SDimitry Andric      ranges::copy_backward(I1 first, S1 last, I2 result);                                  // since C++20
30781ad6265SDimitry Andric
30881ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
30981ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, I>
31081ad6265SDimitry Andric    constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
31181ad6265SDimitry Andric      ranges::copy_backward(R&& r, I result);                                               // since C++20
31281ad6265SDimitry Andric
31381ad6265SDimitry Andric  template<class I, class F>
31481ad6265SDimitry Andric    using for_each_result = in_fun_result<I, F>;                                            // since C++20
31581ad6265SDimitry Andric
31681ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
31781ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
31881ad6265SDimitry Andric    constexpr ranges::for_each_result<I, Fun>
31981ad6265SDimitry Andric      ranges::for_each(I first, S last, Fun f, Proj proj = {});                             // since C++20
32081ad6265SDimitry Andric
32181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
32281ad6265SDimitry Andric           indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
32381ad6265SDimitry Andric    constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
32481ad6265SDimitry Andric      ranges::for_each(R&& r, Fun f, Proj proj = {});                                       // since C++20
32581ad6265SDimitry Andric
32681ad6265SDimitry Andric  template<input_iterator I, class Proj = identity,
32781ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
32881ad6265SDimitry Andric    constexpr ranges::for_each_n_result<I, Fun>
32981ad6265SDimitry Andric      ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});           // since C++20
33081ad6265SDimitry Andric
33181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
33281ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
33381ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});      // since C++20
33481ad6265SDimitry Andric
33581ad6265SDimitry Andric  template<input_range R, class Proj = identity,
33681ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
33781ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});                // since C++20
33881ad6265SDimitry Andric
339753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
340753f127fSDimitry Andric          class Proj = identity>
341753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
342753f127fSDimitry Andric    constexpr I
343753f127fSDimitry Andric      ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
344753f127fSDimitry Andric
345753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
346753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
347753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
348753f127fSDimitry Andric      ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
349753f127fSDimitry Andric
350753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
351753f127fSDimitry Andric          class Proj = identity>
352753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
353753f127fSDimitry Andric    constexpr I
354753f127fSDimitry Andric      ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {});                    // since C++20
355753f127fSDimitry Andric
356753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
357753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
358753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
359753f127fSDimitry Andric      ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {});                              // since C++20
360753f127fSDimitry Andric
361753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
362753f127fSDimitry Andric          class Proj = identity>
363753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
364753f127fSDimitry Andric    constexpr I
365753f127fSDimitry Andric      ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
366753f127fSDimitry Andric
367753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
368753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
369753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
370753f127fSDimitry Andric      ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
371753f127fSDimitry Andric
372753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
373753f127fSDimitry Andric          class Proj = identity>
374753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
375753f127fSDimitry Andric    constexpr I
376753f127fSDimitry Andric      ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
377753f127fSDimitry Andric
378753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
379753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
380753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
381753f127fSDimitry Andric      ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
382753f127fSDimitry Andric
383972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
384972a253aSDimitry Andric            indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
38506c3fb27SDimitry Andric    constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});                // since C++20
386972a253aSDimitry Andric
387972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
388972a253aSDimitry Andric            indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
38906c3fb27SDimitry Andric    constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});                          // since C++20
390972a253aSDimitry Andric
391972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
392972a253aSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
39306c3fb27SDimitry Andric    constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});             // since C++20
394972a253aSDimitry Andric
395972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
396972a253aSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
397972a253aSDimitry Andric    constexpr borrowed_iterator_t<R>
39806c3fb27SDimitry Andric      is_heap_until(R&& r, Comp comp = {}, Proj proj = {});                                 // since C++20
399972a253aSDimitry Andric
40081ad6265SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S>
40181ad6265SDimitry Andric    requires permutable<I>
40281ad6265SDimitry Andric    constexpr I ranges::reverse(I first, S last);                                           // since C++20
40381ad6265SDimitry Andric
40481ad6265SDimitry Andric  template<bidirectional_range R>
40581ad6265SDimitry Andric    requires permutable<iterator_t<R>>
40681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);                                // since C++20
40781ad6265SDimitry Andric
40881ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
40981ad6265SDimitry Andric            class Proj = identity>
41081ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
41181ad6265SDimitry Andric    constexpr I
41281ad6265SDimitry Andric      ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});                        // since C++20
41381ad6265SDimitry Andric
41481ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
41581ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
41681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
41781ad6265SDimitry Andric      ranges::sort(R&& r, Comp comp = {}, Proj proj = {});                                  // since C++20
41881ad6265SDimitry Andric
41981ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
42081ad6265SDimitry Andric          class Proj = identity>
42181ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
42281ad6265SDimitry Andric    I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});                 // since C++20
42381ad6265SDimitry Andric
42481ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
42581ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
42681ad6265SDimitry Andric    borrowed_iterator_t<R>
42781ad6265SDimitry Andric      ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});                           // since C++20
42881ad6265SDimitry Andric
429fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
430fcaf7f86SDimitry Andric           class Proj = identity>
431fcaf7f86SDimitry Andric    requires sortable<I, Comp, Proj>
432fcaf7f86SDimitry Andric    constexpr I
433fcaf7f86SDimitry Andric      ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});      // since C++20
434fcaf7f86SDimitry Andric
435fcaf7f86SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
436fcaf7f86SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
437fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
438fcaf7f86SDimitry Andric      ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});    // since C++20
439fcaf7f86SDimitry Andric
44081ad6265SDimitry Andric  template<class T, output_iterator<const T&> O, sentinel_for<O> S>
44181ad6265SDimitry Andric    constexpr O ranges::fill(O first, S last, const T& value);                              // since C++20
44281ad6265SDimitry Andric
44381ad6265SDimitry Andric  template<class T, output_range<const T&> R>
44481ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);                   // since C++20
44581ad6265SDimitry Andric
44681ad6265SDimitry Andric  template<class T, output_iterator<const T&> O>
44781ad6265SDimitry Andric    constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);            // since C++20
44881ad6265SDimitry Andric
449972a253aSDimitry Andric  template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
450972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
45106c3fb27SDimitry Andric    constexpr O generate(O first, S last, F gen);                                           // since C++20
45206c3fb27SDimitry Andric
45306c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Generator>
45406c3fb27SDimitry Andric    void generate(ExecutionPolicy&& exec,
45506c3fb27SDimitry Andric                  ForwardIterator first, ForwardIterator last,
45606c3fb27SDimitry Andric                  Generator gen);                                                           // since C++17
457972a253aSDimitry Andric
458972a253aSDimitry Andric  template<class R, copy_constructible F>
459972a253aSDimitry Andric    requires invocable<F&> && output_range<R, invoke_result_t<F&>>
46006c3fb27SDimitry Andric    constexpr borrowed_iterator_t<R> generate(R&& r, F gen);                                // since C++20
461972a253aSDimitry Andric
462972a253aSDimitry Andric  template<input_or_output_iterator O, copy_constructible F>
463972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
46406c3fb27SDimitry Andric    constexpr O generate_n(O first, iter_difference_t<O> n, F gen);                         // since C++20
46506c3fb27SDimitry Andric
46606c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
46706c3fb27SDimitry Andric    ForwardIterator generate_n(ExecutionPolicy&& exec,
46806c3fb27SDimitry Andric                               ForwardIterator first, Size n, Generator gen);               // since C++17
469972a253aSDimitry Andric
47081ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
47181ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
47281ad6265SDimitry Andric   requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
47381ad6265SDimitry Andric   constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
47481ad6265SDimitry Andric                                Pred pred = {},
47581ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
47681ad6265SDimitry Andric
47781ad6265SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to,
47881ad6265SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
47981ad6265SDimitry Andric   requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
48081ad6265SDimitry Andric   constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
48181ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
48281ad6265SDimitry Andric
48381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
48481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
48581ad6265SDimitry Andric    constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
48681ad6265SDimitry Andric
48781ad6265SDimitry Andric  template<input_range R, class Proj = identity,
48881ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
48981ad6265SDimitry Andric    constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
49081ad6265SDimitry Andric
49181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
49281ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
49381ad6265SDimitry Andric    constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
49481ad6265SDimitry Andric
49581ad6265SDimitry Andric  template<input_range R, class Proj = identity,
49681ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
49781ad6265SDimitry Andric    constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
49881ad6265SDimitry Andric
4995f757f3fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
5005f757f3fSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
5015f757f3fSDimitry Andric    requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
5025f757f3fSDimitry Andric           (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
5035f757f3fSDimitry Andric           indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
5045f757f3fSDimitry Andric    constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
5055f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
5065f757f3fSDimitry Andric
5075f757f3fSDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
5085f757f3fSDimitry Andric          class Proj2 = identity>
5095f757f3fSDimitry Andric    requires (forward_range<R1> || sized_range<R1>) &&
5105f757f3fSDimitry Andric           (forward_range<R2> || sized_range<R2>) &&
5115f757f3fSDimitry Andric           indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
5125f757f3fSDimitry Andric    constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
5135f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
5145f757f3fSDimitry Andric
51581ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
51681ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
51781ad6265SDimitry Andric    constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});             // since C++20
51881ad6265SDimitry Andric
51981ad6265SDimitry Andric  template<input_range R, class Proj = identity,
52081ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
52181ad6265SDimitry Andric    constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});                       // since C++20
52281ad6265SDimitry Andric
52306c3fb27SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
52406c3fb27SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
52506c3fb27SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
52606c3fb27SDimitry Andric    constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
52706c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++23
52806c3fb27SDimitry Andric
52906c3fb27SDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
53006c3fb27SDimitry Andric          class Proj2 = identity>
53106c3fb27SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
53206c3fb27SDimitry Andric    constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
53306c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
53406c3fb27SDimitry Andric
53561cfbce3SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1,
53661cfbce3SDimitry Andric          random_access_iterator I2, sentinel_for<I2> S2,
53761cfbce3SDimitry Andric          class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
53861cfbce3SDimitry Andric    requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
53961cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
54061cfbce3SDimitry Andric    constexpr partial_sort_copy_result<I1, I2>
54161cfbce3SDimitry Andric      partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
54206c3fb27SDimitry Andric                        Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++20
54361cfbce3SDimitry Andric
54461cfbce3SDimitry Andric  template<input_range R1, random_access_range R2, class Comp = ranges::less,
54561cfbce3SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
54661cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
54761cfbce3SDimitry Andric            sortable<iterator_t<R2>, Comp, Proj2> &&
54861cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
54961cfbce3SDimitry Andric                                        projected<iterator_t<R2>, Proj2>>
55061cfbce3SDimitry Andric    constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
55161cfbce3SDimitry Andric      partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
55206c3fb27SDimitry Andric                        Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++20
55361cfbce3SDimitry Andric
55481ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
55581ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
55681ad6265SDimitry Andric    constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {});      // since C++20
55781ad6265SDimitry Andric
55881ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
55981ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
56081ad6265SDimitry Andric    constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {});                // since C++20
56181ad6265SDimitry Andric
56281ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
56381ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
56481ad6265SDimitry Andric    constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});   // since C++20
56581ad6265SDimitry Andric
56681ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
56781ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
56881ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
56981ad6265SDimitry Andric      ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});                       // since C++20
57081ad6265SDimitry Andric
571753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
572753f127fSDimitry Andric          class Proj = identity>
573753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
574753f127fSDimitry Andric    constexpr I
575753f127fSDimitry Andric      ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});          // since C++20
576753f127fSDimitry Andric
577753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
578753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
579753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
580753f127fSDimitry Andric      ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});        // since C++20
581753f127fSDimitry Andric
58281ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
58306c3fb27SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>    // since C++20
58406c3fb27SDimitry Andric    constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
58581ad6265SDimitry Andric
58681ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
58781ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
58881ad6265SDimitry Andric             ranges::less>
58981ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
59081ad6265SDimitry Andric      upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
59181ad6265SDimitry Andric
59281ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
59381ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
59481ad6265SDimitry Andric    constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
59581ad6265SDimitry Andric                                    Proj proj = {});                                        // since C++20
59681ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
59781ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
59881ad6265SDimitry Andric             ranges::less>
59981ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
60081ad6265SDimitry Andric      lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
60181ad6265SDimitry Andric
60281ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
60381ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
60481ad6265SDimitry Andric    constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
60581ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
60681ad6265SDimitry Andric
60781ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
60881ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
60981ad6265SDimitry Andric             ranges::less>
61081ad6265SDimitry Andric    constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
61181ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
612fcaf7f86SDimitry Andric
613fcaf7f86SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
614fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
615fcaf7f86SDimitry Andric    constexpr subrange<I>
61606c3fb27SDimitry Andric      partition(I first, S last, Pred pred, Proj proj = {});                                // since C++20
617fcaf7f86SDimitry Andric
618fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
619fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
620fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
621fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
62206c3fb27SDimitry Andric      partition(R&& r, Pred pred, Proj proj = {});                                          // since C++20
623fcaf7f86SDimitry Andric
624fcaf7f86SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
625fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
626fcaf7f86SDimitry Andric    requires permutable<I>
62706c3fb27SDimitry Andric    subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});               // since C++20
628fcaf7f86SDimitry Andric
629fcaf7f86SDimitry Andric  template<bidirectional_range R, class Proj = identity,
630fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
631fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
63206c3fb27SDimitry Andric    borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});              // since C++20
633fcaf7f86SDimitry Andric
63481ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
63581ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
63681ad6265SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
63781ad6265SDimitry Andric    constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
63881ad6265SDimitry Andric                                       Pred pred = {},
63981ad6265SDimitry Andric                                       Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++20
64081ad6265SDimitry Andric
64181ad6265SDimitry Andric  template<input_range R1, forward_range R2,
64281ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
64381ad6265SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
64481ad6265SDimitry Andric    constexpr borrowed_iterator_t<R1>
64581ad6265SDimitry Andric      ranges::find_first_of(R1&& r1, R2&& r2,
64681ad6265SDimitry Andric                            Pred pred = {},
64781ad6265SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                            // since C++20
64881ad6265SDimitry Andric
64981ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
65081ad6265SDimitry Andric           indirect_binary_predicate<projected<I, Proj>,
65181ad6265SDimitry Andric                                     projected<I, Proj>> Pred = ranges::equal_to>
65206c3fb27SDimitry Andric    constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});     // since C++20
65381ad6265SDimitry Andric
65481ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
65581ad6265SDimitry Andric           indirect_binary_predicate<projected<iterator_t<R>, Proj>,
65681ad6265SDimitry Andric                                     projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
65781ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});  // since C++20
65881ad6265SDimitry Andric
65981ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
66081ad6265SDimitry Andric    requires indirectly_writable<I, const T2&> &&
66181ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
66281ad6265SDimitry Andric    constexpr I
66381ad6265SDimitry Andric      ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});   // since C++20
66481ad6265SDimitry Andric
66581ad6265SDimitry Andric  template<input_range R, class T1, class T2, class Proj = identity>
66681ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T2&> &&
66781ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
66881ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
66981ad6265SDimitry Andric      ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});             // since C++20
67081ad6265SDimitry Andric
67181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
67281ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
67381ad6265SDimitry Andric    requires indirectly_writable<I, const T&>
67481ad6265SDimitry Andric    constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
67581ad6265SDimitry Andric
67681ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity,
67781ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
67881ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T&>
67981ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
68081ad6265SDimitry Andric      ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});                     // since C++20
68181ad6265SDimitry Andric
68261cfbce3SDimitry Andric  template<class T, class Proj = identity,
68361cfbce3SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
68461cfbce3SDimitry Andric    constexpr const T&
68561cfbce3SDimitry Andric      ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {});          // since C++20
68661cfbce3SDimitry Andric
68781ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
68881ad6265SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
68981ad6265SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>,
69081ad6265SDimitry Andric                                      projected<I2, Proj2>> Comp = ranges::less>
69181ad6265SDimitry Andric    constexpr bool
69281ad6265SDimitry Andric      ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
69381ad6265SDimitry Andric                                      Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});          // since C++20
69481ad6265SDimitry Andric
69581ad6265SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
69681ad6265SDimitry Andric           class Proj2 = identity,
69781ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
69881ad6265SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
69981ad6265SDimitry Andric    constexpr bool
70081ad6265SDimitry Andric      ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
70181ad6265SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                          // since C++20
70281ad6265SDimitry Andric
70381ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
70481ad6265SDimitry Andric    requires indirectly_movable<I1, I2>
70581ad6265SDimitry Andric    constexpr ranges::move_backward_result<I1, I2>
70681ad6265SDimitry Andric      ranges::move_backward(I1 first, S1 last, I2 result);                                          // since C++20
70781ad6265SDimitry Andric
70881ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
70981ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, I>
71081ad6265SDimitry Andric    constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
71181ad6265SDimitry Andric      ranges::move_backward(R&& r, I result);                                                       // since C++20
71281ad6265SDimitry Andric
71381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
71481ad6265SDimitry Andric    requires indirectly_movable<I, O>
71581ad6265SDimitry Andric    constexpr ranges::move_result<I, O>
71681ad6265SDimitry Andric      ranges::move(I first, S last, O result);                                                      // since C++20
71781ad6265SDimitry Andric
71881ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
71981ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, O>
72081ad6265SDimitry Andric    constexpr ranges::move_result<borrowed_iterator_t<R>, O>
72181ad6265SDimitry Andric      ranges::move(R&& r, O result);                                                                // since C++20
72281ad6265SDimitry Andric
723fcaf7f86SDimitry Andric  template<class I, class O1, class O2>
724fcaf7f86SDimitry Andric      using partition_copy_result = in_out_out_result<I, O1, O2>;                                   // since C++20
725fcaf7f86SDimitry Andric
726fcaf7f86SDimitry Andric  template<input_iterator I, sentinel_for<I> S,
727fcaf7f86SDimitry Andric          weakly_incrementable O1, weakly_incrementable O2,
728fcaf7f86SDimitry Andric          class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
729fcaf7f86SDimitry Andric    requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
730fcaf7f86SDimitry Andric    constexpr partition_copy_result<I, O1, O2>
731fcaf7f86SDimitry Andric      partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
73206c3fb27SDimitry Andric                    Proj proj = {});                                                                // since C++20
733fcaf7f86SDimitry Andric
734fcaf7f86SDimitry Andric  template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
735fcaf7f86SDimitry Andric          class Proj = identity,
736fcaf7f86SDimitry Andric          indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
737fcaf7f86SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O1> &&
738fcaf7f86SDimitry Andric            indirectly_copyable<iterator_t<R>, O2>
739fcaf7f86SDimitry Andric    constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
74006c3fb27SDimitry Andric      partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});                  // since C++20
741fcaf7f86SDimitry Andric
742fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
743fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
74406c3fb27SDimitry Andric    constexpr I partition_point(I first, S last, Pred pred, Proj proj = {});                        // since C++20
745fcaf7f86SDimitry Andric
746fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
747fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
748fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
74906c3fb27SDimitry Andric      partition_point(R&& r, Pred pred, Proj proj = {});                                            // since C++20
750fcaf7f86SDimitry Andric
751753f127fSDimitry Andric  template<class I1, class I2, class O>
752753f127fSDimitry Andric    using merge_result = in_in_out_result<I1, I2, O>;                                               // since C++20
753753f127fSDimitry Andric
754753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
755753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
756753f127fSDimitry Andric           class Proj2 = identity>
757753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758753f127fSDimitry Andric    constexpr merge_result<I1, I2, O>
759753f127fSDimitry Andric      merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
760753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
761753f127fSDimitry Andric
762753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
763753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
764753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765753f127fSDimitry Andric    constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
766753f127fSDimitry Andric      merge(R1&& r1, R2&& r2, O result,
767753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
768753f127fSDimitry Andric
769753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
770753f127fSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
771753f127fSDimitry Andric    constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});          // since C++20
772753f127fSDimitry Andric
773753f127fSDimitry Andric  template<forward_range R, class T, class Proj = identity>
774753f127fSDimitry Andric    requires permutable<iterator_t<R>> &&
775753f127fSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
776753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
777753f127fSDimitry Andric      ranges::remove(R&& r, const T& value, Proj proj = {});                                        // since C++20
778753f127fSDimitry Andric
779753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
780753f127fSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
781753f127fSDimitry Andric    constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});            // since C++20
782753f127fSDimitry Andric
783753f127fSDimitry Andric  template<forward_range R, class Proj = identity,
784753f127fSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
785753f127fSDimitry Andric    requires permutable<iterator_t<R>>
786753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
787753f127fSDimitry Andric      ranges::remove_if(R&& r, Pred pred, Proj proj = {});                                          // since C++20
788753f127fSDimitry Andric
789753f127fSDimitry Andric  template<class I, class O>
790753f127fSDimitry Andric    using set_difference_result = in_out_result<I, O>;                                              // since C++20
791753f127fSDimitry Andric
792753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
793753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
794753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
795753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
796753f127fSDimitry Andric    constexpr set_difference_result<I1, O>
797753f127fSDimitry Andric      set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
798753f127fSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
799753f127fSDimitry Andric
800753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
801753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
802753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
803753f127fSDimitry Andric    constexpr set_difference_result<borrowed_iterator_t<R1>, O>
804753f127fSDimitry Andric      set_difference(R1&& r1, R2&& r2, O result,
805753f127fSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
806753f127fSDimitry Andric
807753f127fSDimitry Andric  template<class I1, class I2, class O>
808753f127fSDimitry Andric    using set_intersection_result = in_in_out_result<I1, I2, O>;                                    // since C++20
809753f127fSDimitry Andric
810753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
811753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
812753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
813753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
814753f127fSDimitry Andric    constexpr set_intersection_result<I1, I2, O>
815753f127fSDimitry Andric      set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
816753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
817753f127fSDimitry Andric
818753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
819753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
820753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
821753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
822753f127fSDimitry Andric    constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
823753f127fSDimitry Andric      set_intersection(R1&& r1, R2&& r2, O result,
824753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
825753f127fSDimitry Andric
826753f127fSDimitry Andric  template <class _InIter, class _OutIter>
827753f127fSDimitry Andric  using reverse_copy_result = in_out_result<_InIter, _OutIter>;                                     // since C++20
828753f127fSDimitry Andric
829753f127fSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
830753f127fSDimitry Andric    requires indirectly_copyable<I, O>
831753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<I, O>
832753f127fSDimitry Andric      ranges::reverse_copy(I first, S last, O result);                                              // since C++20
833753f127fSDimitry Andric
834753f127fSDimitry Andric  template<bidirectional_range R, weakly_incrementable O>
835753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
836753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
837753f127fSDimitry Andric      ranges::reverse_copy(R&& r, O result);                                                        // since C++20
838753f127fSDimitry Andric
83961cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S>
84061cfbce3SDimitry Andric    constexpr subrange<I> rotate(I first, I middle, S last);                                        // since C++20
84161cfbce3SDimitry Andric
84261cfbce3SDimitry Andric  template<forward_range R>
84361cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
84406c3fb27SDimitry Andric    constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);                           // since C++20
84561cfbce3SDimitry Andric
846753f127fSDimitry Andric  template <class _InIter, class _OutIter>
847753f127fSDimitry Andric  using rotate_copy_result = in_out_result<_InIter, _OutIter>;                                      // since C++20
848753f127fSDimitry Andric
849753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
850753f127fSDimitry Andric    requires indirectly_copyable<I, O>
851753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<I, O>
852753f127fSDimitry Andric      ranges::rotate_copy(I first, I middle, S last, O result);                                     // since C++20
853753f127fSDimitry Andric
854753f127fSDimitry Andric  template<forward_range R, weakly_incrementable O>
855753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
856753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
857753f127fSDimitry Andric      ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);                                   // since C++20
858753f127fSDimitry Andric
85961cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
86061cfbce3SDimitry Andric    requires (forward_iterator<I> || random_access_iterator<O>) &&
86161cfbce3SDimitry Andric            indirectly_copyable<I, O> &&
86261cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
86306c3fb27SDimitry Andric    O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g);                              // since C++20
86461cfbce3SDimitry Andric
86561cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Gen>
86661cfbce3SDimitry Andric    requires (forward_range<R> || random_access_iterator<O>) &&
86761cfbce3SDimitry Andric            indirectly_copyable<iterator_t<R>, O> &&
86861cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
86906c3fb27SDimitry Andric    O sample(R&& r, O out, range_difference_t<R> n, Gen&& g);                                       // since C++20
87061cfbce3SDimitry Andric
871fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Gen>
872fcaf7f86SDimitry Andric    requires permutable<I> &&
873fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
87406c3fb27SDimitry Andric    I shuffle(I first, S last, Gen&& g);                                                            // since C++20
875fcaf7f86SDimitry Andric
876fcaf7f86SDimitry Andric  template<random_access_range R, class Gen>
877fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>> &&
878fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
87906c3fb27SDimitry Andric    borrowed_iterator_t<R> shuffle(R&& r, Gen&& g);                                                 // since C++20
880fcaf7f86SDimitry Andric
881753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
88261cfbce3SDimitry Andric         sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
88361cfbce3SDimitry Andric         indirect_equivalence_relation<projected<I1, Proj1>,
88461cfbce3SDimitry Andric                                       projected<I2, Proj2>> Pred = ranges::equal_to>
88561cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
88661cfbce3SDimitry Andric                                        Pred pred = {},
88706c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
88861cfbce3SDimitry Andric
88961cfbce3SDimitry Andric  template<forward_range R1, forward_range R2,
89061cfbce3SDimitry Andric         class Proj1 = identity, class Proj2 = identity,
89161cfbce3SDimitry Andric         indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
89261cfbce3SDimitry Andric                                       projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
89361cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
89406c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
89561cfbce3SDimitry Andric
89661cfbce3SDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
897753f127fSDimitry Andric           sentinel_for<I2> S2, class Pred = ranges::equal_to,
898753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
899753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
900753f127fSDimitry Andric    constexpr subrange<I1>
901753f127fSDimitry Andric      ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
902753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
903753f127fSDimitry Andric
904753f127fSDimitry Andric  template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
905753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
906753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
907753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
908753f127fSDimitry Andric      ranges::search(R1&& r1, R2&& r2, Pred pred = {},
909753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
910753f127fSDimitry Andric
911753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T,
912753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj = identity>
913753f127fSDimitry Andric    requires indirectly_comparable<I, const T*, Pred, Proj>
914753f127fSDimitry Andric    constexpr subrange<I>
915753f127fSDimitry Andric      ranges::search_n(I first, S last, iter_difference_t<I> count,
916753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
917753f127fSDimitry Andric
918753f127fSDimitry Andric  template<forward_range R, class T, class Pred = ranges::equal_to,
919753f127fSDimitry Andric           class Proj = identity>
920753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
921753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
922753f127fSDimitry Andric      ranges::search_n(R&& r, range_difference_t<R> count,
923753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
924753f127fSDimitry Andric
925cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
926cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
927cb14a3feSDimitry Andric    constexpr auto ranges::fold_left(I first, S last, T init, F f);                                 // since C++23
928cb14a3feSDimitry Andric
929cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
930cb14a3feSDimitry Andric    constexpr auto fold_left(R&& r, T init, F f);                                                   // since C++23
931cb14a3feSDimitry Andric
932cb14a3feSDimitry Andric  template<class I, class T>
933cb14a3feSDimitry Andric    using fold_left_with_iter_result = in_value_result<I, T>;                                       // since C++23
934cb14a3feSDimitry Andric
935cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
936cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
937cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(I first, S last, T init, F f);                          // since C++23
938cb14a3feSDimitry Andric
939cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
940cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(R&& r, T init, F f);                                    // since C++23
941cb14a3feSDimitry Andric
942753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
943753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
944753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
945753f127fSDimitry Andric    constexpr subrange<I1>
946753f127fSDimitry Andric      ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
947753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
948753f127fSDimitry Andric
949753f127fSDimitry Andric  template<forward_range R1, forward_range R2,
950753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
951753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
952753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
953753f127fSDimitry Andric      ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
954753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
955753f127fSDimitry Andric
956753f127fSDimitry Andric  template<class I1, class I2, class O>
957753f127fSDimitry Andric    using set_symmetric_difference_result = in_in_out_result<I1, I2, O>;                            // since C++20
958753f127fSDimitry Andric
959753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
960753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
961753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
962753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
963753f127fSDimitry Andric    constexpr set_symmetric_difference_result<I1, I2, O>
964753f127fSDimitry Andric      set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
965753f127fSDimitry Andric                               Comp comp = {}, Proj1 proj1 = {},
966753f127fSDimitry Andric                               Proj2 proj2 = {});                                                   // since C++20
967753f127fSDimitry Andric
968753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
969753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
970753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
971753f127fSDimitry Andric    constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
972753f127fSDimitry Andric                                                      borrowed_iterator_t<R2>, O>
973753f127fSDimitry Andric      set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
974753f127fSDimitry Andric                               Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
97581ad6265SDimitry Andric
976fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
977fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
978fcaf7f86SDimitry Andric    constexpr subrange<I>
979fcaf7f86SDimitry Andric      equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});                 // since C++20
980fcaf7f86SDimitry Andric
981fcaf7f86SDimitry Andric  template<forward_range R, class T, class Proj = identity,
982fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
983fcaf7f86SDimitry Andric             ranges::less>
984fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
985fcaf7f86SDimitry Andric      equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});                           // since C++20
986fcaf7f86SDimitry Andric
987fcaf7f86SDimitry Andric  template<class I1, class I2, class O>
988fcaf7f86SDimitry Andric    using set_union_result = in_in_out_result<I1, I2, O>;                                           // since C++20
989fcaf7f86SDimitry Andric
990fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
991fcaf7f86SDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
992fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity>
993fcaf7f86SDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
994fcaf7f86SDimitry Andric    constexpr set_union_result<I1, I2, O>
995fcaf7f86SDimitry Andric      set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
996fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
997fcaf7f86SDimitry Andric
998fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
999fcaf7f86SDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1000fcaf7f86SDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1001fcaf7f86SDimitry Andric    constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1002fcaf7f86SDimitry Andric      set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1003fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
1004fcaf7f86SDimitry Andric
1005fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
1007fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1008fcaf7f86SDimitry Andric             ranges::less>
1009fcaf7f86SDimitry Andric    constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
101006c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
1011fcaf7f86SDimitry Andric
1012fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
1013fcaf7f86SDimitry Andric           class Proj2 = identity,
1014fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1015fcaf7f86SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1016fcaf7f86SDimitry Andric    constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
101706c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
101861cfbce3SDimitry Andric
101961cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
102061cfbce3SDimitry Andric           class Proj = identity>
102161cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
102206c3fb27SDimitry Andric    I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});                    // since C++20
102361cfbce3SDimitry Andric
102461cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
102561cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
102661cfbce3SDimitry Andric    borrowed_iterator_t<R>
102761cfbce3SDimitry Andric      inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
102806c3fb27SDimitry Andric                    Proj proj = {});                                                               // since C++20
102961cfbce3SDimitry Andric
103061cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
103161cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
103206c3fb27SDimitry Andric    constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {});                    // since C++20
103361cfbce3SDimitry Andric
103461cfbce3SDimitry Andric  template<forward_range R, class Proj = identity,
103561cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
103661cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
103761cfbce3SDimitry Andric    constexpr borrowed_subrange_t<R>
103806c3fb27SDimitry Andric      unique(R&& r, C comp = {}, Proj proj = {});                                                  // since C++20
103961cfbce3SDimitry Andric
104061cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
104161cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
104261cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
104361cfbce3SDimitry Andric             (forward_iterator<I> ||
104461cfbce3SDimitry Andric              (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
104561cfbce3SDimitry Andric              indirectly_copyable_storable<I, O>)
104661cfbce3SDimitry Andric    constexpr unique_copy_result<I, O>
104706c3fb27SDimitry Andric      unique_copy(I first, S last, O result, C comp = {}, Proj proj = {});                         // since C++20
104861cfbce3SDimitry Andric
104961cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
105061cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
105161cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
105261cfbce3SDimitry Andric             (forward_iterator<iterator_t<R>> ||
105361cfbce3SDimitry Andric              (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
105461cfbce3SDimitry Andric              indirectly_copyable_storable<iterator_t<R>, O>)
105561cfbce3SDimitry Andric    constexpr unique_copy_result<borrowed_iterator_t<R>, O>
105606c3fb27SDimitry Andric      unique_copy(R&& r, O result, C comp = {}, Proj proj = {});                                   // since C++20
105761cfbce3SDimitry Andric
105861cfbce3SDimitry Andric  template<class I, class O>
105906c3fb27SDimitry Andric      using remove_copy_result = in_out_result<I, O>;                                              // since C++20
106061cfbce3SDimitry Andric
106161cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
106261cfbce3SDimitry Andric           class Proj = identity>
106361cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
106461cfbce3SDimitry Andric    constexpr remove_copy_result<I, O>
106506c3fb27SDimitry Andric      remove_copy(I first, S last, O result, const T& value, Proj proj = {});                      // since C++20
106661cfbce3SDimitry Andric
106761cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class T, class Proj = identity>
106861cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
106961cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
107061cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T*>
107161cfbce3SDimitry Andric    constexpr remove_copy_result<borrowed_iterator_t<R>, O>
107206c3fb27SDimitry Andric      remove_copy(R&& r, O result, const T& value, Proj proj = {});                                // since C++20
107361cfbce3SDimitry Andric
107461cfbce3SDimitry Andric  template<class I, class O>
107506c3fb27SDimitry Andric      using remove_copy_if_result = in_out_result<I, O>;                                           // since C++20
107661cfbce3SDimitry Andric
107761cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
107861cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
107961cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
108061cfbce3SDimitry Andric    constexpr remove_copy_if_result<I, O>
108106c3fb27SDimitry Andric      remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});                        // since C++20
108261cfbce3SDimitry Andric
108361cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
108461cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
108561cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
108661cfbce3SDimitry Andric    constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
108706c3fb27SDimitry Andric      remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});                                  // since C++20
108861cfbce3SDimitry Andric
108961cfbce3SDimitry Andric  template<class I, class O>
109006c3fb27SDimitry Andric      using replace_copy_result = in_out_result<I, O>;                                             // since C++20
109161cfbce3SDimitry Andric
109261cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2,
109361cfbce3SDimitry Andric           output_iterator<const T2&> O, class Proj = identity>
109461cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
109561cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
109661cfbce3SDimitry Andric    constexpr replace_copy_result<I, O>
109761cfbce3SDimitry Andric      replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
109806c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
109961cfbce3SDimitry Andric
110061cfbce3SDimitry Andric  template<input_range R, class T1, class T2, output_iterator<const T2&> O,
110161cfbce3SDimitry Andric           class Proj = identity>
110261cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
110361cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
110461cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T1*>
110561cfbce3SDimitry Andric    constexpr replace_copy_result<borrowed_iterator_t<R>, O>
110661cfbce3SDimitry Andric      replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
110706c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
110861cfbce3SDimitry Andric
110961cfbce3SDimitry Andric  template<class I, class O>
111006c3fb27SDimitry Andric      using replace_copy_if_result = in_out_result<I, O>;                                          // since C++20
111161cfbce3SDimitry Andric
111261cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
111361cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
111461cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
111561cfbce3SDimitry Andric    constexpr replace_copy_if_result<I, O>
111661cfbce3SDimitry Andric      replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
111706c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
111861cfbce3SDimitry Andric
111961cfbce3SDimitry Andric  template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
112061cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
112161cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
112261cfbce3SDimitry Andric    constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
112361cfbce3SDimitry Andric      replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
112406c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
112561cfbce3SDimitry Andric
112661cfbce3SDimitry Andric  template<class I>
112706c3fb27SDimitry Andric    using prev_permutation_result = in_found_result<I>;                                            // since C++20
112861cfbce3SDimitry Andric
112961cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
113061cfbce3SDimitry Andric           class Proj = identity>
113161cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
113261cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<I>
113306c3fb27SDimitry Andric      ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
113461cfbce3SDimitry Andric
113561cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
113661cfbce3SDimitry Andric           class Proj = identity>
113761cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
113861cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
113906c3fb27SDimitry Andric      ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
114061cfbce3SDimitry Andric
114161cfbce3SDimitry Andric  template<class I>
114206c3fb27SDimitry Andric    using next_permutation_result = in_found_result<I>;                                            // since C++20
114361cfbce3SDimitry Andric
114461cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
114561cfbce3SDimitry Andric           class Proj = identity>
114661cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
114761cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<I>
114806c3fb27SDimitry Andric      ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
114961cfbce3SDimitry Andric
115061cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
115161cfbce3SDimitry Andric           class Proj = identity>
115261cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
115361cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
115406c3fb27SDimitry Andric      ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
115561cfbce3SDimitry Andric
115604eeddc0SDimitry Andric}
115704eeddc0SDimitry Andric
115861cfbce3SDimitry Andrictemplate <class InputIterator, class Predicate>
11590b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11600b57cec5SDimitry Andric    all_of(InputIterator first, InputIterator last, Predicate pred);
11610b57cec5SDimitry Andric
11620b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11630b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11640b57cec5SDimitry Andric    any_of(InputIterator first, InputIterator last, Predicate pred);
11650b57cec5SDimitry Andric
11660b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11670b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11680b57cec5SDimitry Andric    none_of(InputIterator first, InputIterator last, Predicate pred);
11690b57cec5SDimitry Andric
11700b57cec5SDimitry Andrictemplate <class InputIterator, class Function>
11710b57cec5SDimitry Andric    constexpr Function          // constexpr in C++20
11720b57cec5SDimitry Andric    for_each(InputIterator first, InputIterator last, Function f);
11730b57cec5SDimitry Andric
11740b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class Function>
11750b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11760b57cec5SDimitry Andric    for_each_n(InputIterator first, Size n, Function f); // C++17
11770b57cec5SDimitry Andric
11780b57cec5SDimitry Andrictemplate <class InputIterator, class T>
11790b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11800b57cec5SDimitry Andric    find(InputIterator first, InputIterator last, const T& value);
11810b57cec5SDimitry Andric
11820b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11830b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11840b57cec5SDimitry Andric    find_if(InputIterator first, InputIterator last, Predicate pred);
11850b57cec5SDimitry Andric
11860b57cec5SDimitry Andrictemplate<class InputIterator, class Predicate>
1187e8d8bef9SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11880b57cec5SDimitry Andric    find_if_not(InputIterator first, InputIterator last, Predicate pred);
11890b57cec5SDimitry Andric
11900b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1191e8d8bef9SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11920b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
11930b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2);
11940b57cec5SDimitry Andric
11950b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1196e8d8bef9SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11970b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
11980b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
11990b57cec5SDimitry Andric
12000b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
12010b57cec5SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
12020b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
12030b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2);
12040b57cec5SDimitry Andric
12050b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12060b57cec5SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
12070b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
12080b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
12090b57cec5SDimitry Andric
12100b57cec5SDimitry Andrictemplate <class ForwardIterator>
12110b57cec5SDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
12120b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last);
12130b57cec5SDimitry Andric
12140b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
12150b57cec5SDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
12160b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
12170b57cec5SDimitry Andric
12180b57cec5SDimitry Andrictemplate <class InputIterator, class T>
12190b57cec5SDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type  // constexpr in C++20
12200b57cec5SDimitry Andric    count(InputIterator first, InputIterator last, const T& value);
12210b57cec5SDimitry Andric
12220b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
12230b57cec5SDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
12240b57cec5SDimitry Andric    count_if(InputIterator first, InputIterator last, Predicate pred);
12250b57cec5SDimitry Andric
12260b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12270b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
12280b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
12290b57cec5SDimitry Andric
12300b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12310b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
12320b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12330b57cec5SDimitry Andric             InputIterator2 first2, InputIterator2 last2); // **C++14**
12340b57cec5SDimitry Andric
12350b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12360b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
12370b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12380b57cec5SDimitry Andric             InputIterator2 first2, BinaryPredicate pred);
12390b57cec5SDimitry Andric
12400b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12410b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
12420b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12430b57cec5SDimitry Andric             InputIterator2 first2, InputIterator2 last2,
12440b57cec5SDimitry Andric             BinaryPredicate pred); // **C++14**
12450b57cec5SDimitry Andric
12460b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12470b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12480b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
12490b57cec5SDimitry Andric
12500b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12510b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12520b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12530b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2); // **C++14**
12540b57cec5SDimitry Andric
12550b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12560b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12570b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12580b57cec5SDimitry Andric          InputIterator2 first2, BinaryPredicate pred);
12590b57cec5SDimitry Andric
12600b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12610b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12620b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12630b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2,
12640b57cec5SDimitry Andric          BinaryPredicate pred); // **C++14**
12650b57cec5SDimitry Andric
12660b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
12670b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12680b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12690b57cec5SDimitry Andric                   ForwardIterator2 first2);
12700b57cec5SDimitry Andric
12710b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
12720b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12730b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12740b57cec5SDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
12750b57cec5SDimitry Andric
12760b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12770b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12780b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12790b57cec5SDimitry Andric                   ForwardIterator2 first2, BinaryPredicate pred);
12800b57cec5SDimitry Andric
12810b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12820b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12830b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12840b57cec5SDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2,
12850b57cec5SDimitry Andric                   BinaryPredicate pred);  // **C++14**
12860b57cec5SDimitry Andric
12870b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
12880b57cec5SDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
12890b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
12900b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2);
12910b57cec5SDimitry Andric
12920b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12930b57cec5SDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
12940b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
12950b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
12960b57cec5SDimitry Andric
12970b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T>
12980b57cec5SDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
12990b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
13000b57cec5SDimitry Andric
13010b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate>
13020b57cec5SDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
13030b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last,
13040b57cec5SDimitry Andric             Size count, const T& value, BinaryPredicate pred);
13050b57cec5SDimitry Andric
13060b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1307480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13080b57cec5SDimitry Andric    copy(InputIterator first, InputIterator last, OutputIterator result);
13090b57cec5SDimitry Andric
13100b57cec5SDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate>
1311480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13120b57cec5SDimitry Andric    copy_if(InputIterator first, InputIterator last,
13130b57cec5SDimitry Andric            OutputIterator result, Predicate pred);
13140b57cec5SDimitry Andric
13150b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator>
1316480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13170b57cec5SDimitry Andric    copy_n(InputIterator first, Size n, OutputIterator result);
13180b57cec5SDimitry Andric
13190b57cec5SDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2>
1320480093f4SDimitry Andric    constexpr BidirectionalIterator2      // constexpr in C++20
13210b57cec5SDimitry Andric    copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
13220b57cec5SDimitry Andric                  BidirectionalIterator2 result);
13230b57cec5SDimitry Andric
132481ad6265SDimitry Andric// [alg.move], move
132581ad6265SDimitry Andrictemplate<class InputIterator, class OutputIterator>
132681ad6265SDimitry Andric    constexpr OutputIterator move(InputIterator first, InputIterator last,
132781ad6265SDimitry Andric                                OutputIterator result);
132881ad6265SDimitry Andric
132981ad6265SDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2>
133081ad6265SDimitry Andric    constexpr BidirectionalIterator2
133181ad6265SDimitry Andric    move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
133281ad6265SDimitry Andric                  BidirectionalIterator2 result);
133381ad6265SDimitry Andric
13340b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1335e8d8bef9SDimitry Andric    constexpr ForwardIterator2    // constexpr in C++20
13360b57cec5SDimitry Andric    swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
13370b57cec5SDimitry Andric
133881ad6265SDimitry Andricnamespace ranges {
133981ad6265SDimitry Andric    template<class I1, class I2>
134081ad6265SDimitry Andric    using swap_ranges_result = in_in_result<I1, I2>;
134181ad6265SDimitry Andric
134281ad6265SDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
134381ad6265SDimitry Andric        requires indirectly_swappable<I1, I2>
134481ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<I1, I2>
134581ad6265SDimitry Andric        swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
134681ad6265SDimitry Andric
134781ad6265SDimitry Andrictemplate<input_range R1, input_range R2>
134881ad6265SDimitry Andric        requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
134981ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
135081ad6265SDimitry Andric        swap_ranges(R1&& r1, R2&& r2);
135181ad6265SDimitry Andric}
135281ad6265SDimitry Andric
13530b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1354e8d8bef9SDimitry Andric    constexpr void                // constexpr in C++20
13550b57cec5SDimitry Andric    iter_swap(ForwardIterator1 a, ForwardIterator2 b);
13560b57cec5SDimitry Andric
13570b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation>
13580b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13590b57cec5SDimitry Andric    transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
13600b57cec5SDimitry Andric
13610b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
13620b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13630b57cec5SDimitry Andric    transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
13640b57cec5SDimitry Andric              OutputIterator result, BinaryOperation binary_op);
13650b57cec5SDimitry Andric
13660b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
13670b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13680b57cec5SDimitry Andric    replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
13690b57cec5SDimitry Andric
13700b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate, class T>
13710b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13720b57cec5SDimitry Andric    replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
13730b57cec5SDimitry Andric
13740b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
13750b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13760b57cec5SDimitry Andric    replace_copy(InputIterator first, InputIterator last, OutputIterator result,
13770b57cec5SDimitry Andric                 const T& old_value, const T& new_value);
13780b57cec5SDimitry Andric
13790b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T>
13800b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13810b57cec5SDimitry Andric    replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
13820b57cec5SDimitry Andric
13830b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
13840b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13850b57cec5SDimitry Andric    fill(ForwardIterator first, ForwardIterator last, const T& value);
13860b57cec5SDimitry Andric
13870b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class T>
13880b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13890b57cec5SDimitry Andric    fill_n(OutputIterator first, Size n, const T& value);
13900b57cec5SDimitry Andric
13910b57cec5SDimitry Andrictemplate <class ForwardIterator, class Generator>
13920b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13930b57cec5SDimitry Andric    generate(ForwardIterator first, ForwardIterator last, Generator gen);
13940b57cec5SDimitry Andric
13950b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class Generator>
13960b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13970b57cec5SDimitry Andric    generate_n(OutputIterator first, Size n, Generator gen);
13980b57cec5SDimitry Andric
13990b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
14000b57cec5SDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
14010b57cec5SDimitry Andric    remove(ForwardIterator first, ForwardIterator last, const T& value);
14020b57cec5SDimitry Andric
14030b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
14040b57cec5SDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
14050b57cec5SDimitry Andric    remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
14060b57cec5SDimitry Andric
14070b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
14080b57cec5SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
14090b57cec5SDimitry Andric    remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
14100b57cec5SDimitry Andric
14110b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate>
14120b57cec5SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
14130b57cec5SDimitry Andric    remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
14140b57cec5SDimitry Andric
14150b57cec5SDimitry Andrictemplate <class ForwardIterator>
1416e8d8bef9SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
14170b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last);
14180b57cec5SDimitry Andric
14190b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1420e8d8bef9SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
14210b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
14220b57cec5SDimitry Andric
14230b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1424e8d8bef9SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
14250b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result);
14260b57cec5SDimitry Andric
14270b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate>
1428e8d8bef9SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
14290b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
14300b57cec5SDimitry Andric
14310b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1432e8d8bef9SDimitry Andric    constexpr void               // constexpr in C++20
14330b57cec5SDimitry Andric    reverse(BidirectionalIterator first, BidirectionalIterator last);
14340b57cec5SDimitry Andric
14350b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator>
14360b57cec5SDimitry Andric    constexpr OutputIterator       // constexpr in C++20
14370b57cec5SDimitry Andric    reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
14380b57cec5SDimitry Andric
14390b57cec5SDimitry Andrictemplate <class ForwardIterator>
1440e8d8bef9SDimitry Andric    constexpr ForwardIterator      // constexpr in C++20
14410b57cec5SDimitry Andric    rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
14420b57cec5SDimitry Andric
14430b57cec5SDimitry Andrictemplate <class ForwardIterator, class OutputIterator>
1444e8d8bef9SDimitry Andric    constexpr OutputIterator       // constexpr in C++20
14450b57cec5SDimitry Andric    rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
14460b57cec5SDimitry Andric
14470b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
14480b57cec5SDimitry Andric    void
14490b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
14500b57cec5SDimitry Andric
14510b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator>
14520b57cec5SDimitry Andric    void
14530b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
14540b57cec5SDimitry Andric                   RandomNumberGenerator& rand);  // deprecated in C++14, removed in C++17
14550b57cec5SDimitry Andric
14560b57cec5SDimitry Andrictemplate<class PopulationIterator, class SampleIterator,
14570b57cec5SDimitry Andric         class Distance, class UniformRandomBitGenerator>
14580b57cec5SDimitry Andric    SampleIterator sample(PopulationIterator first, PopulationIterator last,
14590b57cec5SDimitry Andric                          SampleIterator out, Distance n,
14600b57cec5SDimitry Andric                          UniformRandomBitGenerator&& g); // C++17
14610b57cec5SDimitry Andric
14620b57cec5SDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator>
14630b57cec5SDimitry Andric    void shuffle(RandomAccessIterator first, RandomAccessIterator last,
14640b57cec5SDimitry Andric                 UniformRandomNumberGenerator&& g);
14650b57cec5SDimitry Andric
1466e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1467e8d8bef9SDimitry Andric  constexpr ForwardIterator
1468e8d8bef9SDimitry Andric    shift_left(ForwardIterator first, ForwardIterator last,
1469e8d8bef9SDimitry Andric               typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1470e8d8bef9SDimitry Andric
1471e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1472e8d8bef9SDimitry Andric  constexpr ForwardIterator
1473e8d8bef9SDimitry Andric    shift_right(ForwardIterator first, ForwardIterator last,
1474e8d8bef9SDimitry Andric                typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1475e8d8bef9SDimitry Andric
14760b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
14770b57cec5SDimitry Andric    constexpr bool  // constexpr in C++20
14780b57cec5SDimitry Andric    is_partitioned(InputIterator first, InputIterator last, Predicate pred);
14790b57cec5SDimitry Andric
14800b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
1481e8d8bef9SDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
14820b57cec5SDimitry Andric    partition(ForwardIterator first, ForwardIterator last, Predicate pred);
14830b57cec5SDimitry Andric
14840b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator1,
14850b57cec5SDimitry Andric          class OutputIterator2, class Predicate>
14860b57cec5SDimitry Andric    constexpr pair<OutputIterator1, OutputIterator2>   // constexpr in C++20
14870b57cec5SDimitry Andric    partition_copy(InputIterator first, InputIterator last,
14880b57cec5SDimitry Andric                   OutputIterator1 out_true, OutputIterator2 out_false,
14890b57cec5SDimitry Andric                   Predicate pred);
14900b57cec5SDimitry Andric
14910b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
14920b57cec5SDimitry Andric    ForwardIterator
14930b57cec5SDimitry Andric    stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
14940b57cec5SDimitry Andric
14950b57cec5SDimitry Andrictemplate<class ForwardIterator, class Predicate>
14960b57cec5SDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
14970b57cec5SDimitry Andric    partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
14980b57cec5SDimitry Andric
14990b57cec5SDimitry Andrictemplate <class ForwardIterator>
15000b57cec5SDimitry Andric    constexpr bool  // constexpr in C++20
15010b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last);
15020b57cec5SDimitry Andric
15030b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1504e8d8bef9SDimitry Andric    constexpr bool  // constexpr in C++20
15050b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
15060b57cec5SDimitry Andric
15070b57cec5SDimitry Andrictemplate<class ForwardIterator>
15080b57cec5SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
15090b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last);
15100b57cec5SDimitry Andric
15110b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
15120b57cec5SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
15130b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
15140b57cec5SDimitry Andric
15150b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1516fe6060f1SDimitry Andric    constexpr void               // constexpr in C++20
15170b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last);
15180b57cec5SDimitry Andric
15190b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1520fe6060f1SDimitry Andric    constexpr void               // constexpr in C++20
15210b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
15220b57cec5SDimitry Andric
15230b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
15240b57cec5SDimitry Andric    void
15250b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last);
15260b57cec5SDimitry Andric
15270b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
15280b57cec5SDimitry Andric    void
15290b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
15300b57cec5SDimitry Andric
15310b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1532fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15330b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
15340b57cec5SDimitry Andric
15350b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1536fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15370b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
15380b57cec5SDimitry Andric
15390b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator>
1540fe6060f1SDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
15410b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15420b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last);
15430b57cec5SDimitry Andric
15440b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare>
1545fe6060f1SDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
15460b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15470b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
15480b57cec5SDimitry Andric
15490b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1550fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15510b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
15520b57cec5SDimitry Andric
15530b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1554fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15550b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
15560b57cec5SDimitry Andric
15570b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15580b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15590b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
15600b57cec5SDimitry Andric
15610b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15620b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15630b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15640b57cec5SDimitry Andric
15650b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15660b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15670b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
15680b57cec5SDimitry Andric
15690b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15700b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15710b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15720b57cec5SDimitry Andric
15730b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15740b57cec5SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
15750b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value);
15760b57cec5SDimitry Andric
15770b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15780b57cec5SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
15790b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15800b57cec5SDimitry Andric
15810b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15820b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15830b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value);
15840b57cec5SDimitry Andric
15850b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15860b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15870b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15880b57cec5SDimitry Andric
15890b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1590e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15910b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
15920b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result);
15930b57cec5SDimitry Andric
15940b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1595e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15960b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
15970b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
15980b57cec5SDimitry Andric
15990b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
16000b57cec5SDimitry Andric    void
16010b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
16020b57cec5SDimitry Andric
16030b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
16040b57cec5SDimitry Andric    void
16050b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
16060b57cec5SDimitry Andric
16070b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
16080b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
16090b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
16100b57cec5SDimitry Andric
16110b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
16120b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
16130b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
16140b57cec5SDimitry Andric
16150b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1616e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
16170b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
16180b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16190b57cec5SDimitry Andric
16200b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1621e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
16220b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
16230b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16240b57cec5SDimitry Andric
16250b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
16260b57cec5SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16270b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
16280b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16290b57cec5SDimitry Andric
16300b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
16310b57cec5SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16320b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
16330b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16340b57cec5SDimitry Andric
16350b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1636e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16370b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16380b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16390b57cec5SDimitry Andric
16400b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1641e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16420b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16430b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16440b57cec5SDimitry Andric
16450b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1646e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16470b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16480b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16490b57cec5SDimitry Andric
16500b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1651e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16520b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16530b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16540b57cec5SDimitry Andric
16550b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1656fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16570b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last);
16580b57cec5SDimitry Andric
16590b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1660fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16610b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16620b57cec5SDimitry Andric
16630b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1664fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16650b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last);
16660b57cec5SDimitry Andric
16670b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1668fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16690b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16700b57cec5SDimitry Andric
16710b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1672fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16730b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last);
16740b57cec5SDimitry Andric
16750b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1676fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16770b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16780b57cec5SDimitry Andric
16790b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1680fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16810b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last);
16820b57cec5SDimitry Andric
16830b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1684fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16850b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16860b57cec5SDimitry Andric
16870b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
16880b57cec5SDimitry Andric    constexpr bool   // constexpr in C++20
16890b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last);
16900b57cec5SDimitry Andric
16910b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
16920b57cec5SDimitry Andric    constexpr bool   // constexpr in C++20
16930b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
16940b57cec5SDimitry Andric
16950b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
16960b57cec5SDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
16970b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
16980b57cec5SDimitry Andric
16990b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
17000b57cec5SDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
17010b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
17020b57cec5SDimitry Andric
17030b57cec5SDimitry Andrictemplate <class ForwardIterator>
1704e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1705e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last);
17060b57cec5SDimitry Andric
17070b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1708e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1709e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last, Compare comp);
17100b57cec5SDimitry Andric
17110b57cec5SDimitry Andrictemplate <class T>
1712e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1713e8d8bef9SDimitry Andric    min(const T& a, const T& b);
17140b57cec5SDimitry Andric
17150b57cec5SDimitry Andrictemplate <class T, class Compare>
1716e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1717e8d8bef9SDimitry Andric    min(const T& a, const T& b, Compare comp);
17180b57cec5SDimitry Andric
17190b57cec5SDimitry Andrictemplate<class T>
1720e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1721e8d8bef9SDimitry Andric    min(initializer_list<T> t);
17220b57cec5SDimitry Andric
17230b57cec5SDimitry Andrictemplate<class T, class Compare>
1724e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1725e8d8bef9SDimitry Andric    min(initializer_list<T> t, Compare comp);
17260b57cec5SDimitry Andric
17270b57cec5SDimitry Andrictemplate<class T>
17280b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi);               // C++17
17290b57cec5SDimitry Andric
17300b57cec5SDimitry Andrictemplate<class T, class Compare>
17310b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
17320b57cec5SDimitry Andric
17330b57cec5SDimitry Andrictemplate <class ForwardIterator>
1734e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1735e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last);
17360b57cec5SDimitry Andric
17370b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1738e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1739e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last, Compare comp);
17400b57cec5SDimitry Andric
17410b57cec5SDimitry Andrictemplate <class T>
1742e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1743e8d8bef9SDimitry Andric    max(const T& a, const T& b);
17440b57cec5SDimitry Andric
17450b57cec5SDimitry Andrictemplate <class T, class Compare>
1746e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1747e8d8bef9SDimitry Andric    max(const T& a, const T& b, Compare comp);
17480b57cec5SDimitry Andric
17490b57cec5SDimitry Andrictemplate<class T>
1750e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1751e8d8bef9SDimitry Andric    max(initializer_list<T> t);
17520b57cec5SDimitry Andric
17530b57cec5SDimitry Andrictemplate<class T, class Compare>
1754e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1755e8d8bef9SDimitry Andric    max(initializer_list<T> t, Compare comp);
17560b57cec5SDimitry Andric
17570b57cec5SDimitry Andrictemplate<class ForwardIterator>
1758e8d8bef9SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1759e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last);
17600b57cec5SDimitry Andric
17610b57cec5SDimitry Andrictemplate<class ForwardIterator, class Compare>
1762e8d8bef9SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1763e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
17640b57cec5SDimitry Andric
17650b57cec5SDimitry Andrictemplate<class T>
1766e8d8bef9SDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1767e8d8bef9SDimitry Andric    minmax(const T& a, const T& b);
17680b57cec5SDimitry Andric
17690b57cec5SDimitry Andrictemplate<class T, class Compare>
1770e8d8bef9SDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1771e8d8bef9SDimitry Andric    minmax(const T& a, const T& b, Compare comp);
17720b57cec5SDimitry Andric
17730b57cec5SDimitry Andrictemplate<class T>
1774e8d8bef9SDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1775e8d8bef9SDimitry Andric    minmax(initializer_list<T> t);
17760b57cec5SDimitry Andric
17770b57cec5SDimitry Andrictemplate<class T, class Compare>
1778e8d8bef9SDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1779e8d8bef9SDimitry Andric    minmax(initializer_list<T> t, Compare comp);
17800b57cec5SDimitry Andric
17810b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
17820b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
17830b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
17840b57cec5SDimitry Andric
17850b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
17860b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
17870b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
17880b57cec5SDimitry Andric                            InputIterator2 first2, InputIterator2 last2, Compare comp);
17890b57cec5SDimitry Andric
179006c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2, class Cmp>
179106c3fb27SDimitry Andric    constexpr auto
179206c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
179306c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2,
179406c3fb27SDimitry Andric                                      Cmp comp)
179506c3fb27SDimitry Andric      -> decltype(comp(*b1, *b2));                                                        // since C++20
179606c3fb27SDimitry Andric
179706c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2>
179806c3fb27SDimitry Andric    constexpr auto
179906c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
180006c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2);      // since C++20
180106c3fb27SDimitry Andric
18020b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1803e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
18040b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last);
18050b57cec5SDimitry Andric
18060b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1807e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
18080b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
18090b57cec5SDimitry Andric
18100b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1811e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
18120b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
18130b57cec5SDimitry Andric
18140b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1815e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
18160b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
18170b57cec5SDimitry Andric}  // std
18180b57cec5SDimitry Andric
18190b57cec5SDimitry Andric*/
18200b57cec5SDimitry Andric
18210b57cec5SDimitry Andric#include <__config>
18220b57cec5SDimitry Andric
1823fe6060f1SDimitry Andric#include <__algorithm/adjacent_find.h>
1824fe6060f1SDimitry Andric#include <__algorithm/all_of.h>
1825fe6060f1SDimitry Andric#include <__algorithm/any_of.h>
1826fe6060f1SDimitry Andric#include <__algorithm/binary_search.h>
1827fe6060f1SDimitry Andric#include <__algorithm/copy.h>
1828fe6060f1SDimitry Andric#include <__algorithm/copy_backward.h>
1829fe6060f1SDimitry Andric#include <__algorithm/copy_if.h>
1830fe6060f1SDimitry Andric#include <__algorithm/copy_n.h>
1831fe6060f1SDimitry Andric#include <__algorithm/count.h>
1832fe6060f1SDimitry Andric#include <__algorithm/count_if.h>
1833fe6060f1SDimitry Andric#include <__algorithm/equal.h>
1834fe6060f1SDimitry Andric#include <__algorithm/equal_range.h>
1835fe6060f1SDimitry Andric#include <__algorithm/fill.h>
183604eeddc0SDimitry Andric#include <__algorithm/fill_n.h>
1837fe6060f1SDimitry Andric#include <__algorithm/find.h>
1838fe6060f1SDimitry Andric#include <__algorithm/find_end.h>
1839fe6060f1SDimitry Andric#include <__algorithm/find_first_of.h>
1840fe6060f1SDimitry Andric#include <__algorithm/find_if.h>
1841fe6060f1SDimitry Andric#include <__algorithm/find_if_not.h>
1842fe6060f1SDimitry Andric#include <__algorithm/for_each.h>
1843fe6060f1SDimitry Andric#include <__algorithm/generate.h>
184404eeddc0SDimitry Andric#include <__algorithm/generate_n.h>
1845fe6060f1SDimitry Andric#include <__algorithm/includes.h>
1846fe6060f1SDimitry Andric#include <__algorithm/inplace_merge.h>
1847fe6060f1SDimitry Andric#include <__algorithm/is_heap.h>
1848fe6060f1SDimitry Andric#include <__algorithm/is_heap_until.h>
1849fe6060f1SDimitry Andric#include <__algorithm/is_partitioned.h>
1850fe6060f1SDimitry Andric#include <__algorithm/is_permutation.h>
1851fe6060f1SDimitry Andric#include <__algorithm/is_sorted.h>
1852fe6060f1SDimitry Andric#include <__algorithm/is_sorted_until.h>
1853fe6060f1SDimitry Andric#include <__algorithm/iter_swap.h>
1854fe6060f1SDimitry Andric#include <__algorithm/lexicographical_compare.h>
1855fe6060f1SDimitry Andric#include <__algorithm/lower_bound.h>
1856fe6060f1SDimitry Andric#include <__algorithm/make_heap.h>
1857fe6060f1SDimitry Andric#include <__algorithm/max.h>
1858fe6060f1SDimitry Andric#include <__algorithm/max_element.h>
1859fe6060f1SDimitry Andric#include <__algorithm/merge.h>
1860fe6060f1SDimitry Andric#include <__algorithm/min.h>
1861fe6060f1SDimitry Andric#include <__algorithm/min_element.h>
1862fe6060f1SDimitry Andric#include <__algorithm/minmax.h>
1863fe6060f1SDimitry Andric#include <__algorithm/minmax_element.h>
1864fe6060f1SDimitry Andric#include <__algorithm/mismatch.h>
1865fe6060f1SDimitry Andric#include <__algorithm/move.h>
1866fe6060f1SDimitry Andric#include <__algorithm/move_backward.h>
1867fe6060f1SDimitry Andric#include <__algorithm/next_permutation.h>
1868fe6060f1SDimitry Andric#include <__algorithm/none_of.h>
1869fe6060f1SDimitry Andric#include <__algorithm/nth_element.h>
1870fe6060f1SDimitry Andric#include <__algorithm/partial_sort.h>
1871fe6060f1SDimitry Andric#include <__algorithm/partial_sort_copy.h>
1872fe6060f1SDimitry Andric#include <__algorithm/partition.h>
1873fe6060f1SDimitry Andric#include <__algorithm/partition_copy.h>
1874fe6060f1SDimitry Andric#include <__algorithm/partition_point.h>
1875fe6060f1SDimitry Andric#include <__algorithm/pop_heap.h>
1876fe6060f1SDimitry Andric#include <__algorithm/prev_permutation.h>
1877fe6060f1SDimitry Andric#include <__algorithm/push_heap.h>
1878*0fca6ea1SDimitry Andric#include <__algorithm/remove.h>
1879*0fca6ea1SDimitry Andric#include <__algorithm/remove_copy.h>
1880*0fca6ea1SDimitry Andric#include <__algorithm/remove_copy_if.h>
1881*0fca6ea1SDimitry Andric#include <__algorithm/remove_if.h>
1882*0fca6ea1SDimitry Andric#include <__algorithm/replace.h>
1883*0fca6ea1SDimitry Andric#include <__algorithm/replace_copy.h>
1884*0fca6ea1SDimitry Andric#include <__algorithm/replace_copy_if.h>
1885*0fca6ea1SDimitry Andric#include <__algorithm/replace_if.h>
1886*0fca6ea1SDimitry Andric#include <__algorithm/reverse.h>
1887*0fca6ea1SDimitry Andric#include <__algorithm/reverse_copy.h>
1888*0fca6ea1SDimitry Andric#include <__algorithm/rotate.h>
1889*0fca6ea1SDimitry Andric#include <__algorithm/rotate_copy.h>
1890*0fca6ea1SDimitry Andric#include <__algorithm/search.h>
1891*0fca6ea1SDimitry Andric#include <__algorithm/search_n.h>
1892*0fca6ea1SDimitry Andric#include <__algorithm/set_difference.h>
1893*0fca6ea1SDimitry Andric#include <__algorithm/set_intersection.h>
1894*0fca6ea1SDimitry Andric#include <__algorithm/set_symmetric_difference.h>
1895*0fca6ea1SDimitry Andric#include <__algorithm/set_union.h>
1896*0fca6ea1SDimitry Andric#include <__algorithm/shuffle.h>
1897*0fca6ea1SDimitry Andric#include <__algorithm/sort.h>
1898*0fca6ea1SDimitry Andric#include <__algorithm/sort_heap.h>
1899*0fca6ea1SDimitry Andric#include <__algorithm/stable_partition.h>
1900*0fca6ea1SDimitry Andric#include <__algorithm/stable_sort.h>
1901*0fca6ea1SDimitry Andric#include <__algorithm/swap_ranges.h>
1902*0fca6ea1SDimitry Andric#include <__algorithm/transform.h>
1903*0fca6ea1SDimitry Andric#include <__algorithm/unique.h>
1904*0fca6ea1SDimitry Andric#include <__algorithm/unique_copy.h>
1905*0fca6ea1SDimitry Andric#include <__algorithm/upper_bound.h>
1906*0fca6ea1SDimitry Andric
1907*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 17
1908*0fca6ea1SDimitry Andric#  include <__algorithm/clamp.h>
1909*0fca6ea1SDimitry Andric#  include <__algorithm/for_each_n.h>
1910*0fca6ea1SDimitry Andric#  include <__algorithm/pstl.h>
1911*0fca6ea1SDimitry Andric#  include <__algorithm/sample.h>
1912*0fca6ea1SDimitry Andric#endif // _LIBCPP_STD_VER >= 17
1913*0fca6ea1SDimitry Andric
1914*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 20
1915*0fca6ea1SDimitry Andric#  include <__algorithm/in_found_result.h>
1916*0fca6ea1SDimitry Andric#  include <__algorithm/in_fun_result.h>
1917*0fca6ea1SDimitry Andric#  include <__algorithm/in_in_out_result.h>
1918*0fca6ea1SDimitry Andric#  include <__algorithm/in_in_result.h>
1919*0fca6ea1SDimitry Andric#  include <__algorithm/in_out_out_result.h>
1920*0fca6ea1SDimitry Andric#  include <__algorithm/in_out_result.h>
1921*0fca6ea1SDimitry Andric#  include <__algorithm/lexicographical_compare_three_way.h>
1922*0fca6ea1SDimitry Andric#  include <__algorithm/min_max_result.h>
192381ad6265SDimitry Andric#  include <__algorithm/ranges_adjacent_find.h>
192481ad6265SDimitry Andric#  include <__algorithm/ranges_all_of.h>
192581ad6265SDimitry Andric#  include <__algorithm/ranges_any_of.h>
192681ad6265SDimitry Andric#  include <__algorithm/ranges_binary_search.h>
192761cfbce3SDimitry Andric#  include <__algorithm/ranges_clamp.h>
1928cb14a3feSDimitry Andric#  include <__algorithm/ranges_contains.h>
192981ad6265SDimitry Andric#  include <__algorithm/ranges_copy.h>
193081ad6265SDimitry Andric#  include <__algorithm/ranges_copy_backward.h>
193181ad6265SDimitry Andric#  include <__algorithm/ranges_copy_if.h>
193281ad6265SDimitry Andric#  include <__algorithm/ranges_copy_n.h>
193381ad6265SDimitry Andric#  include <__algorithm/ranges_count.h>
193481ad6265SDimitry Andric#  include <__algorithm/ranges_count_if.h>
193581ad6265SDimitry Andric#  include <__algorithm/ranges_equal.h>
1936fcaf7f86SDimitry Andric#  include <__algorithm/ranges_equal_range.h>
193781ad6265SDimitry Andric#  include <__algorithm/ranges_fill.h>
193881ad6265SDimitry Andric#  include <__algorithm/ranges_fill_n.h>
193981ad6265SDimitry Andric#  include <__algorithm/ranges_find.h>
1940753f127fSDimitry Andric#  include <__algorithm/ranges_find_end.h>
194181ad6265SDimitry Andric#  include <__algorithm/ranges_find_first_of.h>
194281ad6265SDimitry Andric#  include <__algorithm/ranges_find_if.h>
194381ad6265SDimitry Andric#  include <__algorithm/ranges_find_if_not.h>
194481ad6265SDimitry Andric#  include <__algorithm/ranges_for_each.h>
194581ad6265SDimitry Andric#  include <__algorithm/ranges_for_each_n.h>
1946972a253aSDimitry Andric#  include <__algorithm/ranges_generate.h>
1947972a253aSDimitry Andric#  include <__algorithm/ranges_generate_n.h>
1948fcaf7f86SDimitry Andric#  include <__algorithm/ranges_includes.h>
194961cfbce3SDimitry Andric#  include <__algorithm/ranges_inplace_merge.h>
1950972a253aSDimitry Andric#  include <__algorithm/ranges_is_heap.h>
1951972a253aSDimitry Andric#  include <__algorithm/ranges_is_heap_until.h>
195281ad6265SDimitry Andric#  include <__algorithm/ranges_is_partitioned.h>
195361cfbce3SDimitry Andric#  include <__algorithm/ranges_is_permutation.h>
195481ad6265SDimitry Andric#  include <__algorithm/ranges_is_sorted.h>
195581ad6265SDimitry Andric#  include <__algorithm/ranges_is_sorted_until.h>
195681ad6265SDimitry Andric#  include <__algorithm/ranges_lexicographical_compare.h>
195781ad6265SDimitry Andric#  include <__algorithm/ranges_lower_bound.h>
1958753f127fSDimitry Andric#  include <__algorithm/ranges_make_heap.h>
195981ad6265SDimitry Andric#  include <__algorithm/ranges_max.h>
196081ad6265SDimitry Andric#  include <__algorithm/ranges_max_element.h>
1961753f127fSDimitry Andric#  include <__algorithm/ranges_merge.h>
196281ad6265SDimitry Andric#  include <__algorithm/ranges_min.h>
196381ad6265SDimitry Andric#  include <__algorithm/ranges_min_element.h>
196481ad6265SDimitry Andric#  include <__algorithm/ranges_minmax.h>
196581ad6265SDimitry Andric#  include <__algorithm/ranges_minmax_element.h>
196681ad6265SDimitry Andric#  include <__algorithm/ranges_mismatch.h>
196781ad6265SDimitry Andric#  include <__algorithm/ranges_move.h>
196881ad6265SDimitry Andric#  include <__algorithm/ranges_move_backward.h>
196961cfbce3SDimitry Andric#  include <__algorithm/ranges_next_permutation.h>
197081ad6265SDimitry Andric#  include <__algorithm/ranges_none_of.h>
1971753f127fSDimitry Andric#  include <__algorithm/ranges_nth_element.h>
1972fcaf7f86SDimitry Andric#  include <__algorithm/ranges_partial_sort.h>
197361cfbce3SDimitry Andric#  include <__algorithm/ranges_partial_sort_copy.h>
1974fcaf7f86SDimitry Andric#  include <__algorithm/ranges_partition.h>
1975fcaf7f86SDimitry Andric#  include <__algorithm/ranges_partition_copy.h>
1976fcaf7f86SDimitry Andric#  include <__algorithm/ranges_partition_point.h>
1977753f127fSDimitry Andric#  include <__algorithm/ranges_pop_heap.h>
197861cfbce3SDimitry Andric#  include <__algorithm/ranges_prev_permutation.h>
1979753f127fSDimitry Andric#  include <__algorithm/ranges_push_heap.h>
1980753f127fSDimitry Andric#  include <__algorithm/ranges_remove.h>
198161cfbce3SDimitry Andric#  include <__algorithm/ranges_remove_copy.h>
198261cfbce3SDimitry Andric#  include <__algorithm/ranges_remove_copy_if.h>
1983753f127fSDimitry Andric#  include <__algorithm/ranges_remove_if.h>
198481ad6265SDimitry Andric#  include <__algorithm/ranges_replace.h>
198561cfbce3SDimitry Andric#  include <__algorithm/ranges_replace_copy.h>
198661cfbce3SDimitry Andric#  include <__algorithm/ranges_replace_copy_if.h>
198781ad6265SDimitry Andric#  include <__algorithm/ranges_replace_if.h>
198881ad6265SDimitry Andric#  include <__algorithm/ranges_reverse.h>
1989753f127fSDimitry Andric#  include <__algorithm/ranges_reverse_copy.h>
199061cfbce3SDimitry Andric#  include <__algorithm/ranges_rotate.h>
1991753f127fSDimitry Andric#  include <__algorithm/ranges_rotate_copy.h>
199261cfbce3SDimitry Andric#  include <__algorithm/ranges_sample.h>
1993753f127fSDimitry Andric#  include <__algorithm/ranges_search.h>
1994753f127fSDimitry Andric#  include <__algorithm/ranges_search_n.h>
1995753f127fSDimitry Andric#  include <__algorithm/ranges_set_difference.h>
1996753f127fSDimitry Andric#  include <__algorithm/ranges_set_intersection.h>
1997753f127fSDimitry Andric#  include <__algorithm/ranges_set_symmetric_difference.h>
1998fcaf7f86SDimitry Andric#  include <__algorithm/ranges_set_union.h>
1999fcaf7f86SDimitry Andric#  include <__algorithm/ranges_shuffle.h>
200081ad6265SDimitry Andric#  include <__algorithm/ranges_sort.h>
2001753f127fSDimitry Andric#  include <__algorithm/ranges_sort_heap.h>
2002fcaf7f86SDimitry Andric#  include <__algorithm/ranges_stable_partition.h>
200381ad6265SDimitry Andric#  include <__algorithm/ranges_stable_sort.h>
200481ad6265SDimitry Andric#  include <__algorithm/ranges_swap_ranges.h>
200581ad6265SDimitry Andric#  include <__algorithm/ranges_transform.h>
200661cfbce3SDimitry Andric#  include <__algorithm/ranges_unique.h>
200761cfbce3SDimitry Andric#  include <__algorithm/ranges_unique_copy.h>
200881ad6265SDimitry Andric#  include <__algorithm/ranges_upper_bound.h>
2009fe6060f1SDimitry Andric#  include <__algorithm/shift_left.h>
2010fe6060f1SDimitry Andric#  include <__algorithm/shift_right.h>
2011*0fca6ea1SDimitry Andric#endif
2012*0fca6ea1SDimitry Andric
2013*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 23
2014*0fca6ea1SDimitry Andric#  include <__algorithm/fold.h>
2015*0fca6ea1SDimitry Andric#  include <__algorithm/ranges_contains_subrange.h>
2016*0fca6ea1SDimitry Andric#  include <__algorithm/ranges_ends_with.h>
2017*0fca6ea1SDimitry Andric#  include <__algorithm/ranges_find_last.h>
2018*0fca6ea1SDimitry Andric#  include <__algorithm/ranges_starts_with.h>
2019*0fca6ea1SDimitry Andric#endif // _LIBCPP_STD_VER >= 23
2020*0fca6ea1SDimitry Andric
2021*0fca6ea1SDimitry Andric#include <version>
20220b57cec5SDimitry Andric
202381ad6265SDimitry Andric// standard-mandated includes
2024bdd1243dSDimitry Andric
2025bdd1243dSDimitry Andric// [algorithm.syn]
202681ad6265SDimitry Andric#include <initializer_list>
202781ad6265SDimitry Andric
20280b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20290b57cec5SDimitry Andric#  pragma GCC system_header
20300b57cec5SDimitry Andric#endif
20310b57cec5SDimitry Andric
2032*0fca6ea1SDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2033*0fca6ea1SDimitry Andric#  include <execution>
2034*0fca6ea1SDimitry Andric#endif
2035*0fca6ea1SDimitry Andric
2036bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2037bdd1243dSDimitry Andric#  include <atomic>
203806c3fb27SDimitry Andric#  include <bit>
2039bdd1243dSDimitry Andric#  include <concepts>
204006c3fb27SDimitry Andric#  include <cstdlib>
2041bdd1243dSDimitry Andric#  include <cstring>
2042bdd1243dSDimitry Andric#  include <iterator>
2043bdd1243dSDimitry Andric#  include <memory>
2044bdd1243dSDimitry Andric#  include <stdexcept>
204506c3fb27SDimitry Andric#  include <type_traits>
2046bdd1243dSDimitry Andric#  include <utility>
2047bdd1243dSDimitry Andric#endif
2048bdd1243dSDimitry Andric
20490b57cec5SDimitry Andric#endif // _LIBCPP_ALGORITHM
2050