xref: /freebsd/contrib/llvm-project/libcxx/include/algorithm (revision cb14a3fe5122c879eae1fb480ed7ce82a699ddb6)
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
45*cb14a3feSDimitry Andric  template <class I, class T>
46*cb14a3feSDimitry Andric    struct in_value_result;              // since C++23
47*cb14a3feSDimitry 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
10581ad6265SDimitry Andric  template<class T, class Proj = identity,
10681ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
10781ad6265SDimitry Andric    constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
10881ad6265SDimitry Andric
10981ad6265SDimitry Andric  template<copyable T, class Proj = identity,
11081ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
11181ad6265SDimitry Andric    constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
11281ad6265SDimitry Andric
11381ad6265SDimitry Andric template<input_range R, class Proj = identity,
11481ad6265SDimitry Andric          indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
11581ad6265SDimitry Andric   requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
11681ad6265SDimitry Andric   constexpr range_value_t<R>
11781ad6265SDimitry Andric     min(R&& r, Comp comp = {}, Proj proj = {});                                                          // since C++20
11881ad6265SDimitry Andric
11981ad6265SDimitry Andric  template<class T, class Proj = identity,
12081ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
12181ad6265SDimitry Andric    constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
12281ad6265SDimitry Andric
12381ad6265SDimitry Andric  template<copyable T, class Proj = identity,
12481ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
12581ad6265SDimitry Andric    constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
12681ad6265SDimitry Andric
12781ad6265SDimitry Andric  template<input_range R, class Proj = identity,
12881ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
12981ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
13081ad6265SDimitry Andric    constexpr range_value_t<R>
13181ad6265SDimitry Andric      max(R&& r, Comp comp = {}, Proj proj = {});                                                         // since C++20
13281ad6265SDimitry Andric
13381ad6265SDimitry Andric  template<class I, class O>
13481ad6265SDimitry Andric    using unary_transform_result = in_out_result<I, O>;                                                   // since C++20
13581ad6265SDimitry Andric
13681ad6265SDimitry Andric  template<class I1, class I2, class O>
13781ad6265SDimitry Andric    using binary_transform_result = in_in_out_result<I1, I2, O>;                                          // since C++20
13881ad6265SDimitry Andric
13981ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
14081ad6265SDimitry Andric           copy_constructible F, class Proj = identity>
14181ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
14281ad6265SDimitry Andric    constexpr ranges::unary_transform_result<I, O>
14381ad6265SDimitry Andric      transform(I first1, S last1, O result, F op, Proj proj = {});                                       // since C++20
14481ad6265SDimitry Andric
14581ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, copy_constructible F,
14681ad6265SDimitry Andric           class Proj = identity>
14781ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
14881ad6265SDimitry Andric    constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
14981ad6265SDimitry Andric      transform(R&& r, O result, F op, Proj proj = {});                                                   // since C++20
15081ad6265SDimitry Andric
15181ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
15281ad6265SDimitry Andric           weakly_incrementable O, copy_constructible F, class Proj1 = identity,
15381ad6265SDimitry Andric           class Proj2 = identity>
15481ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
15581ad6265SDimitry Andric                                           projected<I2, Proj2>>>
15681ad6265SDimitry Andric    constexpr ranges::binary_transform_result<I1, I2, O>
15781ad6265SDimitry Andric      transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
15881ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
15981ad6265SDimitry Andric
16081ad6265SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
16181ad6265SDimitry Andric           copy_constructible F, class Proj1 = identity, class Proj2 = identity>
16281ad6265SDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
16381ad6265SDimitry Andric                                           projected<iterator_t<R2>, Proj2>>>
16481ad6265SDimitry Andric    constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
16581ad6265SDimitry Andric      transform(R1&& r1, R2&& r2, O result,
16681ad6265SDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
16781ad6265SDimitry Andric
16881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
16981ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
17081ad6265SDimitry Andric    constexpr iter_difference_t<I>
17181ad6265SDimitry Andric      count(I first, S last, const T& value, Proj proj = {});                                             // since C++20
17281ad6265SDimitry Andric
17381ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity>
17481ad6265SDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
17581ad6265SDimitry Andric    constexpr range_difference_t<R>
17681ad6265SDimitry Andric      count(R&& r, const T& value, Proj proj = {});                                                       // since C++20
17781ad6265SDimitry Andric
17881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
17981ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
18081ad6265SDimitry Andric    constexpr iter_difference_t<I>
18181ad6265SDimitry Andric      count_if(I first, S last, Pred pred, Proj proj = {});                                               // since C++20
18281ad6265SDimitry Andric
18381ad6265SDimitry Andric  template<input_range R, class Proj = identity,
18481ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
18581ad6265SDimitry Andric    constexpr range_difference_t<R>
18681ad6265SDimitry Andric      count_if(R&& r, Pred pred, Proj proj = {});                                                         // since C++20
18781ad6265SDimitry Andric
18881ad6265SDimitry Andric  template<class T>
18981ad6265SDimitry Andric  using minmax_result = min_max_result<T>;
19081ad6265SDimitry Andric
19181ad6265SDimitry Andric  template<class T, class Proj = identity,
19281ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
19381ad6265SDimitry Andric    constexpr ranges::minmax_result<const T&>
19481ad6265SDimitry Andric      minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});                                     // since C++20
19581ad6265SDimitry Andric
19681ad6265SDimitry Andric  template<copyable T, class Proj = identity,
19781ad6265SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
19881ad6265SDimitry Andric    constexpr ranges::minmax_result<T>
19981ad6265SDimitry Andric      minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {});                                      // since C++20
20081ad6265SDimitry Andric
20181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
20281ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
20381ad6265SDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
20481ad6265SDimitry Andric    constexpr ranges::minmax_result<range_value_t<R>>
20581ad6265SDimitry Andric      minmax(R&& r, Comp comp = {}, Proj proj = {});                                                      // since C++20
20681ad6265SDimitry Andric
20781ad6265SDimitry Andric  template<class I>
20881ad6265SDimitry Andric  using minmax_element_result = min_max_result<I>;
20981ad6265SDimitry Andric
21081ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
21181ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
21281ad6265SDimitry Andric    constexpr ranges::minmax_element_result<I>
21381ad6265SDimitry Andric      minmax_element(I first, S last, Comp comp = {}, Proj proj = {});                                    // since C++20
21481ad6265SDimitry Andric
21581ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
21681ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
21781ad6265SDimitry Andric    constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
21881ad6265SDimitry Andric      minmax_element(R&& r, Comp comp = {}, Proj proj = {});                                              // since C++20
21981ad6265SDimitry Andric
22081ad6265SDimitry Andric  template<class I, class O>
22181ad6265SDimitry Andric    using copy_result = in_out_result<I, O>;                                                // since C++20
22281ad6265SDimitry Andric
22381ad6265SDimitry Andric  template<class I, class O>
22481ad6265SDimitry Andric    using copy_n_result = in_out_result<I, O>;                                              // since C++20
22581ad6265SDimitry Andric
22681ad6265SDimitry Andric  template<class I, class O>
22781ad6265SDimitry Andric    using copy_if_result = in_out_result<I, O>;                                             // since C++20
22881ad6265SDimitry Andric
22981ad6265SDimitry Andric  template<class I1, class I2>
23081ad6265SDimitry Andric    using copy_backward_result = in_out_result<I1, I2>;                                     // since C++20
23181ad6265SDimitry Andric
232*cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
233*cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
234*cb14a3feSDimitry Andric    constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});       // since C++23
235*cb14a3feSDimitry Andric
236*cb14a3feSDimitry Andric  template<input_range R, class T, class Proj = identity>
237*cb14a3feSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
238*cb14a3feSDimitry Andric    constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});                 // since C++23
239*cb14a3feSDimitry Andric
24081ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
24181ad6265SDimitry Andric    requires indirectly_copyable<I, O>
24281ad6265SDimitry Andric    constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);            // since C++20
24381ad6265SDimitry Andric
24481ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
24581ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
24681ad6265SDimitry Andric    constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
24781ad6265SDimitry Andric
24881ad6265SDimitry Andric  template<input_iterator I, weakly_incrementable O>
24981ad6265SDimitry Andric    requires indirectly_copyable<I, O>
25081ad6265SDimitry Andric    constexpr ranges::copy_n_result<I, O>
25181ad6265SDimitry Andric      ranges::copy_n(I first, iter_difference_t<I> n, O result);                            // since C++20
25281ad6265SDimitry Andric
25381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
25481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
25581ad6265SDimitry Andric    requires indirectly_copyable<I, O>
25681ad6265SDimitry Andric    constexpr ranges::copy_if_result<I, O>
25781ad6265SDimitry Andric      ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {});                // since C++20
25881ad6265SDimitry Andric
25981ad6265SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
26081ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
26181ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
26281ad6265SDimitry Andric    constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
26381ad6265SDimitry Andric      ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});                          // since C++20
26481ad6265SDimitry Andric
26581ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
26681ad6265SDimitry Andric    requires indirectly_copyable<I1, I2>
26781ad6265SDimitry Andric    constexpr ranges::copy_backward_result<I1, I2>
26881ad6265SDimitry Andric      ranges::copy_backward(I1 first, S1 last, I2 result);                                  // since C++20
26981ad6265SDimitry Andric
27081ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
27181ad6265SDimitry Andric    requires indirectly_copyable<iterator_t<R>, I>
27281ad6265SDimitry Andric    constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
27381ad6265SDimitry Andric      ranges::copy_backward(R&& r, I result);                                               // since C++20
27481ad6265SDimitry Andric
27581ad6265SDimitry Andric  template<class I, class F>
27681ad6265SDimitry Andric    using for_each_result = in_fun_result<I, F>;                                            // since C++20
27781ad6265SDimitry Andric
27881ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
27981ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
28081ad6265SDimitry Andric    constexpr ranges::for_each_result<I, Fun>
28181ad6265SDimitry Andric      ranges::for_each(I first, S last, Fun f, Proj proj = {});                             // since C++20
28281ad6265SDimitry Andric
28381ad6265SDimitry Andric  template<input_range R, class Proj = identity,
28481ad6265SDimitry Andric           indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
28581ad6265SDimitry Andric    constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
28681ad6265SDimitry Andric      ranges::for_each(R&& r, Fun f, Proj proj = {});                                       // since C++20
28781ad6265SDimitry Andric
28881ad6265SDimitry Andric  template<input_iterator I, class Proj = identity,
28981ad6265SDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
29081ad6265SDimitry Andric    constexpr ranges::for_each_n_result<I, Fun>
29181ad6265SDimitry Andric      ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});           // since C++20
29281ad6265SDimitry Andric
29381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
29481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
29581ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});      // since C++20
29681ad6265SDimitry Andric
29781ad6265SDimitry Andric  template<input_range R, class Proj = identity,
29881ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
29981ad6265SDimitry Andric    constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});                // since C++20
30081ad6265SDimitry Andric
301753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
302753f127fSDimitry Andric          class Proj = identity>
303753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
304753f127fSDimitry Andric    constexpr I
305753f127fSDimitry Andric      ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
306753f127fSDimitry Andric
307753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
308753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
309753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
310753f127fSDimitry Andric      ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
311753f127fSDimitry Andric
312753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
313753f127fSDimitry Andric          class Proj = identity>
314753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
315753f127fSDimitry Andric    constexpr I
316753f127fSDimitry Andric      ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {});                    // since C++20
317753f127fSDimitry Andric
318753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
319753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
320753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
321753f127fSDimitry Andric      ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {});                              // since C++20
322753f127fSDimitry Andric
323753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
324753f127fSDimitry Andric          class Proj = identity>
325753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
326753f127fSDimitry Andric    constexpr I
327753f127fSDimitry Andric      ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
328753f127fSDimitry Andric
329753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
330753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
331753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
332753f127fSDimitry Andric      ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
333753f127fSDimitry Andric
334753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
335753f127fSDimitry Andric          class Proj = identity>
336753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
337753f127fSDimitry Andric    constexpr I
338753f127fSDimitry Andric      ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
339753f127fSDimitry Andric
340753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
341753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
342753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
343753f127fSDimitry Andric      ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
344753f127fSDimitry Andric
345972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
346972a253aSDimitry Andric            indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
34706c3fb27SDimitry Andric    constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});                // since C++20
348972a253aSDimitry Andric
349972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
350972a253aSDimitry Andric            indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
35106c3fb27SDimitry Andric    constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});                          // since C++20
352972a253aSDimitry Andric
353972a253aSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
354972a253aSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
35506c3fb27SDimitry Andric    constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});             // since C++20
356972a253aSDimitry Andric
357972a253aSDimitry Andric  template<random_access_range R, class Proj = identity,
358972a253aSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
359972a253aSDimitry Andric    constexpr borrowed_iterator_t<R>
36006c3fb27SDimitry Andric      is_heap_until(R&& r, Comp comp = {}, Proj proj = {});                                 // since C++20
361972a253aSDimitry Andric
36281ad6265SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S>
36381ad6265SDimitry Andric    requires permutable<I>
36481ad6265SDimitry Andric    constexpr I ranges::reverse(I first, S last);                                           // since C++20
36581ad6265SDimitry Andric
36681ad6265SDimitry Andric  template<bidirectional_range R>
36781ad6265SDimitry Andric    requires permutable<iterator_t<R>>
36881ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);                                // since C++20
36981ad6265SDimitry Andric
37081ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
37181ad6265SDimitry Andric            class Proj = identity>
37281ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
37381ad6265SDimitry Andric    constexpr I
37481ad6265SDimitry Andric      ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});                        // since C++20
37581ad6265SDimitry Andric
37681ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
37781ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
37881ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
37981ad6265SDimitry Andric      ranges::sort(R&& r, Comp comp = {}, Proj proj = {});                                  // since C++20
38081ad6265SDimitry Andric
38181ad6265SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
38281ad6265SDimitry Andric          class Proj = identity>
38381ad6265SDimitry Andric    requires sortable<I, Comp, Proj>
38481ad6265SDimitry Andric    I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});                 // since C++20
38581ad6265SDimitry Andric
38681ad6265SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
38781ad6265SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
38881ad6265SDimitry Andric    borrowed_iterator_t<R>
38981ad6265SDimitry Andric      ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});                           // since C++20
39081ad6265SDimitry Andric
391fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
392fcaf7f86SDimitry Andric           class Proj = identity>
393fcaf7f86SDimitry Andric    requires sortable<I, Comp, Proj>
394fcaf7f86SDimitry Andric    constexpr I
395fcaf7f86SDimitry Andric      ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});      // since C++20
396fcaf7f86SDimitry Andric
397fcaf7f86SDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
398fcaf7f86SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
399fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
400fcaf7f86SDimitry Andric      ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});    // since C++20
401fcaf7f86SDimitry Andric
40281ad6265SDimitry Andric  template<class T, output_iterator<const T&> O, sentinel_for<O> S>
40381ad6265SDimitry Andric    constexpr O ranges::fill(O first, S last, const T& value);                              // since C++20
40481ad6265SDimitry Andric
40581ad6265SDimitry Andric  template<class T, output_range<const T&> R>
40681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);                   // since C++20
40781ad6265SDimitry Andric
40881ad6265SDimitry Andric  template<class T, output_iterator<const T&> O>
40981ad6265SDimitry Andric    constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);            // since C++20
41081ad6265SDimitry Andric
411972a253aSDimitry Andric  template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
412972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
41306c3fb27SDimitry Andric    constexpr O generate(O first, S last, F gen);                                           // since C++20
41406c3fb27SDimitry Andric
41506c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Generator>
41606c3fb27SDimitry Andric    void generate(ExecutionPolicy&& exec,
41706c3fb27SDimitry Andric                  ForwardIterator first, ForwardIterator last,
41806c3fb27SDimitry Andric                  Generator gen);                                                           // since C++17
419972a253aSDimitry Andric
420972a253aSDimitry Andric  template<class R, copy_constructible F>
421972a253aSDimitry Andric    requires invocable<F&> && output_range<R, invoke_result_t<F&>>
42206c3fb27SDimitry Andric    constexpr borrowed_iterator_t<R> generate(R&& r, F gen);                                // since C++20
423972a253aSDimitry Andric
424972a253aSDimitry Andric  template<input_or_output_iterator O, copy_constructible F>
425972a253aSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
42606c3fb27SDimitry Andric    constexpr O generate_n(O first, iter_difference_t<O> n, F gen);                         // since C++20
42706c3fb27SDimitry Andric
42806c3fb27SDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
42906c3fb27SDimitry Andric    ForwardIterator generate_n(ExecutionPolicy&& exec,
43006c3fb27SDimitry Andric                               ForwardIterator first, Size n, Generator gen);               // since C++17
431972a253aSDimitry Andric
43281ad6265SDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
43381ad6265SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
43481ad6265SDimitry Andric   requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
43581ad6265SDimitry Andric   constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
43681ad6265SDimitry Andric                                Pred pred = {},
43781ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
43881ad6265SDimitry Andric
43981ad6265SDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to,
44081ad6265SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
44181ad6265SDimitry Andric   requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
44281ad6265SDimitry Andric   constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
44381ad6265SDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
44481ad6265SDimitry Andric
44581ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
44681ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
44781ad6265SDimitry Andric    constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
44881ad6265SDimitry Andric
44981ad6265SDimitry Andric  template<input_range R, class Proj = identity,
45081ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
45181ad6265SDimitry Andric    constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
45281ad6265SDimitry Andric
45381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
45481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
45581ad6265SDimitry Andric    constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
45681ad6265SDimitry Andric
45781ad6265SDimitry Andric  template<input_range R, class Proj = identity,
45881ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
45981ad6265SDimitry Andric    constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
46081ad6265SDimitry Andric
4615f757f3fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
4625f757f3fSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
4635f757f3fSDimitry Andric    requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
4645f757f3fSDimitry Andric           (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
4655f757f3fSDimitry Andric           indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
4665f757f3fSDimitry Andric    constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
4675f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
4685f757f3fSDimitry Andric
4695f757f3fSDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
4705f757f3fSDimitry Andric          class Proj2 = identity>
4715f757f3fSDimitry Andric    requires (forward_range<R1> || sized_range<R1>) &&
4725f757f3fSDimitry Andric           (forward_range<R2> || sized_range<R2>) &&
4735f757f3fSDimitry Andric           indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
4745f757f3fSDimitry Andric    constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
4755f757f3fSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
4765f757f3fSDimitry Andric
47781ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
47881ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
47981ad6265SDimitry Andric    constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});             // since C++20
48081ad6265SDimitry Andric
48181ad6265SDimitry Andric  template<input_range R, class Proj = identity,
48281ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
48381ad6265SDimitry Andric    constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});                       // since C++20
48481ad6265SDimitry Andric
48506c3fb27SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
48606c3fb27SDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
48706c3fb27SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
48806c3fb27SDimitry Andric    constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
48906c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++23
49006c3fb27SDimitry Andric
49106c3fb27SDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
49206c3fb27SDimitry Andric          class Proj2 = identity>
49306c3fb27SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
49406c3fb27SDimitry Andric    constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
49506c3fb27SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
49606c3fb27SDimitry Andric
49761cfbce3SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1,
49861cfbce3SDimitry Andric          random_access_iterator I2, sentinel_for<I2> S2,
49961cfbce3SDimitry Andric          class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
50061cfbce3SDimitry Andric    requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
50161cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
50261cfbce3SDimitry Andric    constexpr partial_sort_copy_result<I1, I2>
50361cfbce3SDimitry Andric      partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
50406c3fb27SDimitry Andric                        Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++20
50561cfbce3SDimitry Andric
50661cfbce3SDimitry Andric  template<input_range R1, random_access_range R2, class Comp = ranges::less,
50761cfbce3SDimitry Andric          class Proj1 = identity, class Proj2 = identity>
50861cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
50961cfbce3SDimitry Andric            sortable<iterator_t<R2>, Comp, Proj2> &&
51061cfbce3SDimitry Andric            indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
51161cfbce3SDimitry Andric                                        projected<iterator_t<R2>, Proj2>>
51261cfbce3SDimitry Andric    constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
51361cfbce3SDimitry Andric      partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
51406c3fb27SDimitry Andric                        Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++20
51561cfbce3SDimitry Andric
51681ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
51781ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
51881ad6265SDimitry Andric    constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {});      // since C++20
51981ad6265SDimitry Andric
52081ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
52181ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
52281ad6265SDimitry Andric    constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {});                // since C++20
52381ad6265SDimitry Andric
52481ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
52581ad6265SDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
52681ad6265SDimitry Andric    constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});   // since C++20
52781ad6265SDimitry Andric
52881ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
52981ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
53081ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
53181ad6265SDimitry Andric      ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});                       // since C++20
53281ad6265SDimitry Andric
533753f127fSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
534753f127fSDimitry Andric          class Proj = identity>
535753f127fSDimitry Andric    requires sortable<I, Comp, Proj>
536753f127fSDimitry Andric    constexpr I
537753f127fSDimitry Andric      ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});          // since C++20
538753f127fSDimitry Andric
539753f127fSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
540753f127fSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
541753f127fSDimitry Andric    constexpr borrowed_iterator_t<R>
542753f127fSDimitry Andric      ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});        // since C++20
543753f127fSDimitry Andric
54481ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
54506c3fb27SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>    // since C++20
54606c3fb27SDimitry Andric    constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
54781ad6265SDimitry Andric
54881ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
54981ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
55081ad6265SDimitry Andric             ranges::less>
55181ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
55281ad6265SDimitry Andric      upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
55381ad6265SDimitry Andric
55481ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
55581ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
55681ad6265SDimitry Andric    constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
55781ad6265SDimitry Andric                                    Proj proj = {});                                        // since C++20
55881ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
55981ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
56081ad6265SDimitry Andric             ranges::less>
56181ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
56281ad6265SDimitry Andric      lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
56381ad6265SDimitry Andric
56481ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
56581ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
56681ad6265SDimitry Andric    constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
56781ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
56881ad6265SDimitry Andric
56981ad6265SDimitry Andric  template<forward_range R, class T, class Proj = identity,
57081ad6265SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
57181ad6265SDimitry Andric             ranges::less>
57281ad6265SDimitry Andric    constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
57381ad6265SDimitry Andric                                         Proj proj = {});                                   // since C++20
574fcaf7f86SDimitry Andric
575fcaf7f86SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
576fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
577fcaf7f86SDimitry Andric    constexpr subrange<I>
57806c3fb27SDimitry Andric      partition(I first, S last, Pred pred, Proj proj = {});                                // since C++20
579fcaf7f86SDimitry Andric
580fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
581fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
582fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
583fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
58406c3fb27SDimitry Andric      partition(R&& r, Pred pred, Proj proj = {});                                          // since C++20
585fcaf7f86SDimitry Andric
586fcaf7f86SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
587fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
588fcaf7f86SDimitry Andric    requires permutable<I>
58906c3fb27SDimitry Andric    subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});               // since C++20
590fcaf7f86SDimitry Andric
591fcaf7f86SDimitry Andric  template<bidirectional_range R, class Proj = identity,
592fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
593fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>>
59406c3fb27SDimitry Andric    borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});              // since C++20
595fcaf7f86SDimitry Andric
59681ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
59781ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
59881ad6265SDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
59981ad6265SDimitry Andric    constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
60081ad6265SDimitry Andric                                       Pred pred = {},
60181ad6265SDimitry Andric                                       Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++20
60281ad6265SDimitry Andric
60381ad6265SDimitry Andric  template<input_range R1, forward_range R2,
60481ad6265SDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
60581ad6265SDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
60681ad6265SDimitry Andric    constexpr borrowed_iterator_t<R1>
60781ad6265SDimitry Andric      ranges::find_first_of(R1&& r1, R2&& r2,
60881ad6265SDimitry Andric                            Pred pred = {},
60981ad6265SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                            // since C++20
61081ad6265SDimitry Andric
61181ad6265SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
61281ad6265SDimitry Andric           indirect_binary_predicate<projected<I, Proj>,
61381ad6265SDimitry Andric                                     projected<I, Proj>> Pred = ranges::equal_to>
61406c3fb27SDimitry Andric    constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});     // since C++20
61581ad6265SDimitry Andric
61681ad6265SDimitry Andric  template<forward_range R, class Proj = identity,
61781ad6265SDimitry Andric           indirect_binary_predicate<projected<iterator_t<R>, Proj>,
61881ad6265SDimitry Andric                                     projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
61981ad6265SDimitry Andric    constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});  // since C++20
62081ad6265SDimitry Andric
62181ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
62281ad6265SDimitry Andric    requires indirectly_writable<I, const T2&> &&
62381ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
62481ad6265SDimitry Andric    constexpr I
62581ad6265SDimitry Andric      ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});   // since C++20
62681ad6265SDimitry Andric
62781ad6265SDimitry Andric  template<input_range R, class T1, class T2, class Proj = identity>
62881ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T2&> &&
62981ad6265SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
63081ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
63181ad6265SDimitry Andric      ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});             // since C++20
63281ad6265SDimitry Andric
63381ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
63481ad6265SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
63581ad6265SDimitry Andric    requires indirectly_writable<I, const T&>
63681ad6265SDimitry Andric    constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
63781ad6265SDimitry Andric
63881ad6265SDimitry Andric  template<input_range R, class T, class Proj = identity,
63981ad6265SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
64081ad6265SDimitry Andric    requires indirectly_writable<iterator_t<R>, const T&>
64181ad6265SDimitry Andric    constexpr borrowed_iterator_t<R>
64281ad6265SDimitry Andric      ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});                     // since C++20
64381ad6265SDimitry Andric
64461cfbce3SDimitry Andric  template<class T, class Proj = identity,
64561cfbce3SDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
64661cfbce3SDimitry Andric    constexpr const T&
64761cfbce3SDimitry Andric      ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {});          // since C++20
64861cfbce3SDimitry Andric
64981ad6265SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
65081ad6265SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
65181ad6265SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>,
65281ad6265SDimitry Andric                                      projected<I2, Proj2>> Comp = ranges::less>
65381ad6265SDimitry Andric    constexpr bool
65481ad6265SDimitry Andric      ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
65581ad6265SDimitry Andric                                      Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});          // since C++20
65681ad6265SDimitry Andric
65781ad6265SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
65881ad6265SDimitry Andric           class Proj2 = identity,
65981ad6265SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
66081ad6265SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
66181ad6265SDimitry Andric    constexpr bool
66281ad6265SDimitry Andric      ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
66381ad6265SDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                          // since C++20
66481ad6265SDimitry Andric
66581ad6265SDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
66681ad6265SDimitry Andric    requires indirectly_movable<I1, I2>
66781ad6265SDimitry Andric    constexpr ranges::move_backward_result<I1, I2>
66881ad6265SDimitry Andric      ranges::move_backward(I1 first, S1 last, I2 result);                                          // since C++20
66981ad6265SDimitry Andric
67081ad6265SDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
67181ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, I>
67281ad6265SDimitry Andric    constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
67381ad6265SDimitry Andric      ranges::move_backward(R&& r, I result);                                                       // since C++20
67481ad6265SDimitry Andric
67581ad6265SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
67681ad6265SDimitry Andric    requires indirectly_movable<I, O>
67781ad6265SDimitry Andric    constexpr ranges::move_result<I, O>
67881ad6265SDimitry Andric      ranges::move(I first, S last, O result);                                                      // since C++20
67981ad6265SDimitry Andric
68081ad6265SDimitry Andric  template<input_range R, weakly_incrementable O>
68181ad6265SDimitry Andric    requires indirectly_movable<iterator_t<R>, O>
68281ad6265SDimitry Andric    constexpr ranges::move_result<borrowed_iterator_t<R>, O>
68381ad6265SDimitry Andric      ranges::move(R&& r, O result);                                                                // since C++20
68481ad6265SDimitry Andric
685fcaf7f86SDimitry Andric  template<class I, class O1, class O2>
686fcaf7f86SDimitry Andric      using partition_copy_result = in_out_out_result<I, O1, O2>;                                   // since C++20
687fcaf7f86SDimitry Andric
688fcaf7f86SDimitry Andric  template<input_iterator I, sentinel_for<I> S,
689fcaf7f86SDimitry Andric          weakly_incrementable O1, weakly_incrementable O2,
690fcaf7f86SDimitry Andric          class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
691fcaf7f86SDimitry Andric    requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
692fcaf7f86SDimitry Andric    constexpr partition_copy_result<I, O1, O2>
693fcaf7f86SDimitry Andric      partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
69406c3fb27SDimitry Andric                    Proj proj = {});                                                                // since C++20
695fcaf7f86SDimitry Andric
696fcaf7f86SDimitry Andric  template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
697fcaf7f86SDimitry Andric          class Proj = identity,
698fcaf7f86SDimitry Andric          indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
699fcaf7f86SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O1> &&
700fcaf7f86SDimitry Andric            indirectly_copyable<iterator_t<R>, O2>
701fcaf7f86SDimitry Andric    constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
70206c3fb27SDimitry Andric      partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});                  // since C++20
703fcaf7f86SDimitry Andric
704fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
705fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
70606c3fb27SDimitry Andric    constexpr I partition_point(I first, S last, Pred pred, Proj proj = {});                        // since C++20
707fcaf7f86SDimitry Andric
708fcaf7f86SDimitry Andric  template<forward_range R, class Proj = identity,
709fcaf7f86SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
710fcaf7f86SDimitry Andric    constexpr borrowed_iterator_t<R>
71106c3fb27SDimitry Andric      partition_point(R&& r, Pred pred, Proj proj = {});                                            // since C++20
712fcaf7f86SDimitry Andric
713753f127fSDimitry Andric  template<class I1, class I2, class O>
714753f127fSDimitry Andric    using merge_result = in_in_out_result<I1, I2, O>;                                               // since C++20
715753f127fSDimitry Andric
716753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
717753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
718753f127fSDimitry Andric           class Proj2 = identity>
719753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
720753f127fSDimitry Andric    constexpr merge_result<I1, I2, O>
721753f127fSDimitry Andric      merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
722753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
723753f127fSDimitry Andric
724753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
725753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
726753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
727753f127fSDimitry Andric    constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
728753f127fSDimitry Andric      merge(R1&& r1, R2&& r2, O result,
729753f127fSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
730753f127fSDimitry Andric
731753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
732753f127fSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
733753f127fSDimitry Andric    constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});          // since C++20
734753f127fSDimitry Andric
735753f127fSDimitry Andric  template<forward_range R, class T, class Proj = identity>
736753f127fSDimitry Andric    requires permutable<iterator_t<R>> &&
737753f127fSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
738753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
739753f127fSDimitry Andric      ranges::remove(R&& r, const T& value, Proj proj = {});                                        // since C++20
740753f127fSDimitry Andric
741753f127fSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
742753f127fSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
743753f127fSDimitry Andric    constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});            // since C++20
744753f127fSDimitry Andric
745753f127fSDimitry Andric  template<forward_range R, class Proj = identity,
746753f127fSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
747753f127fSDimitry Andric    requires permutable<iterator_t<R>>
748753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
749753f127fSDimitry Andric      ranges::remove_if(R&& r, Pred pred, Proj proj = {});                                          // since C++20
750753f127fSDimitry Andric
751753f127fSDimitry Andric  template<class I, class O>
752753f127fSDimitry Andric    using set_difference_result = in_out_result<I, 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,
756753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
757753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758753f127fSDimitry Andric    constexpr set_difference_result<I1, O>
759753f127fSDimitry Andric      set_difference(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,
763753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
764753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765753f127fSDimitry Andric    constexpr set_difference_result<borrowed_iterator_t<R1>, O>
766753f127fSDimitry Andric      set_difference(R1&& r1, R2&& r2, O result,
767753f127fSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
768753f127fSDimitry Andric
769753f127fSDimitry Andric  template<class I1, class I2, class O>
770753f127fSDimitry Andric    using set_intersection_result = in_in_out_result<I1, I2, O>;                                    // since C++20
771753f127fSDimitry Andric
772753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
773753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
774753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
775753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
776753f127fSDimitry Andric    constexpr set_intersection_result<I1, I2, O>
777753f127fSDimitry Andric      set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
778753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
779753f127fSDimitry Andric
780753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
781753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
782753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
783753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
784753f127fSDimitry Andric    constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
785753f127fSDimitry Andric      set_intersection(R1&& r1, R2&& r2, O result,
786753f127fSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
787753f127fSDimitry Andric
788753f127fSDimitry Andric  template <class _InIter, class _OutIter>
789753f127fSDimitry Andric  using reverse_copy_result = in_out_result<_InIter, _OutIter>;                                     // since C++20
790753f127fSDimitry Andric
791753f127fSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
792753f127fSDimitry Andric    requires indirectly_copyable<I, O>
793753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<I, O>
794753f127fSDimitry Andric      ranges::reverse_copy(I first, S last, O result);                                              // since C++20
795753f127fSDimitry Andric
796753f127fSDimitry Andric  template<bidirectional_range R, weakly_incrementable O>
797753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
798753f127fSDimitry Andric    constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
799753f127fSDimitry Andric      ranges::reverse_copy(R&& r, O result);                                                        // since C++20
800753f127fSDimitry Andric
80161cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S>
80261cfbce3SDimitry Andric    constexpr subrange<I> rotate(I first, I middle, S last);                                        // since C++20
80361cfbce3SDimitry Andric
80461cfbce3SDimitry Andric  template<forward_range R>
80561cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
80606c3fb27SDimitry Andric    constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);                           // since C++20
80761cfbce3SDimitry Andric
808753f127fSDimitry Andric  template <class _InIter, class _OutIter>
809753f127fSDimitry Andric  using rotate_copy_result = in_out_result<_InIter, _OutIter>;                                      // since C++20
810753f127fSDimitry Andric
811753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
812753f127fSDimitry Andric    requires indirectly_copyable<I, O>
813753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<I, O>
814753f127fSDimitry Andric      ranges::rotate_copy(I first, I middle, S last, O result);                                     // since C++20
815753f127fSDimitry Andric
816753f127fSDimitry Andric  template<forward_range R, weakly_incrementable O>
817753f127fSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
818753f127fSDimitry Andric    constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
819753f127fSDimitry Andric      ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);                                   // since C++20
820753f127fSDimitry Andric
82161cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
82261cfbce3SDimitry Andric    requires (forward_iterator<I> || random_access_iterator<O>) &&
82361cfbce3SDimitry Andric            indirectly_copyable<I, O> &&
82461cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
82506c3fb27SDimitry Andric    O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g);                              // since C++20
82661cfbce3SDimitry Andric
82761cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Gen>
82861cfbce3SDimitry Andric    requires (forward_range<R> || random_access_iterator<O>) &&
82961cfbce3SDimitry Andric            indirectly_copyable<iterator_t<R>, O> &&
83061cfbce3SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
83106c3fb27SDimitry Andric    O sample(R&& r, O out, range_difference_t<R> n, Gen&& g);                                       // since C++20
83261cfbce3SDimitry Andric
833fcaf7f86SDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Gen>
834fcaf7f86SDimitry Andric    requires permutable<I> &&
835fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
83606c3fb27SDimitry Andric    I shuffle(I first, S last, Gen&& g);                                                            // since C++20
837fcaf7f86SDimitry Andric
838fcaf7f86SDimitry Andric  template<random_access_range R, class Gen>
839fcaf7f86SDimitry Andric    requires permutable<iterator_t<R>> &&
840fcaf7f86SDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
84106c3fb27SDimitry Andric    borrowed_iterator_t<R> shuffle(R&& r, Gen&& g);                                                 // since C++20
842fcaf7f86SDimitry Andric
843753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
84461cfbce3SDimitry Andric         sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
84561cfbce3SDimitry Andric         indirect_equivalence_relation<projected<I1, Proj1>,
84661cfbce3SDimitry Andric                                       projected<I2, Proj2>> Pred = ranges::equal_to>
84761cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
84861cfbce3SDimitry Andric                                        Pred pred = {},
84906c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
85061cfbce3SDimitry Andric
85161cfbce3SDimitry Andric  template<forward_range R1, forward_range R2,
85261cfbce3SDimitry Andric         class Proj1 = identity, class Proj2 = identity,
85361cfbce3SDimitry Andric         indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
85461cfbce3SDimitry Andric                                       projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
85561cfbce3SDimitry Andric  constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
85606c3fb27SDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
85761cfbce3SDimitry Andric
85861cfbce3SDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
859753f127fSDimitry Andric           sentinel_for<I2> S2, class Pred = ranges::equal_to,
860753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
861753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
862753f127fSDimitry Andric    constexpr subrange<I1>
863753f127fSDimitry Andric      ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
864753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
865753f127fSDimitry Andric
866753f127fSDimitry Andric  template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
867753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
868753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
869753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
870753f127fSDimitry Andric      ranges::search(R1&& r1, R2&& r2, Pred pred = {},
871753f127fSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
872753f127fSDimitry Andric
873753f127fSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T,
874753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj = identity>
875753f127fSDimitry Andric    requires indirectly_comparable<I, const T*, Pred, Proj>
876753f127fSDimitry Andric    constexpr subrange<I>
877753f127fSDimitry Andric      ranges::search_n(I first, S last, iter_difference_t<I> count,
878753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
879753f127fSDimitry Andric
880753f127fSDimitry Andric  template<forward_range R, class T, class Pred = ranges::equal_to,
881753f127fSDimitry Andric           class Proj = identity>
882753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
883753f127fSDimitry Andric    constexpr borrowed_subrange_t<R>
884753f127fSDimitry Andric      ranges::search_n(R&& r, range_difference_t<R> count,
885753f127fSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
886753f127fSDimitry Andric
887*cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
888*cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
889*cb14a3feSDimitry Andric    constexpr auto ranges::fold_left(I first, S last, T init, F f);                                 // since C++23
890*cb14a3feSDimitry Andric
891*cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
892*cb14a3feSDimitry Andric    constexpr auto fold_left(R&& r, T init, F f);                                                   // since C++23
893*cb14a3feSDimitry Andric
894*cb14a3feSDimitry Andric  template<class I, class T>
895*cb14a3feSDimitry Andric    using fold_left_with_iter_result = in_value_result<I, T>;                                       // since C++23
896*cb14a3feSDimitry Andric
897*cb14a3feSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
898*cb14a3feSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
899*cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(I first, S last, T init, F f);                          // since C++23
900*cb14a3feSDimitry Andric
901*cb14a3feSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
902*cb14a3feSDimitry Andric    constexpr see below fold_left_with_iter(R&& r, T init, F f);                                    // since C++23
903*cb14a3feSDimitry Andric
904753f127fSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
905753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
906753f127fSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
907753f127fSDimitry Andric    constexpr subrange<I1>
908753f127fSDimitry Andric      ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
909753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
910753f127fSDimitry Andric
911753f127fSDimitry Andric  template<forward_range R1, forward_range R2,
912753f127fSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
913753f127fSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
914753f127fSDimitry Andric    constexpr borrowed_subrange_t<R1>
915753f127fSDimitry Andric      ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
916753f127fSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
917753f127fSDimitry Andric
918753f127fSDimitry Andric  template<class I1, class I2, class O>
919753f127fSDimitry Andric    using set_symmetric_difference_result = in_in_out_result<I1, I2, O>;                            // since C++20
920753f127fSDimitry Andric
921753f127fSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
922753f127fSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
923753f127fSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
924753f127fSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
925753f127fSDimitry Andric    constexpr set_symmetric_difference_result<I1, I2, O>
926753f127fSDimitry Andric      set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
927753f127fSDimitry Andric                               Comp comp = {}, Proj1 proj1 = {},
928753f127fSDimitry Andric                               Proj2 proj2 = {});                                                   // since C++20
929753f127fSDimitry Andric
930753f127fSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
931753f127fSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
932753f127fSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
933753f127fSDimitry Andric    constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
934753f127fSDimitry Andric                                                      borrowed_iterator_t<R2>, O>
935753f127fSDimitry Andric      set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
936753f127fSDimitry Andric                               Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
93781ad6265SDimitry Andric
938fcaf7f86SDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
939fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
940fcaf7f86SDimitry Andric    constexpr subrange<I>
941fcaf7f86SDimitry Andric      equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});                 // since C++20
942fcaf7f86SDimitry Andric
943fcaf7f86SDimitry Andric  template<forward_range R, class T, class Proj = identity,
944fcaf7f86SDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
945fcaf7f86SDimitry Andric             ranges::less>
946fcaf7f86SDimitry Andric    constexpr borrowed_subrange_t<R>
947fcaf7f86SDimitry Andric      equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});                           // since C++20
948fcaf7f86SDimitry Andric
949fcaf7f86SDimitry Andric  template<class I1, class I2, class O>
950fcaf7f86SDimitry Andric    using set_union_result = in_in_out_result<I1, I2, O>;                                           // since C++20
951fcaf7f86SDimitry Andric
952fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
953fcaf7f86SDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
954fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity>
955fcaf7f86SDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
956fcaf7f86SDimitry Andric    constexpr set_union_result<I1, I2, O>
957fcaf7f86SDimitry Andric      set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
958fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
959fcaf7f86SDimitry Andric
960fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
961fcaf7f86SDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
962fcaf7f86SDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
963fcaf7f86SDimitry Andric    constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
964fcaf7f86SDimitry Andric      set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
965fcaf7f86SDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
966fcaf7f86SDimitry Andric
967fcaf7f86SDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
968fcaf7f86SDimitry Andric           class Proj1 = identity, class Proj2 = identity,
969fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
970fcaf7f86SDimitry Andric             ranges::less>
971fcaf7f86SDimitry Andric    constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
97206c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
973fcaf7f86SDimitry Andric
974fcaf7f86SDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
975fcaf7f86SDimitry Andric           class Proj2 = identity,
976fcaf7f86SDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
977fcaf7f86SDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
978fcaf7f86SDimitry Andric    constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
97906c3fb27SDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
98061cfbce3SDimitry Andric
98161cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
98261cfbce3SDimitry Andric           class Proj = identity>
98361cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
98406c3fb27SDimitry Andric    I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});                    // since C++20
98561cfbce3SDimitry Andric
98661cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
98761cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
98861cfbce3SDimitry Andric    borrowed_iterator_t<R>
98961cfbce3SDimitry Andric      inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
99006c3fb27SDimitry Andric                    Proj proj = {});                                                               // since C++20
99161cfbce3SDimitry Andric
99261cfbce3SDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
99361cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
99406c3fb27SDimitry Andric    constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {});                    // since C++20
99561cfbce3SDimitry Andric
99661cfbce3SDimitry Andric  template<forward_range R, class Proj = identity,
99761cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
99861cfbce3SDimitry Andric    requires permutable<iterator_t<R>>
99961cfbce3SDimitry Andric    constexpr borrowed_subrange_t<R>
100006c3fb27SDimitry Andric      unique(R&& r, C comp = {}, Proj proj = {});                                                  // since C++20
100161cfbce3SDimitry Andric
100261cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
100361cfbce3SDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
100461cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
100561cfbce3SDimitry Andric             (forward_iterator<I> ||
100661cfbce3SDimitry Andric              (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
100761cfbce3SDimitry Andric              indirectly_copyable_storable<I, O>)
100861cfbce3SDimitry Andric    constexpr unique_copy_result<I, O>
100906c3fb27SDimitry Andric      unique_copy(I first, S last, O result, C comp = {}, Proj proj = {});                         // since C++20
101061cfbce3SDimitry Andric
101161cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
101261cfbce3SDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
101361cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
101461cfbce3SDimitry Andric             (forward_iterator<iterator_t<R>> ||
101561cfbce3SDimitry Andric              (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
101661cfbce3SDimitry Andric              indirectly_copyable_storable<iterator_t<R>, O>)
101761cfbce3SDimitry Andric    constexpr unique_copy_result<borrowed_iterator_t<R>, O>
101806c3fb27SDimitry Andric      unique_copy(R&& r, O result, C comp = {}, Proj proj = {});                                   // since C++20
101961cfbce3SDimitry Andric
102061cfbce3SDimitry Andric  template<class I, class O>
102106c3fb27SDimitry Andric      using remove_copy_result = in_out_result<I, O>;                                              // since C++20
102261cfbce3SDimitry Andric
102361cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
102461cfbce3SDimitry Andric           class Proj = identity>
102561cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
102661cfbce3SDimitry Andric    constexpr remove_copy_result<I, O>
102706c3fb27SDimitry Andric      remove_copy(I first, S last, O result, const T& value, Proj proj = {});                      // since C++20
102861cfbce3SDimitry Andric
102961cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class T, class Proj = identity>
103061cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
103161cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
103261cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T*>
103361cfbce3SDimitry Andric    constexpr remove_copy_result<borrowed_iterator_t<R>, O>
103406c3fb27SDimitry Andric      remove_copy(R&& r, O result, const T& value, Proj proj = {});                                // since C++20
103561cfbce3SDimitry Andric
103661cfbce3SDimitry Andric  template<class I, class O>
103706c3fb27SDimitry Andric      using remove_copy_if_result = in_out_result<I, O>;                                           // since C++20
103861cfbce3SDimitry Andric
103961cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
104061cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
104161cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
104261cfbce3SDimitry Andric    constexpr remove_copy_if_result<I, O>
104306c3fb27SDimitry Andric      remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});                        // since C++20
104461cfbce3SDimitry Andric
104561cfbce3SDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
104661cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
104761cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
104861cfbce3SDimitry Andric    constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
104906c3fb27SDimitry Andric      remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});                                  // since C++20
105061cfbce3SDimitry Andric
105161cfbce3SDimitry Andric  template<class I, class O>
105206c3fb27SDimitry Andric      using replace_copy_result = in_out_result<I, O>;                                             // since C++20
105361cfbce3SDimitry Andric
105461cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2,
105561cfbce3SDimitry Andric           output_iterator<const T2&> O, class Proj = identity>
105661cfbce3SDimitry Andric    requires indirectly_copyable<I, O> &&
105761cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
105861cfbce3SDimitry Andric    constexpr replace_copy_result<I, O>
105961cfbce3SDimitry Andric      replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
106006c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
106161cfbce3SDimitry Andric
106261cfbce3SDimitry Andric  template<input_range R, class T1, class T2, output_iterator<const T2&> O,
106361cfbce3SDimitry Andric           class Proj = identity>
106461cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
106561cfbce3SDimitry Andric             indirect_binary_predicate<ranges::equal_to,
106661cfbce3SDimitry Andric                                       projected<iterator_t<R>, Proj>, const T1*>
106761cfbce3SDimitry Andric    constexpr replace_copy_result<borrowed_iterator_t<R>, O>
106861cfbce3SDimitry Andric      replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
106906c3fb27SDimitry Andric                   Proj proj = {});                                                                // since C++20
107061cfbce3SDimitry Andric
107161cfbce3SDimitry Andric  template<class I, class O>
107206c3fb27SDimitry Andric      using replace_copy_if_result = in_out_result<I, O>;                                          // since C++20
107361cfbce3SDimitry Andric
107461cfbce3SDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
107561cfbce3SDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
107661cfbce3SDimitry Andric    requires indirectly_copyable<I, O>
107761cfbce3SDimitry Andric    constexpr replace_copy_if_result<I, O>
107861cfbce3SDimitry Andric      replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
107906c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
108061cfbce3SDimitry Andric
108161cfbce3SDimitry Andric  template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
108261cfbce3SDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
108361cfbce3SDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
108461cfbce3SDimitry Andric    constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
108561cfbce3SDimitry Andric      replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
108606c3fb27SDimitry Andric                      Proj proj = {});                                                             // since C++20
108761cfbce3SDimitry Andric
108861cfbce3SDimitry Andric  template<class I>
108906c3fb27SDimitry Andric    using prev_permutation_result = in_found_result<I>;                                            // since C++20
109061cfbce3SDimitry Andric
109161cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
109261cfbce3SDimitry Andric           class Proj = identity>
109361cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
109461cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<I>
109506c3fb27SDimitry Andric      ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
109661cfbce3SDimitry Andric
109761cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
109861cfbce3SDimitry Andric           class Proj = identity>
109961cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
110061cfbce3SDimitry Andric    constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
110106c3fb27SDimitry Andric      ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
110261cfbce3SDimitry Andric
110361cfbce3SDimitry Andric  template<class I>
110406c3fb27SDimitry Andric    using next_permutation_result = in_found_result<I>;                                            // since C++20
110561cfbce3SDimitry Andric
110661cfbce3SDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
110761cfbce3SDimitry Andric           class Proj = identity>
110861cfbce3SDimitry Andric    requires sortable<I, Comp, Proj>
110961cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<I>
111006c3fb27SDimitry Andric      ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
111161cfbce3SDimitry Andric
111261cfbce3SDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
111361cfbce3SDimitry Andric           class Proj = identity>
111461cfbce3SDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
111561cfbce3SDimitry Andric    constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
111606c3fb27SDimitry Andric      ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
111761cfbce3SDimitry Andric
111804eeddc0SDimitry Andric}
111904eeddc0SDimitry Andric
112061cfbce3SDimitry Andrictemplate <class InputIterator, class Predicate>
11210b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11220b57cec5SDimitry Andric    all_of(InputIterator first, InputIterator last, Predicate pred);
11230b57cec5SDimitry Andric
11240b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11250b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11260b57cec5SDimitry Andric    any_of(InputIterator first, InputIterator last, Predicate pred);
11270b57cec5SDimitry Andric
11280b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11290b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
11300b57cec5SDimitry Andric    none_of(InputIterator first, InputIterator last, Predicate pred);
11310b57cec5SDimitry Andric
11320b57cec5SDimitry Andrictemplate <class InputIterator, class Function>
11330b57cec5SDimitry Andric    constexpr Function          // constexpr in C++20
11340b57cec5SDimitry Andric    for_each(InputIterator first, InputIterator last, Function f);
11350b57cec5SDimitry Andric
11360b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class Function>
11370b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11380b57cec5SDimitry Andric    for_each_n(InputIterator first, Size n, Function f); // C++17
11390b57cec5SDimitry Andric
11400b57cec5SDimitry Andrictemplate <class InputIterator, class T>
11410b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11420b57cec5SDimitry Andric    find(InputIterator first, InputIterator last, const T& value);
11430b57cec5SDimitry Andric
11440b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11450b57cec5SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11460b57cec5SDimitry Andric    find_if(InputIterator first, InputIterator last, Predicate pred);
11470b57cec5SDimitry Andric
11480b57cec5SDimitry Andrictemplate<class InputIterator, class Predicate>
1149e8d8bef9SDimitry Andric    constexpr InputIterator     // constexpr in C++20
11500b57cec5SDimitry Andric    find_if_not(InputIterator first, InputIterator last, Predicate pred);
11510b57cec5SDimitry Andric
11520b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1153e8d8bef9SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11540b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
11550b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2);
11560b57cec5SDimitry Andric
11570b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1158e8d8bef9SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11590b57cec5SDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
11600b57cec5SDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
11610b57cec5SDimitry Andric
11620b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
11630b57cec5SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11640b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
11650b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2);
11660b57cec5SDimitry Andric
11670b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
11680b57cec5SDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
11690b57cec5SDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
11700b57cec5SDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
11710b57cec5SDimitry Andric
11720b57cec5SDimitry Andrictemplate <class ForwardIterator>
11730b57cec5SDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
11740b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last);
11750b57cec5SDimitry Andric
11760b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
11770b57cec5SDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
11780b57cec5SDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
11790b57cec5SDimitry Andric
11800b57cec5SDimitry Andrictemplate <class InputIterator, class T>
11810b57cec5SDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type  // constexpr in C++20
11820b57cec5SDimitry Andric    count(InputIterator first, InputIterator last, const T& value);
11830b57cec5SDimitry Andric
11840b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
11850b57cec5SDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
11860b57cec5SDimitry Andric    count_if(InputIterator first, InputIterator last, Predicate pred);
11870b57cec5SDimitry Andric
11880b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
11890b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
11900b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
11910b57cec5SDimitry Andric
11920b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
11930b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
11940b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
11950b57cec5SDimitry Andric             InputIterator2 first2, InputIterator2 last2); // **C++14**
11960b57cec5SDimitry Andric
11970b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
11980b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
11990b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12000b57cec5SDimitry Andric             InputIterator2 first2, BinaryPredicate pred);
12010b57cec5SDimitry Andric
12020b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12030b57cec5SDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
12040b57cec5SDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
12050b57cec5SDimitry Andric             InputIterator2 first2, InputIterator2 last2,
12060b57cec5SDimitry Andric             BinaryPredicate pred); // **C++14**
12070b57cec5SDimitry Andric
12080b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12090b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12100b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
12110b57cec5SDimitry Andric
12120b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
12130b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12140b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12150b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2); // **C++14**
12160b57cec5SDimitry Andric
12170b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12180b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12190b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12200b57cec5SDimitry Andric          InputIterator2 first2, BinaryPredicate pred);
12210b57cec5SDimitry Andric
12220b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
12230b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12240b57cec5SDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
12250b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2,
12260b57cec5SDimitry Andric          BinaryPredicate pred); // **C++14**
12270b57cec5SDimitry Andric
12280b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
12290b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12300b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12310b57cec5SDimitry Andric                   ForwardIterator2 first2);
12320b57cec5SDimitry Andric
12330b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
12340b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12350b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12360b57cec5SDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
12370b57cec5SDimitry Andric
12380b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12390b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12400b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12410b57cec5SDimitry Andric                   ForwardIterator2 first2, BinaryPredicate pred);
12420b57cec5SDimitry Andric
12430b57cec5SDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12440b57cec5SDimitry Andric    constexpr bool      // constexpr in C++20
12450b57cec5SDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
12460b57cec5SDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2,
12470b57cec5SDimitry Andric                   BinaryPredicate pred);  // **C++14**
12480b57cec5SDimitry Andric
12490b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
12500b57cec5SDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
12510b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
12520b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2);
12530b57cec5SDimitry Andric
12540b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
12550b57cec5SDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
12560b57cec5SDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
12570b57cec5SDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
12580b57cec5SDimitry Andric
12590b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T>
12600b57cec5SDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
12610b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
12620b57cec5SDimitry Andric
12630b57cec5SDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate>
12640b57cec5SDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
12650b57cec5SDimitry Andric    search_n(ForwardIterator first, ForwardIterator last,
12660b57cec5SDimitry Andric             Size count, const T& value, BinaryPredicate pred);
12670b57cec5SDimitry Andric
12680b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1269480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
12700b57cec5SDimitry Andric    copy(InputIterator first, InputIterator last, OutputIterator result);
12710b57cec5SDimitry Andric
12720b57cec5SDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate>
1273480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
12740b57cec5SDimitry Andric    copy_if(InputIterator first, InputIterator last,
12750b57cec5SDimitry Andric            OutputIterator result, Predicate pred);
12760b57cec5SDimitry Andric
12770b57cec5SDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator>
1278480093f4SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
12790b57cec5SDimitry Andric    copy_n(InputIterator first, Size n, OutputIterator result);
12800b57cec5SDimitry Andric
12810b57cec5SDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2>
1282480093f4SDimitry Andric    constexpr BidirectionalIterator2      // constexpr in C++20
12830b57cec5SDimitry Andric    copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
12840b57cec5SDimitry Andric                  BidirectionalIterator2 result);
12850b57cec5SDimitry Andric
128681ad6265SDimitry Andric// [alg.move], move
128781ad6265SDimitry Andrictemplate<class InputIterator, class OutputIterator>
128881ad6265SDimitry Andric    constexpr OutputIterator move(InputIterator first, InputIterator last,
128981ad6265SDimitry Andric                                OutputIterator result);
129081ad6265SDimitry Andric
129181ad6265SDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2>
129281ad6265SDimitry Andric    constexpr BidirectionalIterator2
129381ad6265SDimitry Andric    move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
129481ad6265SDimitry Andric                  BidirectionalIterator2 result);
129581ad6265SDimitry Andric
12960b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1297e8d8bef9SDimitry Andric    constexpr ForwardIterator2    // constexpr in C++20
12980b57cec5SDimitry Andric    swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
12990b57cec5SDimitry Andric
130081ad6265SDimitry Andricnamespace ranges {
130181ad6265SDimitry Andric    template<class I1, class I2>
130281ad6265SDimitry Andric    using swap_ranges_result = in_in_result<I1, I2>;
130381ad6265SDimitry Andric
130481ad6265SDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
130581ad6265SDimitry Andric        requires indirectly_swappable<I1, I2>
130681ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<I1, I2>
130781ad6265SDimitry Andric        swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
130881ad6265SDimitry Andric
130981ad6265SDimitry Andrictemplate<input_range R1, input_range R2>
131081ad6265SDimitry Andric        requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
131181ad6265SDimitry Andric    constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
131281ad6265SDimitry Andric        swap_ranges(R1&& r1, R2&& r2);
131381ad6265SDimitry Andric}
131481ad6265SDimitry Andric
13150b57cec5SDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1316e8d8bef9SDimitry Andric    constexpr void                // constexpr in C++20
13170b57cec5SDimitry Andric    iter_swap(ForwardIterator1 a, ForwardIterator2 b);
13180b57cec5SDimitry Andric
13190b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation>
13200b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13210b57cec5SDimitry Andric    transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
13220b57cec5SDimitry Andric
13230b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
13240b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13250b57cec5SDimitry Andric    transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
13260b57cec5SDimitry Andric              OutputIterator result, BinaryOperation binary_op);
13270b57cec5SDimitry Andric
13280b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
13290b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13300b57cec5SDimitry Andric    replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
13310b57cec5SDimitry Andric
13320b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate, class T>
13330b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13340b57cec5SDimitry Andric    replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
13350b57cec5SDimitry Andric
13360b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
13370b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13380b57cec5SDimitry Andric    replace_copy(InputIterator first, InputIterator last, OutputIterator result,
13390b57cec5SDimitry Andric                 const T& old_value, const T& new_value);
13400b57cec5SDimitry Andric
13410b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T>
13420b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13430b57cec5SDimitry Andric    replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
13440b57cec5SDimitry Andric
13450b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
13460b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13470b57cec5SDimitry Andric    fill(ForwardIterator first, ForwardIterator last, const T& value);
13480b57cec5SDimitry Andric
13490b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class T>
13500b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13510b57cec5SDimitry Andric    fill_n(OutputIterator first, Size n, const T& value);
13520b57cec5SDimitry Andric
13530b57cec5SDimitry Andrictemplate <class ForwardIterator, class Generator>
13540b57cec5SDimitry Andric    constexpr void      // constexpr in C++20
13550b57cec5SDimitry Andric    generate(ForwardIterator first, ForwardIterator last, Generator gen);
13560b57cec5SDimitry Andric
13570b57cec5SDimitry Andrictemplate <class OutputIterator, class Size, class Generator>
13580b57cec5SDimitry Andric    constexpr OutputIterator      // constexpr in C++20
13590b57cec5SDimitry Andric    generate_n(OutputIterator first, Size n, Generator gen);
13600b57cec5SDimitry Andric
13610b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
13620b57cec5SDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
13630b57cec5SDimitry Andric    remove(ForwardIterator first, ForwardIterator last, const T& value);
13640b57cec5SDimitry Andric
13650b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
13660b57cec5SDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
13670b57cec5SDimitry Andric    remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
13680b57cec5SDimitry Andric
13690b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
13700b57cec5SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
13710b57cec5SDimitry Andric    remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
13720b57cec5SDimitry Andric
13730b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate>
13740b57cec5SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
13750b57cec5SDimitry Andric    remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
13760b57cec5SDimitry Andric
13770b57cec5SDimitry Andrictemplate <class ForwardIterator>
1378e8d8bef9SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
13790b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last);
13800b57cec5SDimitry Andric
13810b57cec5SDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1382e8d8bef9SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
13830b57cec5SDimitry Andric    unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
13840b57cec5SDimitry Andric
13850b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator>
1386e8d8bef9SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
13870b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result);
13880b57cec5SDimitry Andric
13890b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate>
1390e8d8bef9SDimitry Andric    constexpr OutputIterator     // constexpr in C++20
13910b57cec5SDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
13920b57cec5SDimitry Andric
13930b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1394e8d8bef9SDimitry Andric    constexpr void               // constexpr in C++20
13950b57cec5SDimitry Andric    reverse(BidirectionalIterator first, BidirectionalIterator last);
13960b57cec5SDimitry Andric
13970b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator>
13980b57cec5SDimitry Andric    constexpr OutputIterator       // constexpr in C++20
13990b57cec5SDimitry Andric    reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
14000b57cec5SDimitry Andric
14010b57cec5SDimitry Andrictemplate <class ForwardIterator>
1402e8d8bef9SDimitry Andric    constexpr ForwardIterator      // constexpr in C++20
14030b57cec5SDimitry Andric    rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
14040b57cec5SDimitry Andric
14050b57cec5SDimitry Andrictemplate <class ForwardIterator, class OutputIterator>
1406e8d8bef9SDimitry Andric    constexpr OutputIterator       // constexpr in C++20
14070b57cec5SDimitry Andric    rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
14080b57cec5SDimitry Andric
14090b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
14100b57cec5SDimitry Andric    void
14110b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
14120b57cec5SDimitry Andric
14130b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator>
14140b57cec5SDimitry Andric    void
14150b57cec5SDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
14160b57cec5SDimitry Andric                   RandomNumberGenerator& rand);  // deprecated in C++14, removed in C++17
14170b57cec5SDimitry Andric
14180b57cec5SDimitry Andrictemplate<class PopulationIterator, class SampleIterator,
14190b57cec5SDimitry Andric         class Distance, class UniformRandomBitGenerator>
14200b57cec5SDimitry Andric    SampleIterator sample(PopulationIterator first, PopulationIterator last,
14210b57cec5SDimitry Andric                          SampleIterator out, Distance n,
14220b57cec5SDimitry Andric                          UniformRandomBitGenerator&& g); // C++17
14230b57cec5SDimitry Andric
14240b57cec5SDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator>
14250b57cec5SDimitry Andric    void shuffle(RandomAccessIterator first, RandomAccessIterator last,
14260b57cec5SDimitry Andric                 UniformRandomNumberGenerator&& g);
14270b57cec5SDimitry Andric
1428e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1429e8d8bef9SDimitry Andric  constexpr ForwardIterator
1430e8d8bef9SDimitry Andric    shift_left(ForwardIterator first, ForwardIterator last,
1431e8d8bef9SDimitry Andric               typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1432e8d8bef9SDimitry Andric
1433e8d8bef9SDimitry Andrictemplate<class ForwardIterator>
1434e8d8bef9SDimitry Andric  constexpr ForwardIterator
1435e8d8bef9SDimitry Andric    shift_right(ForwardIterator first, ForwardIterator last,
1436e8d8bef9SDimitry Andric                typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1437e8d8bef9SDimitry Andric
14380b57cec5SDimitry Andrictemplate <class InputIterator, class Predicate>
14390b57cec5SDimitry Andric    constexpr bool  // constexpr in C++20
14400b57cec5SDimitry Andric    is_partitioned(InputIterator first, InputIterator last, Predicate pred);
14410b57cec5SDimitry Andric
14420b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
1443e8d8bef9SDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
14440b57cec5SDimitry Andric    partition(ForwardIterator first, ForwardIterator last, Predicate pred);
14450b57cec5SDimitry Andric
14460b57cec5SDimitry Andrictemplate <class InputIterator, class OutputIterator1,
14470b57cec5SDimitry Andric          class OutputIterator2, class Predicate>
14480b57cec5SDimitry Andric    constexpr pair<OutputIterator1, OutputIterator2>   // constexpr in C++20
14490b57cec5SDimitry Andric    partition_copy(InputIterator first, InputIterator last,
14500b57cec5SDimitry Andric                   OutputIterator1 out_true, OutputIterator2 out_false,
14510b57cec5SDimitry Andric                   Predicate pred);
14520b57cec5SDimitry Andric
14530b57cec5SDimitry Andrictemplate <class ForwardIterator, class Predicate>
14540b57cec5SDimitry Andric    ForwardIterator
14550b57cec5SDimitry Andric    stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
14560b57cec5SDimitry Andric
14570b57cec5SDimitry Andrictemplate<class ForwardIterator, class Predicate>
14580b57cec5SDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
14590b57cec5SDimitry Andric    partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
14600b57cec5SDimitry Andric
14610b57cec5SDimitry Andrictemplate <class ForwardIterator>
14620b57cec5SDimitry Andric    constexpr bool  // constexpr in C++20
14630b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last);
14640b57cec5SDimitry Andric
14650b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1466e8d8bef9SDimitry Andric    constexpr bool  // constexpr in C++20
14670b57cec5SDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
14680b57cec5SDimitry Andric
14690b57cec5SDimitry Andrictemplate<class ForwardIterator>
14700b57cec5SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
14710b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last);
14720b57cec5SDimitry Andric
14730b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
14740b57cec5SDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
14750b57cec5SDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
14760b57cec5SDimitry Andric
14770b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1478fe6060f1SDimitry Andric    constexpr void               // constexpr in C++20
14790b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last);
14800b57cec5SDimitry Andric
14810b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1482fe6060f1SDimitry Andric    constexpr void               // constexpr in C++20
14830b57cec5SDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
14840b57cec5SDimitry Andric
14850b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
14860b57cec5SDimitry Andric    void
14870b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last);
14880b57cec5SDimitry Andric
14890b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
14900b57cec5SDimitry Andric    void
14910b57cec5SDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
14920b57cec5SDimitry Andric
14930b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1494fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
14950b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
14960b57cec5SDimitry Andric
14970b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1498fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
14990b57cec5SDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
15000b57cec5SDimitry Andric
15010b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator>
1502fe6060f1SDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
15030b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15040b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last);
15050b57cec5SDimitry Andric
15060b57cec5SDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare>
1507fe6060f1SDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
15080b57cec5SDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
15090b57cec5SDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
15100b57cec5SDimitry Andric
15110b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1512fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15130b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
15140b57cec5SDimitry Andric
15150b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1516fe6060f1SDimitry Andric    constexpr void                    // constexpr in C++20
15170b57cec5SDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
15180b57cec5SDimitry Andric
15190b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15200b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15210b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
15220b57cec5SDimitry Andric
15230b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15240b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15250b57cec5SDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15260b57cec5SDimitry Andric
15270b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15280b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15290b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
15300b57cec5SDimitry Andric
15310b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15320b57cec5SDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
15330b57cec5SDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15340b57cec5SDimitry Andric
15350b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15360b57cec5SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
15370b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value);
15380b57cec5SDimitry Andric
15390b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15400b57cec5SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
15410b57cec5SDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15420b57cec5SDimitry Andric
15430b57cec5SDimitry Andrictemplate <class ForwardIterator, class T>
15440b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15450b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value);
15460b57cec5SDimitry Andric
15470b57cec5SDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
15480b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15490b57cec5SDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
15500b57cec5SDimitry Andric
15510b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1552e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15530b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
15540b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result);
15550b57cec5SDimitry Andric
15560b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1557e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15580b57cec5SDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
15590b57cec5SDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
15600b57cec5SDimitry Andric
15610b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
15620b57cec5SDimitry Andric    void
15630b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
15640b57cec5SDimitry Andric
15650b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
15660b57cec5SDimitry Andric    void
15670b57cec5SDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
15680b57cec5SDimitry Andric
15690b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
15700b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15710b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
15720b57cec5SDimitry Andric
15730b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
15740b57cec5SDimitry Andric    constexpr bool                                    // constexpr in C++20
15750b57cec5SDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
15760b57cec5SDimitry Andric
15770b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1578e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15790b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
15800b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result);
15810b57cec5SDimitry Andric
15820b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1583e8d8bef9SDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
15840b57cec5SDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
15850b57cec5SDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
15860b57cec5SDimitry Andric
15870b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
15880b57cec5SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
15890b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
15900b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result);
15910b57cec5SDimitry Andric
15920b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
15930b57cec5SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
15940b57cec5SDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
15950b57cec5SDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
15960b57cec5SDimitry Andric
15970b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1598e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
15990b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16000b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16010b57cec5SDimitry Andric
16020b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1603e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16040b57cec5SDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
16050b57cec5SDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16060b57cec5SDimitry Andric
16070b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1608e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16090b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16100b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result);
16110b57cec5SDimitry Andric
16120b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1613e8d8bef9SDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
16140b57cec5SDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
16150b57cec5SDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
16160b57cec5SDimitry Andric
16170b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1618fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16190b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last);
16200b57cec5SDimitry Andric
16210b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1622fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16230b57cec5SDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16240b57cec5SDimitry Andric
16250b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1626fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16270b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last);
16280b57cec5SDimitry Andric
16290b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1630fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16310b57cec5SDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16320b57cec5SDimitry Andric
16330b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1634fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16350b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last);
16360b57cec5SDimitry Andric
16370b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1638fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16390b57cec5SDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16400b57cec5SDimitry Andric
16410b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
1642fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16430b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last);
16440b57cec5SDimitry Andric
16450b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1646fe6060f1SDimitry Andric    constexpr void                                   // constexpr in C++20
16470b57cec5SDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
16480b57cec5SDimitry Andric
16490b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
16500b57cec5SDimitry Andric    constexpr bool   // constexpr in C++20
16510b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last);
16520b57cec5SDimitry Andric
16530b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
16540b57cec5SDimitry Andric    constexpr bool   // constexpr in C++20
16550b57cec5SDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
16560b57cec5SDimitry Andric
16570b57cec5SDimitry Andrictemplate <class RandomAccessIterator>
16580b57cec5SDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
16590b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
16600b57cec5SDimitry Andric
16610b57cec5SDimitry Andrictemplate <class RandomAccessIterator, class Compare>
16620b57cec5SDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
16630b57cec5SDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
16640b57cec5SDimitry Andric
16650b57cec5SDimitry Andrictemplate <class ForwardIterator>
1666e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1667e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last);
16680b57cec5SDimitry Andric
16690b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1670e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1671e8d8bef9SDimitry Andric    min_element(ForwardIterator first, ForwardIterator last, Compare comp);
16720b57cec5SDimitry Andric
16730b57cec5SDimitry Andrictemplate <class T>
1674e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1675e8d8bef9SDimitry Andric    min(const T& a, const T& b);
16760b57cec5SDimitry Andric
16770b57cec5SDimitry Andrictemplate <class T, class Compare>
1678e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1679e8d8bef9SDimitry Andric    min(const T& a, const T& b, Compare comp);
16800b57cec5SDimitry Andric
16810b57cec5SDimitry Andrictemplate<class T>
1682e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1683e8d8bef9SDimitry Andric    min(initializer_list<T> t);
16840b57cec5SDimitry Andric
16850b57cec5SDimitry Andrictemplate<class T, class Compare>
1686e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1687e8d8bef9SDimitry Andric    min(initializer_list<T> t, Compare comp);
16880b57cec5SDimitry Andric
16890b57cec5SDimitry Andrictemplate<class T>
16900b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi);               // C++17
16910b57cec5SDimitry Andric
16920b57cec5SDimitry Andrictemplate<class T, class Compare>
16930b57cec5SDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
16940b57cec5SDimitry Andric
16950b57cec5SDimitry Andrictemplate <class ForwardIterator>
1696e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1697e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last);
16980b57cec5SDimitry Andric
16990b57cec5SDimitry Andrictemplate <class ForwardIterator, class Compare>
1700e8d8bef9SDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1701e8d8bef9SDimitry Andric    max_element(ForwardIterator first, ForwardIterator last, Compare comp);
17020b57cec5SDimitry Andric
17030b57cec5SDimitry Andrictemplate <class T>
1704e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1705e8d8bef9SDimitry Andric    max(const T& a, const T& b);
17060b57cec5SDimitry Andric
17070b57cec5SDimitry Andrictemplate <class T, class Compare>
1708e8d8bef9SDimitry Andric    constexpr const T&               // constexpr in C++14
1709e8d8bef9SDimitry Andric    max(const T& a, const T& b, Compare comp);
17100b57cec5SDimitry Andric
17110b57cec5SDimitry Andrictemplate<class T>
1712e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1713e8d8bef9SDimitry Andric    max(initializer_list<T> t);
17140b57cec5SDimitry Andric
17150b57cec5SDimitry Andrictemplate<class T, class Compare>
1716e8d8bef9SDimitry Andric    constexpr T                      // constexpr in C++14
1717e8d8bef9SDimitry Andric    max(initializer_list<T> t, Compare comp);
17180b57cec5SDimitry Andric
17190b57cec5SDimitry Andrictemplate<class ForwardIterator>
1720e8d8bef9SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1721e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last);
17220b57cec5SDimitry Andric
17230b57cec5SDimitry Andrictemplate<class ForwardIterator, class Compare>
1724e8d8bef9SDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1725e8d8bef9SDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
17260b57cec5SDimitry Andric
17270b57cec5SDimitry Andrictemplate<class T>
1728e8d8bef9SDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1729e8d8bef9SDimitry Andric    minmax(const T& a, const T& b);
17300b57cec5SDimitry Andric
17310b57cec5SDimitry Andrictemplate<class T, class Compare>
1732e8d8bef9SDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1733e8d8bef9SDimitry Andric    minmax(const T& a, const T& b, Compare comp);
17340b57cec5SDimitry Andric
17350b57cec5SDimitry Andrictemplate<class T>
1736e8d8bef9SDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1737e8d8bef9SDimitry Andric    minmax(initializer_list<T> t);
17380b57cec5SDimitry Andric
17390b57cec5SDimitry Andrictemplate<class T, class Compare>
1740e8d8bef9SDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1741e8d8bef9SDimitry Andric    minmax(initializer_list<T> t, Compare comp);
17420b57cec5SDimitry Andric
17430b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2>
17440b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
17450b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
17460b57cec5SDimitry Andric
17470b57cec5SDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
17480b57cec5SDimitry Andric    constexpr bool     // constexpr in C++20
17490b57cec5SDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
17500b57cec5SDimitry Andric                            InputIterator2 first2, InputIterator2 last2, Compare comp);
17510b57cec5SDimitry Andric
175206c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2, class Cmp>
175306c3fb27SDimitry Andric    constexpr auto
175406c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
175506c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2,
175606c3fb27SDimitry Andric                                      Cmp comp)
175706c3fb27SDimitry Andric      -> decltype(comp(*b1, *b2));                                                        // since C++20
175806c3fb27SDimitry Andric
175906c3fb27SDimitry Andrictemplate<class InputIterator1, class InputIterator2>
176006c3fb27SDimitry Andric    constexpr auto
176106c3fb27SDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
176206c3fb27SDimitry Andric                                      InputIterator2 first2, InputIterator2 last2);      // since C++20
176306c3fb27SDimitry Andric
17640b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1765e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
17660b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last);
17670b57cec5SDimitry Andric
17680b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1769e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
17700b57cec5SDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
17710b57cec5SDimitry Andric
17720b57cec5SDimitry Andrictemplate <class BidirectionalIterator>
1773e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
17740b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
17750b57cec5SDimitry Andric
17760b57cec5SDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1777e8d8bef9SDimitry Andric    constexpr bool     // constexpr in C++20
17780b57cec5SDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
17790b57cec5SDimitry Andric}  // std
17800b57cec5SDimitry Andric
17810b57cec5SDimitry Andric*/
17820b57cec5SDimitry Andric
178381ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler
17840b57cec5SDimitry Andric#include <__config>
17850b57cec5SDimitry Andric#include <version>
17860b57cec5SDimitry Andric
1787fe6060f1SDimitry Andric#include <__algorithm/adjacent_find.h>
1788fe6060f1SDimitry Andric#include <__algorithm/all_of.h>
1789fe6060f1SDimitry Andric#include <__algorithm/any_of.h>
1790fe6060f1SDimitry Andric#include <__algorithm/binary_search.h>
1791fe6060f1SDimitry Andric#include <__algorithm/clamp.h>
1792fe6060f1SDimitry Andric#include <__algorithm/comp.h>
1793fe6060f1SDimitry Andric#include <__algorithm/comp_ref_type.h>
1794fe6060f1SDimitry Andric#include <__algorithm/copy.h>
1795fe6060f1SDimitry Andric#include <__algorithm/copy_backward.h>
1796fe6060f1SDimitry Andric#include <__algorithm/copy_if.h>
1797fe6060f1SDimitry Andric#include <__algorithm/copy_n.h>
1798fe6060f1SDimitry Andric#include <__algorithm/count.h>
1799fe6060f1SDimitry Andric#include <__algorithm/count_if.h>
1800fe6060f1SDimitry Andric#include <__algorithm/equal.h>
1801fe6060f1SDimitry Andric#include <__algorithm/equal_range.h>
1802fe6060f1SDimitry Andric#include <__algorithm/fill.h>
180304eeddc0SDimitry Andric#include <__algorithm/fill_n.h>
1804fe6060f1SDimitry Andric#include <__algorithm/find.h>
1805fe6060f1SDimitry Andric#include <__algorithm/find_end.h>
1806fe6060f1SDimitry Andric#include <__algorithm/find_first_of.h>
1807fe6060f1SDimitry Andric#include <__algorithm/find_if.h>
1808fe6060f1SDimitry Andric#include <__algorithm/find_if_not.h>
1809*cb14a3feSDimitry Andric#include <__algorithm/fold.h>
1810fe6060f1SDimitry Andric#include <__algorithm/for_each.h>
1811fe6060f1SDimitry Andric#include <__algorithm/for_each_n.h>
1812fe6060f1SDimitry Andric#include <__algorithm/generate.h>
181304eeddc0SDimitry Andric#include <__algorithm/generate_n.h>
1814fe6060f1SDimitry Andric#include <__algorithm/half_positive.h>
181581ad6265SDimitry Andric#include <__algorithm/in_found_result.h>
181681ad6265SDimitry Andric#include <__algorithm/in_fun_result.h>
18171fd87a68SDimitry Andric#include <__algorithm/in_in_out_result.h>
181804eeddc0SDimitry Andric#include <__algorithm/in_in_result.h>
181981ad6265SDimitry Andric#include <__algorithm/in_out_out_result.h>
182004eeddc0SDimitry Andric#include <__algorithm/in_out_result.h>
1821fe6060f1SDimitry Andric#include <__algorithm/includes.h>
1822fe6060f1SDimitry Andric#include <__algorithm/inplace_merge.h>
1823fe6060f1SDimitry Andric#include <__algorithm/is_heap.h>
1824fe6060f1SDimitry Andric#include <__algorithm/is_heap_until.h>
1825fe6060f1SDimitry Andric#include <__algorithm/is_partitioned.h>
1826fe6060f1SDimitry Andric#include <__algorithm/is_permutation.h>
1827fe6060f1SDimitry Andric#include <__algorithm/is_sorted.h>
1828fe6060f1SDimitry Andric#include <__algorithm/is_sorted_until.h>
1829fe6060f1SDimitry Andric#include <__algorithm/iter_swap.h>
1830fe6060f1SDimitry Andric#include <__algorithm/lexicographical_compare.h>
183106c3fb27SDimitry Andric#include <__algorithm/lexicographical_compare_three_way.h>
1832fe6060f1SDimitry Andric#include <__algorithm/lower_bound.h>
1833fe6060f1SDimitry Andric#include <__algorithm/make_heap.h>
1834fe6060f1SDimitry Andric#include <__algorithm/max.h>
1835fe6060f1SDimitry Andric#include <__algorithm/max_element.h>
1836fe6060f1SDimitry Andric#include <__algorithm/merge.h>
1837fe6060f1SDimitry Andric#include <__algorithm/min.h>
1838fe6060f1SDimitry Andric#include <__algorithm/min_element.h>
183981ad6265SDimitry Andric#include <__algorithm/min_max_result.h>
1840fe6060f1SDimitry Andric#include <__algorithm/minmax.h>
1841fe6060f1SDimitry Andric#include <__algorithm/minmax_element.h>
1842fe6060f1SDimitry Andric#include <__algorithm/mismatch.h>
1843fe6060f1SDimitry Andric#include <__algorithm/move.h>
1844fe6060f1SDimitry Andric#include <__algorithm/move_backward.h>
1845fe6060f1SDimitry Andric#include <__algorithm/next_permutation.h>
1846fe6060f1SDimitry Andric#include <__algorithm/none_of.h>
1847fe6060f1SDimitry Andric#include <__algorithm/nth_element.h>
1848fe6060f1SDimitry Andric#include <__algorithm/partial_sort.h>
1849fe6060f1SDimitry Andric#include <__algorithm/partial_sort_copy.h>
1850fe6060f1SDimitry Andric#include <__algorithm/partition.h>
1851fe6060f1SDimitry Andric#include <__algorithm/partition_copy.h>
1852fe6060f1SDimitry Andric#include <__algorithm/partition_point.h>
1853fe6060f1SDimitry Andric#include <__algorithm/pop_heap.h>
1854fe6060f1SDimitry Andric#include <__algorithm/prev_permutation.h>
185506c3fb27SDimitry Andric#include <__algorithm/pstl_any_all_none_of.h>
185606c3fb27SDimitry Andric#include <__algorithm/pstl_copy.h>
185706c3fb27SDimitry Andric#include <__algorithm/pstl_count.h>
18585f757f3fSDimitry Andric#include <__algorithm/pstl_equal.h>
185906c3fb27SDimitry Andric#include <__algorithm/pstl_fill.h>
186006c3fb27SDimitry Andric#include <__algorithm/pstl_find.h>
186106c3fb27SDimitry Andric#include <__algorithm/pstl_for_each.h>
186206c3fb27SDimitry Andric#include <__algorithm/pstl_generate.h>
186306c3fb27SDimitry Andric#include <__algorithm/pstl_is_partitioned.h>
186406c3fb27SDimitry Andric#include <__algorithm/pstl_merge.h>
18655f757f3fSDimitry Andric#include <__algorithm/pstl_move.h>
186606c3fb27SDimitry Andric#include <__algorithm/pstl_replace.h>
18675f757f3fSDimitry Andric#include <__algorithm/pstl_rotate_copy.h>
186806c3fb27SDimitry Andric#include <__algorithm/pstl_sort.h>
186906c3fb27SDimitry Andric#include <__algorithm/pstl_stable_sort.h>
187006c3fb27SDimitry Andric#include <__algorithm/pstl_transform.h>
1871fe6060f1SDimitry Andric#include <__algorithm/push_heap.h>
187281ad6265SDimitry Andric#include <__algorithm/ranges_adjacent_find.h>
187381ad6265SDimitry Andric#include <__algorithm/ranges_all_of.h>
187481ad6265SDimitry Andric#include <__algorithm/ranges_any_of.h>
187581ad6265SDimitry Andric#include <__algorithm/ranges_binary_search.h>
187661cfbce3SDimitry Andric#include <__algorithm/ranges_clamp.h>
1877*cb14a3feSDimitry Andric#include <__algorithm/ranges_contains.h>
187881ad6265SDimitry Andric#include <__algorithm/ranges_copy.h>
187981ad6265SDimitry Andric#include <__algorithm/ranges_copy_backward.h>
188081ad6265SDimitry Andric#include <__algorithm/ranges_copy_if.h>
188181ad6265SDimitry Andric#include <__algorithm/ranges_copy_n.h>
188281ad6265SDimitry Andric#include <__algorithm/ranges_count.h>
188381ad6265SDimitry Andric#include <__algorithm/ranges_count_if.h>
18845f757f3fSDimitry Andric#include <__algorithm/ranges_ends_with.h>
188581ad6265SDimitry Andric#include <__algorithm/ranges_equal.h>
1886fcaf7f86SDimitry Andric#include <__algorithm/ranges_equal_range.h>
188781ad6265SDimitry Andric#include <__algorithm/ranges_fill.h>
188881ad6265SDimitry Andric#include <__algorithm/ranges_fill_n.h>
188981ad6265SDimitry Andric#include <__algorithm/ranges_find.h>
1890753f127fSDimitry Andric#include <__algorithm/ranges_find_end.h>
189181ad6265SDimitry Andric#include <__algorithm/ranges_find_first_of.h>
189281ad6265SDimitry Andric#include <__algorithm/ranges_find_if.h>
189381ad6265SDimitry Andric#include <__algorithm/ranges_find_if_not.h>
189481ad6265SDimitry Andric#include <__algorithm/ranges_for_each.h>
189581ad6265SDimitry Andric#include <__algorithm/ranges_for_each_n.h>
1896972a253aSDimitry Andric#include <__algorithm/ranges_generate.h>
1897972a253aSDimitry Andric#include <__algorithm/ranges_generate_n.h>
1898fcaf7f86SDimitry Andric#include <__algorithm/ranges_includes.h>
189961cfbce3SDimitry Andric#include <__algorithm/ranges_inplace_merge.h>
1900972a253aSDimitry Andric#include <__algorithm/ranges_is_heap.h>
1901972a253aSDimitry Andric#include <__algorithm/ranges_is_heap_until.h>
190281ad6265SDimitry Andric#include <__algorithm/ranges_is_partitioned.h>
190361cfbce3SDimitry Andric#include <__algorithm/ranges_is_permutation.h>
190481ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted.h>
190581ad6265SDimitry Andric#include <__algorithm/ranges_is_sorted_until.h>
190681ad6265SDimitry Andric#include <__algorithm/ranges_lexicographical_compare.h>
190781ad6265SDimitry Andric#include <__algorithm/ranges_lower_bound.h>
1908753f127fSDimitry Andric#include <__algorithm/ranges_make_heap.h>
190981ad6265SDimitry Andric#include <__algorithm/ranges_max.h>
191081ad6265SDimitry Andric#include <__algorithm/ranges_max_element.h>
1911753f127fSDimitry Andric#include <__algorithm/ranges_merge.h>
191281ad6265SDimitry Andric#include <__algorithm/ranges_min.h>
191381ad6265SDimitry Andric#include <__algorithm/ranges_min_element.h>
191481ad6265SDimitry Andric#include <__algorithm/ranges_minmax.h>
191581ad6265SDimitry Andric#include <__algorithm/ranges_minmax_element.h>
191681ad6265SDimitry Andric#include <__algorithm/ranges_mismatch.h>
191781ad6265SDimitry Andric#include <__algorithm/ranges_move.h>
191881ad6265SDimitry Andric#include <__algorithm/ranges_move_backward.h>
191961cfbce3SDimitry Andric#include <__algorithm/ranges_next_permutation.h>
192081ad6265SDimitry Andric#include <__algorithm/ranges_none_of.h>
1921753f127fSDimitry Andric#include <__algorithm/ranges_nth_element.h>
1922fcaf7f86SDimitry Andric#include <__algorithm/ranges_partial_sort.h>
192361cfbce3SDimitry Andric#include <__algorithm/ranges_partial_sort_copy.h>
1924fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition.h>
1925fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_copy.h>
1926fcaf7f86SDimitry Andric#include <__algorithm/ranges_partition_point.h>
1927753f127fSDimitry Andric#include <__algorithm/ranges_pop_heap.h>
192861cfbce3SDimitry Andric#include <__algorithm/ranges_prev_permutation.h>
1929753f127fSDimitry Andric#include <__algorithm/ranges_push_heap.h>
1930753f127fSDimitry Andric#include <__algorithm/ranges_remove.h>
193161cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy.h>
193261cfbce3SDimitry Andric#include <__algorithm/ranges_remove_copy_if.h>
1933753f127fSDimitry Andric#include <__algorithm/ranges_remove_if.h>
193481ad6265SDimitry Andric#include <__algorithm/ranges_replace.h>
193561cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy.h>
193661cfbce3SDimitry Andric#include <__algorithm/ranges_replace_copy_if.h>
193781ad6265SDimitry Andric#include <__algorithm/ranges_replace_if.h>
193881ad6265SDimitry Andric#include <__algorithm/ranges_reverse.h>
1939753f127fSDimitry Andric#include <__algorithm/ranges_reverse_copy.h>
194061cfbce3SDimitry Andric#include <__algorithm/ranges_rotate.h>
1941753f127fSDimitry Andric#include <__algorithm/ranges_rotate_copy.h>
194261cfbce3SDimitry Andric#include <__algorithm/ranges_sample.h>
1943753f127fSDimitry Andric#include <__algorithm/ranges_search.h>
1944753f127fSDimitry Andric#include <__algorithm/ranges_search_n.h>
1945753f127fSDimitry Andric#include <__algorithm/ranges_set_difference.h>
1946753f127fSDimitry Andric#include <__algorithm/ranges_set_intersection.h>
1947753f127fSDimitry Andric#include <__algorithm/ranges_set_symmetric_difference.h>
1948fcaf7f86SDimitry Andric#include <__algorithm/ranges_set_union.h>
1949fcaf7f86SDimitry Andric#include <__algorithm/ranges_shuffle.h>
195081ad6265SDimitry Andric#include <__algorithm/ranges_sort.h>
1951753f127fSDimitry Andric#include <__algorithm/ranges_sort_heap.h>
1952fcaf7f86SDimitry Andric#include <__algorithm/ranges_stable_partition.h>
195381ad6265SDimitry Andric#include <__algorithm/ranges_stable_sort.h>
195406c3fb27SDimitry Andric#include <__algorithm/ranges_starts_with.h>
195581ad6265SDimitry Andric#include <__algorithm/ranges_swap_ranges.h>
195681ad6265SDimitry Andric#include <__algorithm/ranges_transform.h>
195761cfbce3SDimitry Andric#include <__algorithm/ranges_unique.h>
195861cfbce3SDimitry Andric#include <__algorithm/ranges_unique_copy.h>
195981ad6265SDimitry Andric#include <__algorithm/ranges_upper_bound.h>
1960fe6060f1SDimitry Andric#include <__algorithm/remove.h>
1961fe6060f1SDimitry Andric#include <__algorithm/remove_copy.h>
1962fe6060f1SDimitry Andric#include <__algorithm/remove_copy_if.h>
1963fe6060f1SDimitry Andric#include <__algorithm/remove_if.h>
1964fe6060f1SDimitry Andric#include <__algorithm/replace.h>
1965fe6060f1SDimitry Andric#include <__algorithm/replace_copy.h>
1966fe6060f1SDimitry Andric#include <__algorithm/replace_copy_if.h>
1967fe6060f1SDimitry Andric#include <__algorithm/replace_if.h>
1968fe6060f1SDimitry Andric#include <__algorithm/reverse.h>
1969fe6060f1SDimitry Andric#include <__algorithm/reverse_copy.h>
1970fe6060f1SDimitry Andric#include <__algorithm/rotate.h>
1971fe6060f1SDimitry Andric#include <__algorithm/rotate_copy.h>
1972fe6060f1SDimitry Andric#include <__algorithm/sample.h>
1973fe6060f1SDimitry Andric#include <__algorithm/search.h>
1974fe6060f1SDimitry Andric#include <__algorithm/search_n.h>
1975fe6060f1SDimitry Andric#include <__algorithm/set_difference.h>
1976fe6060f1SDimitry Andric#include <__algorithm/set_intersection.h>
1977fe6060f1SDimitry Andric#include <__algorithm/set_symmetric_difference.h>
1978fe6060f1SDimitry Andric#include <__algorithm/set_union.h>
1979fe6060f1SDimitry Andric#include <__algorithm/shift_left.h>
1980fe6060f1SDimitry Andric#include <__algorithm/shift_right.h>
1981fe6060f1SDimitry Andric#include <__algorithm/shuffle.h>
1982fe6060f1SDimitry Andric#include <__algorithm/sift_down.h>
1983fe6060f1SDimitry Andric#include <__algorithm/sort.h>
1984fe6060f1SDimitry Andric#include <__algorithm/sort_heap.h>
1985fe6060f1SDimitry Andric#include <__algorithm/stable_partition.h>
1986fe6060f1SDimitry Andric#include <__algorithm/stable_sort.h>
1987fe6060f1SDimitry Andric#include <__algorithm/swap_ranges.h>
1988fe6060f1SDimitry Andric#include <__algorithm/transform.h>
1989fe6060f1SDimitry Andric#include <__algorithm/unique.h>
199004eeddc0SDimitry Andric#include <__algorithm/unique_copy.h>
1991fe6060f1SDimitry Andric#include <__algorithm/unwrap_iter.h>
1992fe6060f1SDimitry Andric#include <__algorithm/upper_bound.h>
19930b57cec5SDimitry Andric
199481ad6265SDimitry Andric// standard-mandated includes
1995bdd1243dSDimitry Andric
1996bdd1243dSDimitry Andric// [algorithm.syn]
199781ad6265SDimitry Andric#include <initializer_list>
199881ad6265SDimitry Andric
19990b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20000b57cec5SDimitry Andric#  pragma GCC system_header
20010b57cec5SDimitry Andric#endif
20020b57cec5SDimitry Andric
2003bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2004bdd1243dSDimitry Andric#  include <atomic>
200506c3fb27SDimitry Andric#  include <bit>
2006bdd1243dSDimitry Andric#  include <concepts>
200706c3fb27SDimitry Andric#  include <cstdlib>
2008bdd1243dSDimitry Andric#  include <cstring>
2009bdd1243dSDimitry Andric#  include <iterator>
2010bdd1243dSDimitry Andric#  include <memory>
2011bdd1243dSDimitry Andric#  include <stdexcept>
201206c3fb27SDimitry Andric#  include <type_traits>
2013bdd1243dSDimitry Andric#  include <utility>
2014bdd1243dSDimitry Andric#endif
2015bdd1243dSDimitry Andric
20160b57cec5SDimitry Andric#endif // _LIBCPP_ALGORITHM
2017