xref: /freebsd/contrib/llvm-project/libcxx/include/__cxx03/algorithm (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_ALGORITHM
11*700637cbSDimitry Andric#define _LIBCPP___CXX03_ALGORITHM
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric/*
14*700637cbSDimitry Andric    algorithm synopsis
15*700637cbSDimitry Andric
16*700637cbSDimitry Andric#include <__cxx03/initializer_list>
17*700637cbSDimitry Andric
18*700637cbSDimitry Andricnamespace std
19*700637cbSDimitry Andric{
20*700637cbSDimitry Andric
21*700637cbSDimitry Andricnamespace ranges {
22*700637cbSDimitry Andric
23*700637cbSDimitry Andric  // [algorithms.results], algorithm result types
24*700637cbSDimitry Andric  template <class I, class F>
25*700637cbSDimitry Andric    struct in_fun_result;                // since C++20
26*700637cbSDimitry Andric
27*700637cbSDimitry Andric  template <class I1, class I2>
28*700637cbSDimitry Andric    struct in_in_result;                 // since C++20
29*700637cbSDimitry Andric
30*700637cbSDimitry Andric  template <class I, class O>
31*700637cbSDimitry Andric    struct in_out_result;                // since C++20
32*700637cbSDimitry Andric
33*700637cbSDimitry Andric  template <class I1, class I2, class O>
34*700637cbSDimitry Andric    struct in_in_out_result;             // since C++20
35*700637cbSDimitry Andric
36*700637cbSDimitry Andric  template <class I, class O1, class O2>
37*700637cbSDimitry Andric    struct in_out_out_result;            // since C++20
38*700637cbSDimitry Andric
39*700637cbSDimitry Andric  template <class I1, class I2>
40*700637cbSDimitry Andric    struct min_max_result;               // since C++20
41*700637cbSDimitry Andric
42*700637cbSDimitry Andric  template <class I>
43*700637cbSDimitry Andric    struct in_found_result;              // since C++20
44*700637cbSDimitry Andric
45*700637cbSDimitry Andric  template <class I, class T>
46*700637cbSDimitry Andric    struct in_value_result;              // since C++23
47*700637cbSDimitry Andric
48*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
49*700637cbSDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>                                   // since C++20
50*700637cbSDimitry Andric  constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
51*700637cbSDimitry Andric
52*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
53*700637cbSDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>                       // since C++20
54*700637cbSDimitry Andric  constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
55*700637cbSDimitry Andric
56*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57*700637cbSDimitry Andric    indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
58*700637cbSDimitry Andric  constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {});                       // since C++20
59*700637cbSDimitry Andric
60*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
61*700637cbSDimitry Andric    indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
62*700637cbSDimitry Andric  constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {});            // since C++20
63*700637cbSDimitry Andric
64*700637cbSDimitry Andric  template<class I1, class I2>
65*700637cbSDimitry Andric    using mismatch_result = in_in_result<I1, I2>;
66*700637cbSDimitry Andric
67*700637cbSDimitry Andric  template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
68*700637cbSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
69*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
70*700637cbSDimitry Andric  constexpr mismatch_result<_I1, _I2>                                                                     // since C++20
71*700637cbSDimitry Andric  mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
72*700637cbSDimitry Andric
73*700637cbSDimitry Andric  template <input_range R1, input_range R2,
74*700637cbSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
75*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
76*700637cbSDimitry Andric  constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
77*700637cbSDimitry Andric  mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})                          // since C++20
78*700637cbSDimitry Andric
79*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
80*700637cbSDimitry Andric    constexpr I find(I first, S last, const T& value, Proj proj = {});                                    // since C++20
81*700637cbSDimitry Andric
82*700637cbSDimitry Andric  template<input_range R, class T, class Proj = identity>
83*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
84*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
85*700637cbSDimitry Andric      find(R&& r, const T& value, Proj proj = {});                                                        // since C++20
86*700637cbSDimitry Andric
87*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
88*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
89*700637cbSDimitry Andric    constexpr I find_if(I first, S last, Pred pred, Proj proj = {});                                      // since C++20
90*700637cbSDimitry Andric
91*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
92*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
93*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
94*700637cbSDimitry Andric      find_if(R&& r, Pred pred, Proj proj = {});                                                          // since C++20
95*700637cbSDimitry Andric
96*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
97*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
98*700637cbSDimitry Andric    constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});                                  // since C++20
99*700637cbSDimitry Andric
100*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
101*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
102*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
103*700637cbSDimitry Andric      find_if_not(R&& r, Pred pred, Proj proj = {});                                                      // since C++20
104*700637cbSDimitry Andric
105*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
106*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
107*700637cbSDimitry Andric    constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {});                     // since C++23
108*700637cbSDimitry Andric
109*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity>
110*700637cbSDimitry Andric    requires
111*700637cbSDimitry Andric      indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
112*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {});                   // since C++23
113*700637cbSDimitry Andric
114*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
115*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
116*700637cbSDimitry Andric    constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {});                      // since C++23
117*700637cbSDimitry Andric
118*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
119*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
120*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {});                     // since C++23
121*700637cbSDimitry Andric
122*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
123*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
124*700637cbSDimitry Andric    constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {});                  // since C++23
125*700637cbSDimitry Andric
126*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
127*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
128*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {});                 // since C++23
129*700637cbSDimitry Andric
130*700637cbSDimitry Andric  template<class T, class Proj = identity,
131*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
132*700637cbSDimitry Andric    constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
133*700637cbSDimitry Andric
134*700637cbSDimitry Andric  template<copyable T, class Proj = identity,
135*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
136*700637cbSDimitry Andric    constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
137*700637cbSDimitry Andric
138*700637cbSDimitry Andric template<input_range R, class Proj = identity,
139*700637cbSDimitry Andric          indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
140*700637cbSDimitry Andric   requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
141*700637cbSDimitry Andric   constexpr range_value_t<R>
142*700637cbSDimitry Andric     min(R&& r, Comp comp = {}, Proj proj = {});                                                          // since C++20
143*700637cbSDimitry Andric
144*700637cbSDimitry Andric  template<class T, class Proj = identity,
145*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
146*700637cbSDimitry Andric    constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {});                       // since C++20
147*700637cbSDimitry Andric
148*700637cbSDimitry Andric  template<copyable T, class Proj = identity,
149*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
150*700637cbSDimitry Andric    constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {});                               // since C++20
151*700637cbSDimitry Andric
152*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
153*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
154*700637cbSDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
155*700637cbSDimitry Andric    constexpr range_value_t<R>
156*700637cbSDimitry Andric      max(R&& r, Comp comp = {}, Proj proj = {});                                                         // since C++20
157*700637cbSDimitry Andric
158*700637cbSDimitry Andric  template<class I, class O>
159*700637cbSDimitry Andric    using unary_transform_result = in_out_result<I, O>;                                                   // since C++20
160*700637cbSDimitry Andric
161*700637cbSDimitry Andric  template<class I1, class I2, class O>
162*700637cbSDimitry Andric    using binary_transform_result = in_in_out_result<I1, I2, O>;                                          // since C++20
163*700637cbSDimitry Andric
164*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
165*700637cbSDimitry Andric           copy_constructible F, class Proj = identity>
166*700637cbSDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
167*700637cbSDimitry Andric    constexpr ranges::unary_transform_result<I, O>
168*700637cbSDimitry Andric      transform(I first1, S last1, O result, F op, Proj proj = {});                                       // since C++20
169*700637cbSDimitry Andric
170*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, copy_constructible F,
171*700637cbSDimitry Andric           class Proj = identity>
172*700637cbSDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
173*700637cbSDimitry Andric    constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
174*700637cbSDimitry Andric      transform(R&& r, O result, F op, Proj proj = {});                                                   // since C++20
175*700637cbSDimitry Andric
176*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
177*700637cbSDimitry Andric           weakly_incrementable O, copy_constructible F, class Proj1 = identity,
178*700637cbSDimitry Andric           class Proj2 = identity>
179*700637cbSDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
180*700637cbSDimitry Andric                                           projected<I2, Proj2>>>
181*700637cbSDimitry Andric    constexpr ranges::binary_transform_result<I1, I2, O>
182*700637cbSDimitry Andric      transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
183*700637cbSDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
184*700637cbSDimitry Andric
185*700637cbSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
186*700637cbSDimitry Andric           copy_constructible F, class Proj1 = identity, class Proj2 = identity>
187*700637cbSDimitry Andric    requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
188*700637cbSDimitry Andric                                           projected<iterator_t<R2>, Proj2>>>
189*700637cbSDimitry Andric    constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
190*700637cbSDimitry Andric      transform(R1&& r1, R2&& r2, O result,
191*700637cbSDimitry Andric                        F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
192*700637cbSDimitry Andric
193*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
194*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
195*700637cbSDimitry Andric    constexpr iter_difference_t<I>
196*700637cbSDimitry Andric      count(I first, S last, const T& value, Proj proj = {});                                             // since C++20
197*700637cbSDimitry Andric
198*700637cbSDimitry Andric  template<input_range R, class T, class Proj = identity>
199*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
200*700637cbSDimitry Andric    constexpr range_difference_t<R>
201*700637cbSDimitry Andric      count(R&& r, const T& value, Proj proj = {});                                                       // since C++20
202*700637cbSDimitry Andric
203*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
204*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
205*700637cbSDimitry Andric    constexpr iter_difference_t<I>
206*700637cbSDimitry Andric      count_if(I first, S last, Pred pred, Proj proj = {});                                               // since C++20
207*700637cbSDimitry Andric
208*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
209*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
210*700637cbSDimitry Andric    constexpr range_difference_t<R>
211*700637cbSDimitry Andric      count_if(R&& r, Pred pred, Proj proj = {});                                                         // since C++20
212*700637cbSDimitry Andric
213*700637cbSDimitry Andric  template<class T>
214*700637cbSDimitry Andric  using minmax_result = min_max_result<T>;
215*700637cbSDimitry Andric
216*700637cbSDimitry Andric  template<class T, class Proj = identity,
217*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
218*700637cbSDimitry Andric    constexpr ranges::minmax_result<const T&>
219*700637cbSDimitry Andric      minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});                                     // since C++20
220*700637cbSDimitry Andric
221*700637cbSDimitry Andric  template<copyable T, class Proj = identity,
222*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
223*700637cbSDimitry Andric    constexpr ranges::minmax_result<T>
224*700637cbSDimitry Andric      minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {});                                      // since C++20
225*700637cbSDimitry Andric
226*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
227*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
228*700637cbSDimitry Andric    requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
229*700637cbSDimitry Andric    constexpr ranges::minmax_result<range_value_t<R>>
230*700637cbSDimitry Andric      minmax(R&& r, Comp comp = {}, Proj proj = {});                                                      // since C++20
231*700637cbSDimitry Andric
232*700637cbSDimitry Andric  template<class I>
233*700637cbSDimitry Andric  using minmax_element_result = min_max_result<I>;
234*700637cbSDimitry Andric
235*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
236*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
237*700637cbSDimitry Andric    constexpr ranges::minmax_element_result<I>
238*700637cbSDimitry Andric      minmax_element(I first, S last, Comp comp = {}, Proj proj = {});                                    // since C++20
239*700637cbSDimitry Andric
240*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
241*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
242*700637cbSDimitry Andric    constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
243*700637cbSDimitry Andric      minmax_element(R&& r, Comp comp = {}, Proj proj = {});                                              // since C++20
244*700637cbSDimitry Andric
245*700637cbSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1,
246*700637cbSDimitry Andric           forward_iterator I2, sentinel_for<I2> S2,
247*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
248*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
249*700637cbSDimitry Andric    constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
250*700637cbSDimitry Andric                                     Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
251*700637cbSDimitry Andric
252*700637cbSDimitry Andric  template<forward_range R1, forward_range R2,
253*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
254*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
255*700637cbSDimitry Andric    constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
256*700637cbSDimitry Andric                                     Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++23
257*700637cbSDimitry Andric
258*700637cbSDimitry Andric  template<class I, class O>
259*700637cbSDimitry Andric    using copy_result = in_out_result<I, O>;                                                // since C++20
260*700637cbSDimitry Andric
261*700637cbSDimitry Andric  template<class I, class O>
262*700637cbSDimitry Andric    using copy_n_result = in_out_result<I, O>;                                              // since C++20
263*700637cbSDimitry Andric
264*700637cbSDimitry Andric  template<class I, class O>
265*700637cbSDimitry Andric    using copy_if_result = in_out_result<I, O>;                                             // since C++20
266*700637cbSDimitry Andric
267*700637cbSDimitry Andric  template<class I1, class I2>
268*700637cbSDimitry Andric    using copy_backward_result = in_out_result<I1, I2>;                                     // since C++20
269*700637cbSDimitry Andric
270*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
271*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
272*700637cbSDimitry Andric    constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});       // since C++23
273*700637cbSDimitry Andric
274*700637cbSDimitry Andric  template<input_range R, class T, class Proj = identity>
275*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
276*700637cbSDimitry Andric    constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});                 // since C++23
277*700637cbSDimitry Andric
278*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
279*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
280*700637cbSDimitry Andric    constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);            // since C++20
281*700637cbSDimitry Andric
282*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O>
283*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
284*700637cbSDimitry Andric    constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
285*700637cbSDimitry Andric
286*700637cbSDimitry Andric  template<input_iterator I, weakly_incrementable O>
287*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
288*700637cbSDimitry Andric    constexpr ranges::copy_n_result<I, O>
289*700637cbSDimitry Andric      ranges::copy_n(I first, iter_difference_t<I> n, O result);                            // since C++20
290*700637cbSDimitry Andric
291*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
292*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
293*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
294*700637cbSDimitry Andric    constexpr ranges::copy_if_result<I, O>
295*700637cbSDimitry Andric      ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {});                // since C++20
296*700637cbSDimitry Andric
297*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
298*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
300*700637cbSDimitry Andric    constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
301*700637cbSDimitry Andric      ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});                          // since C++20
302*700637cbSDimitry Andric
303*700637cbSDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
304*700637cbSDimitry Andric    requires indirectly_copyable<I1, I2>
305*700637cbSDimitry Andric    constexpr ranges::copy_backward_result<I1, I2>
306*700637cbSDimitry Andric      ranges::copy_backward(I1 first, S1 last, I2 result);                                  // since C++20
307*700637cbSDimitry Andric
308*700637cbSDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
309*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, I>
310*700637cbSDimitry Andric    constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
311*700637cbSDimitry Andric      ranges::copy_backward(R&& r, I result);                                               // since C++20
312*700637cbSDimitry Andric
313*700637cbSDimitry Andric  template<class I, class F>
314*700637cbSDimitry Andric    using for_each_result = in_fun_result<I, F>;                                            // since C++20
315*700637cbSDimitry Andric
316*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
317*700637cbSDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
318*700637cbSDimitry Andric    constexpr ranges::for_each_result<I, Fun>
319*700637cbSDimitry Andric      ranges::for_each(I first, S last, Fun f, Proj proj = {});                             // since C++20
320*700637cbSDimitry Andric
321*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
322*700637cbSDimitry Andric           indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
323*700637cbSDimitry Andric    constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
324*700637cbSDimitry Andric      ranges::for_each(R&& r, Fun f, Proj proj = {});                                       // since C++20
325*700637cbSDimitry Andric
326*700637cbSDimitry Andric  template<input_iterator I, class Proj = identity,
327*700637cbSDimitry Andric           indirectly_unary_invocable<projected<I, Proj>> Fun>
328*700637cbSDimitry Andric    constexpr ranges::for_each_n_result<I, Fun>
329*700637cbSDimitry Andric      ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});           // since C++20
330*700637cbSDimitry Andric
331*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
332*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
333*700637cbSDimitry Andric    constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});      // since C++20
334*700637cbSDimitry Andric
335*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
336*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
337*700637cbSDimitry Andric    constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});                // since C++20
338*700637cbSDimitry Andric
339*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
340*700637cbSDimitry Andric          class Proj = identity>
341*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
342*700637cbSDimitry Andric    constexpr I
343*700637cbSDimitry Andric      ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
344*700637cbSDimitry Andric
345*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
346*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
347*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
348*700637cbSDimitry Andric      ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
349*700637cbSDimitry Andric
350*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
351*700637cbSDimitry Andric          class Proj = identity>
352*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
353*700637cbSDimitry Andric    constexpr I
354*700637cbSDimitry Andric      ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {});                    // since C++20
355*700637cbSDimitry Andric
356*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
357*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
358*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
359*700637cbSDimitry Andric      ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {});                              // since C++20
360*700637cbSDimitry Andric
361*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
362*700637cbSDimitry Andric          class Proj = identity>
363*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
364*700637cbSDimitry Andric    constexpr I
365*700637cbSDimitry Andric      ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
366*700637cbSDimitry Andric
367*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
368*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
369*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
370*700637cbSDimitry Andric      ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
371*700637cbSDimitry Andric
372*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
373*700637cbSDimitry Andric          class Proj = identity>
374*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
375*700637cbSDimitry Andric    constexpr I
376*700637cbSDimitry Andric      ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
377*700637cbSDimitry Andric
378*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
379*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
380*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
381*700637cbSDimitry Andric      ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
382*700637cbSDimitry Andric
383*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
384*700637cbSDimitry Andric            indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
385*700637cbSDimitry Andric    constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});                // since C++20
386*700637cbSDimitry Andric
387*700637cbSDimitry Andric  template<random_access_range R, class Proj = identity,
388*700637cbSDimitry Andric            indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
389*700637cbSDimitry Andric    constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});                          // since C++20
390*700637cbSDimitry Andric
391*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
392*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
393*700637cbSDimitry Andric    constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});             // since C++20
394*700637cbSDimitry Andric
395*700637cbSDimitry Andric  template<random_access_range R, class Proj = identity,
396*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
397*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
398*700637cbSDimitry Andric      is_heap_until(R&& r, Comp comp = {}, Proj proj = {});                                 // since C++20
399*700637cbSDimitry Andric
400*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S>
401*700637cbSDimitry Andric    requires permutable<I>
402*700637cbSDimitry Andric    constexpr I ranges::reverse(I first, S last);                                           // since C++20
403*700637cbSDimitry Andric
404*700637cbSDimitry Andric  template<bidirectional_range R>
405*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
406*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);                                // since C++20
407*700637cbSDimitry Andric
408*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
409*700637cbSDimitry Andric            class Proj = identity>
410*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
411*700637cbSDimitry Andric    constexpr I
412*700637cbSDimitry Andric      ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});                        // since C++20
413*700637cbSDimitry Andric
414*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
415*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
416*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
417*700637cbSDimitry Andric      ranges::sort(R&& r, Comp comp = {}, Proj proj = {});                                  // since C++20
418*700637cbSDimitry Andric
419*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
420*700637cbSDimitry Andric          class Proj = identity>
421*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
422*700637cbSDimitry Andric    I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});                 // since C++20
423*700637cbSDimitry Andric
424*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
425*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
426*700637cbSDimitry Andric    borrowed_iterator_t<R>
427*700637cbSDimitry Andric      ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});                           // since C++20
428*700637cbSDimitry Andric
429*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
430*700637cbSDimitry Andric           class Proj = identity>
431*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
432*700637cbSDimitry Andric    constexpr I
433*700637cbSDimitry Andric      ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});      // since C++20
434*700637cbSDimitry Andric
435*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
436*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
437*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
438*700637cbSDimitry Andric      ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});    // since C++20
439*700637cbSDimitry Andric
440*700637cbSDimitry Andric  template<class T, output_iterator<const T&> O, sentinel_for<O> S>
441*700637cbSDimitry Andric    constexpr O ranges::fill(O first, S last, const T& value);                              // since C++20
442*700637cbSDimitry Andric
443*700637cbSDimitry Andric  template<class T, output_range<const T&> R>
444*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);                   // since C++20
445*700637cbSDimitry Andric
446*700637cbSDimitry Andric  template<class T, output_iterator<const T&> O>
447*700637cbSDimitry Andric    constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);            // since C++20
448*700637cbSDimitry Andric
449*700637cbSDimitry Andric  template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
450*700637cbSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
451*700637cbSDimitry Andric    constexpr O generate(O first, S last, F gen);                                           // since C++20
452*700637cbSDimitry Andric
453*700637cbSDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Generator>
454*700637cbSDimitry Andric    void generate(ExecutionPolicy&& exec,
455*700637cbSDimitry Andric                  ForwardIterator first, ForwardIterator last,
456*700637cbSDimitry Andric                  Generator gen);                                                           // since C++17
457*700637cbSDimitry Andric
458*700637cbSDimitry Andric  template<class R, copy_constructible F>
459*700637cbSDimitry Andric    requires invocable<F&> && output_range<R, invoke_result_t<F&>>
460*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R> generate(R&& r, F gen);                                // since C++20
461*700637cbSDimitry Andric
462*700637cbSDimitry Andric  template<input_or_output_iterator O, copy_constructible F>
463*700637cbSDimitry Andric    requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
464*700637cbSDimitry Andric    constexpr O generate_n(O first, iter_difference_t<O> n, F gen);                         // since C++20
465*700637cbSDimitry Andric
466*700637cbSDimitry Andric  template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
467*700637cbSDimitry Andric    ForwardIterator generate_n(ExecutionPolicy&& exec,
468*700637cbSDimitry Andric                               ForwardIterator first, Size n, Generator gen);               // since C++17
469*700637cbSDimitry Andric
470*700637cbSDimitry Andric template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
471*700637cbSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
472*700637cbSDimitry Andric   requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
473*700637cbSDimitry Andric   constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
474*700637cbSDimitry Andric                                Pred pred = {},
475*700637cbSDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
476*700637cbSDimitry Andric
477*700637cbSDimitry Andric template<input_range R1, input_range R2, class Pred = ranges::equal_to,
478*700637cbSDimitry Andric          class Proj1 = identity, class Proj2 = identity>
479*700637cbSDimitry Andric   requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
480*700637cbSDimitry Andric   constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
481*700637cbSDimitry Andric                                Proj1 proj1 = {}, Proj2 proj2 = {});                        // since C++20
482*700637cbSDimitry Andric
483*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
484*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
485*700637cbSDimitry Andric    constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
486*700637cbSDimitry Andric
487*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
488*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
489*700637cbSDimitry Andric    constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
490*700637cbSDimitry Andric
491*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
492*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
493*700637cbSDimitry Andric    constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});              // since C++20
494*700637cbSDimitry Andric
495*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
496*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
497*700637cbSDimitry Andric    constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});                        // since C++20
498*700637cbSDimitry Andric
499*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
500*700637cbSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
501*700637cbSDimitry Andric    requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
502*700637cbSDimitry Andric           (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
503*700637cbSDimitry Andric           indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
504*700637cbSDimitry Andric    constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
505*700637cbSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
506*700637cbSDimitry Andric
507*700637cbSDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
508*700637cbSDimitry Andric          class Proj2 = identity>
509*700637cbSDimitry Andric    requires (forward_range<R1> || sized_range<R1>) &&
510*700637cbSDimitry Andric           (forward_range<R2> || sized_range<R2>) &&
511*700637cbSDimitry Andric           indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
512*700637cbSDimitry Andric    constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
513*700637cbSDimitry Andric                                   Proj1 proj1 = {}, Proj2 proj2 = {});                     // since C++23
514*700637cbSDimitry Andric
515*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class Proj = identity,
516*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
517*700637cbSDimitry Andric    constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});             // since C++20
518*700637cbSDimitry Andric
519*700637cbSDimitry Andric  template<input_range R, class Proj = identity,
520*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
521*700637cbSDimitry Andric    constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});                       // since C++20
522*700637cbSDimitry Andric
523*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
524*700637cbSDimitry Andric          class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
525*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
526*700637cbSDimitry Andric    constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
527*700637cbSDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++23
528*700637cbSDimitry Andric
529*700637cbSDimitry Andric  template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
530*700637cbSDimitry Andric          class Proj2 = identity>
531*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
532*700637cbSDimitry Andric    constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
533*700637cbSDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++23
534*700637cbSDimitry Andric
535*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1,
536*700637cbSDimitry Andric          random_access_iterator I2, sentinel_for<I2> S2,
537*700637cbSDimitry Andric          class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
538*700637cbSDimitry Andric    requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
539*700637cbSDimitry Andric            indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
540*700637cbSDimitry Andric    constexpr partial_sort_copy_result<I1, I2>
541*700637cbSDimitry Andric      partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
542*700637cbSDimitry Andric                        Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                // since C++20
543*700637cbSDimitry Andric
544*700637cbSDimitry Andric  template<input_range R1, random_access_range R2, class Comp = ranges::less,
545*700637cbSDimitry Andric          class Proj1 = identity, class Proj2 = identity>
546*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
547*700637cbSDimitry Andric            sortable<iterator_t<R2>, Comp, Proj2> &&
548*700637cbSDimitry Andric            indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
549*700637cbSDimitry Andric                                        projected<iterator_t<R2>, Proj2>>
550*700637cbSDimitry Andric    constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
551*700637cbSDimitry Andric      partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
552*700637cbSDimitry Andric                        Proj1 proj1 = {}, Proj2 proj2 = {});                                // since C++20
553*700637cbSDimitry Andric
554*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
555*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
556*700637cbSDimitry Andric    constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {});      // since C++20
557*700637cbSDimitry Andric
558*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
559*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
560*700637cbSDimitry Andric    constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {});                // since C++20
561*700637cbSDimitry Andric
562*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
563*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
564*700637cbSDimitry Andric    constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});   // since C++20
565*700637cbSDimitry Andric
566*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
567*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
568*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
569*700637cbSDimitry Andric      ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});                       // since C++20
570*700637cbSDimitry Andric
571*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
572*700637cbSDimitry Andric          class Proj = identity>
573*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
574*700637cbSDimitry Andric    constexpr I
575*700637cbSDimitry Andric      ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});          // since C++20
576*700637cbSDimitry Andric
577*700637cbSDimitry Andric  template<random_access_range R, class Comp = ranges::less, class Proj = identity>
578*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
579*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
580*700637cbSDimitry Andric      ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});        // since C++20
581*700637cbSDimitry Andric
582*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
583*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>    // since C++20
584*700637cbSDimitry Andric    constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
585*700637cbSDimitry Andric
586*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity,
587*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
588*700637cbSDimitry Andric             ranges::less>
589*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
590*700637cbSDimitry Andric      upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
591*700637cbSDimitry Andric
592*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
593*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
594*700637cbSDimitry Andric    constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
595*700637cbSDimitry Andric                                    Proj proj = {});                                        // since C++20
596*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity,
597*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
598*700637cbSDimitry Andric             ranges::less>
599*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
600*700637cbSDimitry Andric      lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});                   // since C++20
601*700637cbSDimitry Andric
602*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
603*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
604*700637cbSDimitry Andric    constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
605*700637cbSDimitry Andric                                         Proj proj = {});                                   // since C++20
606*700637cbSDimitry Andric
607*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity,
608*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
609*700637cbSDimitry Andric             ranges::less>
610*700637cbSDimitry Andric    constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
611*700637cbSDimitry Andric                                         Proj proj = {});                                   // since C++20
612*700637cbSDimitry Andric
613*700637cbSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
614*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
615*700637cbSDimitry Andric    constexpr subrange<I>
616*700637cbSDimitry Andric      partition(I first, S last, Pred pred, Proj proj = {});                                // since C++20
617*700637cbSDimitry Andric
618*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
619*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
620*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
621*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
622*700637cbSDimitry Andric      partition(R&& r, Pred pred, Proj proj = {});                                          // since C++20
623*700637cbSDimitry Andric
624*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
625*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
626*700637cbSDimitry Andric    requires permutable<I>
627*700637cbSDimitry Andric    subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {});               // since C++20
628*700637cbSDimitry Andric
629*700637cbSDimitry Andric  template<bidirectional_range R, class Proj = identity,
630*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
631*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
632*700637cbSDimitry Andric    borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {});              // since C++20
633*700637cbSDimitry Andric
634*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
635*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
636*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
637*700637cbSDimitry Andric    constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
638*700637cbSDimitry Andric                                       Pred pred = {},
639*700637cbSDimitry Andric                                       Proj1 proj1 = {}, Proj2 proj2 = {});                 // since C++20
640*700637cbSDimitry Andric
641*700637cbSDimitry Andric  template<input_range R1, forward_range R2,
642*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
643*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
644*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R1>
645*700637cbSDimitry Andric      ranges::find_first_of(R1&& r1, R2&& r2,
646*700637cbSDimitry Andric                            Pred pred = {},
647*700637cbSDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                            // since C++20
648*700637cbSDimitry Andric
649*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
650*700637cbSDimitry Andric           indirect_binary_predicate<projected<I, Proj>,
651*700637cbSDimitry Andric                                     projected<I, Proj>> Pred = ranges::equal_to>
652*700637cbSDimitry Andric    constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});     // since C++20
653*700637cbSDimitry Andric
654*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
655*700637cbSDimitry Andric           indirect_binary_predicate<projected<iterator_t<R>, Proj>,
656*700637cbSDimitry Andric                                     projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
657*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});  // since C++20
658*700637cbSDimitry Andric
659*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
660*700637cbSDimitry Andric    requires indirectly_writable<I, const T2&> &&
661*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
662*700637cbSDimitry Andric    constexpr I
663*700637cbSDimitry Andric      ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});   // since C++20
664*700637cbSDimitry Andric
665*700637cbSDimitry Andric  template<input_range R, class T1, class T2, class Proj = identity>
666*700637cbSDimitry Andric    requires indirectly_writable<iterator_t<R>, const T2&> &&
667*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
668*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
669*700637cbSDimitry Andric      ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});             // since C++20
670*700637cbSDimitry Andric
671*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
672*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
673*700637cbSDimitry Andric    requires indirectly_writable<I, const T&>
674*700637cbSDimitry Andric    constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
675*700637cbSDimitry Andric
676*700637cbSDimitry Andric  template<input_range R, class T, class Proj = identity,
677*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
678*700637cbSDimitry Andric    requires indirectly_writable<iterator_t<R>, const T&>
679*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
680*700637cbSDimitry Andric      ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});                     // since C++20
681*700637cbSDimitry Andric
682*700637cbSDimitry Andric  template<class T, class Proj = identity,
683*700637cbSDimitry Andric           indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
684*700637cbSDimitry Andric    constexpr const T&
685*700637cbSDimitry Andric      ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {});          // since C++20
686*700637cbSDimitry Andric
687*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
688*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity,
689*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>,
690*700637cbSDimitry Andric                                      projected<I2, Proj2>> Comp = ranges::less>
691*700637cbSDimitry Andric    constexpr bool
692*700637cbSDimitry Andric      ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
693*700637cbSDimitry Andric                                      Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});          // since C++20
694*700637cbSDimitry Andric
695*700637cbSDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
696*700637cbSDimitry Andric           class Proj2 = identity,
697*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
698*700637cbSDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
699*700637cbSDimitry Andric    constexpr bool
700*700637cbSDimitry Andric      ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
701*700637cbSDimitry Andric                                      Proj1 proj1 = {}, Proj2 proj2 = {});                          // since C++20
702*700637cbSDimitry Andric
703*700637cbSDimitry Andric  template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
704*700637cbSDimitry Andric    requires indirectly_movable<I1, I2>
705*700637cbSDimitry Andric    constexpr ranges::move_backward_result<I1, I2>
706*700637cbSDimitry Andric      ranges::move_backward(I1 first, S1 last, I2 result);                                          // since C++20
707*700637cbSDimitry Andric
708*700637cbSDimitry Andric  template<bidirectional_range R, bidirectional_iterator I>
709*700637cbSDimitry Andric    requires indirectly_movable<iterator_t<R>, I>
710*700637cbSDimitry Andric    constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
711*700637cbSDimitry Andric      ranges::move_backward(R&& r, I result);                                                       // since C++20
712*700637cbSDimitry Andric
713*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
714*700637cbSDimitry Andric    requires indirectly_movable<I, O>
715*700637cbSDimitry Andric    constexpr ranges::move_result<I, O>
716*700637cbSDimitry Andric      ranges::move(I first, S last, O result);                                                      // since C++20
717*700637cbSDimitry Andric
718*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O>
719*700637cbSDimitry Andric    requires indirectly_movable<iterator_t<R>, O>
720*700637cbSDimitry Andric    constexpr ranges::move_result<borrowed_iterator_t<R>, O>
721*700637cbSDimitry Andric      ranges::move(R&& r, O result);                                                                // since C++20
722*700637cbSDimitry Andric
723*700637cbSDimitry Andric  template<class I, class O1, class O2>
724*700637cbSDimitry Andric      using partition_copy_result = in_out_out_result<I, O1, O2>;                                   // since C++20
725*700637cbSDimitry Andric
726*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S,
727*700637cbSDimitry Andric          weakly_incrementable O1, weakly_incrementable O2,
728*700637cbSDimitry Andric          class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
729*700637cbSDimitry Andric    requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
730*700637cbSDimitry Andric    constexpr partition_copy_result<I, O1, O2>
731*700637cbSDimitry Andric      partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
732*700637cbSDimitry Andric                    Proj proj = {});                                                                // since C++20
733*700637cbSDimitry Andric
734*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
735*700637cbSDimitry Andric          class Proj = identity,
736*700637cbSDimitry Andric          indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
737*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O1> &&
738*700637cbSDimitry Andric            indirectly_copyable<iterator_t<R>, O2>
739*700637cbSDimitry Andric    constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
740*700637cbSDimitry Andric      partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});                  // since C++20
741*700637cbSDimitry Andric
742*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
743*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
744*700637cbSDimitry Andric    constexpr I partition_point(I first, S last, Pred pred, Proj proj = {});                        // since C++20
745*700637cbSDimitry Andric
746*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
747*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
748*700637cbSDimitry Andric    constexpr borrowed_iterator_t<R>
749*700637cbSDimitry Andric      partition_point(R&& r, Pred pred, Proj proj = {});                                            // since C++20
750*700637cbSDimitry Andric
751*700637cbSDimitry Andric  template<class I1, class I2, class O>
752*700637cbSDimitry Andric    using merge_result = in_in_out_result<I1, I2, O>;                                               // since C++20
753*700637cbSDimitry Andric
754*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
755*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
756*700637cbSDimitry Andric           class Proj2 = identity>
757*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758*700637cbSDimitry Andric    constexpr merge_result<I1, I2, O>
759*700637cbSDimitry Andric      merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
760*700637cbSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
761*700637cbSDimitry Andric
762*700637cbSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
763*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
764*700637cbSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765*700637cbSDimitry Andric    constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
766*700637cbSDimitry Andric      merge(R1&& r1, R2&& r2, O result,
767*700637cbSDimitry Andric            Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                                    // since C++20
768*700637cbSDimitry Andric
769*700637cbSDimitry Andric  template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
770*700637cbSDimitry Andric    requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
771*700637cbSDimitry Andric    constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});          // since C++20
772*700637cbSDimitry Andric
773*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity>
774*700637cbSDimitry Andric    requires permutable<iterator_t<R>> &&
775*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
776*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
777*700637cbSDimitry Andric      ranges::remove(R&& r, const T& value, Proj proj = {});                                        // since C++20
778*700637cbSDimitry Andric
779*700637cbSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
780*700637cbSDimitry Andric           indirect_unary_predicate<projected<I, Proj>> Pred>
781*700637cbSDimitry Andric    constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});            // since C++20
782*700637cbSDimitry Andric
783*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
784*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
785*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
786*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
787*700637cbSDimitry Andric      ranges::remove_if(R&& r, Pred pred, Proj proj = {});                                          // since C++20
788*700637cbSDimitry Andric
789*700637cbSDimitry Andric  template<class I, class O>
790*700637cbSDimitry Andric    using set_difference_result = in_out_result<I, O>;                                              // since C++20
791*700637cbSDimitry Andric
792*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
793*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
794*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
795*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
796*700637cbSDimitry Andric    constexpr set_difference_result<I1, O>
797*700637cbSDimitry Andric      set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
798*700637cbSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
799*700637cbSDimitry Andric
800*700637cbSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
801*700637cbSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
802*700637cbSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
803*700637cbSDimitry Andric    constexpr set_difference_result<borrowed_iterator_t<R1>, O>
804*700637cbSDimitry Andric      set_difference(R1&& r1, R2&& r2, O result,
805*700637cbSDimitry Andric                     Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                           // since C++20
806*700637cbSDimitry Andric
807*700637cbSDimitry Andric  template<class I1, class I2, class O>
808*700637cbSDimitry Andric    using set_intersection_result = in_in_out_result<I1, I2, O>;                                    // since C++20
809*700637cbSDimitry Andric
810*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
811*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
812*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
813*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
814*700637cbSDimitry Andric    constexpr set_intersection_result<I1, I2, O>
815*700637cbSDimitry Andric      set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
816*700637cbSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
817*700637cbSDimitry Andric
818*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
819*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
820*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
821*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
822*700637cbSDimitry Andric    constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
823*700637cbSDimitry Andric      set_intersection(R1&& r1, R2&& r2, O result,
824*700637cbSDimitry Andric                       Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});                         // since C++20
825*700637cbSDimitry Andric
826*700637cbSDimitry Andric  template <class _InIter, class _OutIter>
827*700637cbSDimitry Andric  using reverse_copy_result = in_out_result<_InIter, _OutIter>;                                     // since C++20
828*700637cbSDimitry Andric
829*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
830*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
831*700637cbSDimitry Andric    constexpr ranges::reverse_copy_result<I, O>
832*700637cbSDimitry Andric      ranges::reverse_copy(I first, S last, O result);                                              // since C++20
833*700637cbSDimitry Andric
834*700637cbSDimitry Andric  template<bidirectional_range R, weakly_incrementable O>
835*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
836*700637cbSDimitry Andric    constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
837*700637cbSDimitry Andric      ranges::reverse_copy(R&& r, O result);                                                        // since C++20
838*700637cbSDimitry Andric
839*700637cbSDimitry Andric  template<permutable I, sentinel_for<I> S>
840*700637cbSDimitry Andric    constexpr subrange<I> rotate(I first, I middle, S last);                                        // since C++20
841*700637cbSDimitry Andric
842*700637cbSDimitry Andric  template<forward_range R>
843*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
844*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);                           // since C++20
845*700637cbSDimitry Andric
846*700637cbSDimitry Andric  template <class _InIter, class _OutIter>
847*700637cbSDimitry Andric  using rotate_copy_result = in_out_result<_InIter, _OutIter>;                                      // since C++20
848*700637cbSDimitry Andric
849*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
850*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
851*700637cbSDimitry Andric    constexpr ranges::rotate_copy_result<I, O>
852*700637cbSDimitry Andric      ranges::rotate_copy(I first, I middle, S last, O result);                                     // since C++20
853*700637cbSDimitry Andric
854*700637cbSDimitry Andric  template<forward_range R, weakly_incrementable O>
855*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
856*700637cbSDimitry Andric    constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
857*700637cbSDimitry Andric      ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);                                   // since C++20
858*700637cbSDimitry Andric
859*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
860*700637cbSDimitry Andric    requires (forward_iterator<I> || random_access_iterator<O>) &&
861*700637cbSDimitry Andric            indirectly_copyable<I, O> &&
862*700637cbSDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
863*700637cbSDimitry Andric    O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g);                              // since C++20
864*700637cbSDimitry Andric
865*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, class Gen>
866*700637cbSDimitry Andric    requires (forward_range<R> || random_access_iterator<O>) &&
867*700637cbSDimitry Andric            indirectly_copyable<iterator_t<R>, O> &&
868*700637cbSDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
869*700637cbSDimitry Andric    O sample(R&& r, O out, range_difference_t<R> n, Gen&& g);                                       // since C++20
870*700637cbSDimitry Andric
871*700637cbSDimitry Andric  template<random_access_iterator I, sentinel_for<I> S, class Gen>
872*700637cbSDimitry Andric    requires permutable<I> &&
873*700637cbSDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
874*700637cbSDimitry Andric    I shuffle(I first, S last, Gen&& g);                                                            // since C++20
875*700637cbSDimitry Andric
876*700637cbSDimitry Andric  template<random_access_range R, class Gen>
877*700637cbSDimitry Andric    requires permutable<iterator_t<R>> &&
878*700637cbSDimitry Andric            uniform_random_bit_generator<remove_reference_t<Gen>>
879*700637cbSDimitry Andric    borrowed_iterator_t<R> shuffle(R&& r, Gen&& g);                                                 // since C++20
880*700637cbSDimitry Andric
881*700637cbSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
882*700637cbSDimitry Andric         sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
883*700637cbSDimitry Andric         indirect_equivalence_relation<projected<I1, Proj1>,
884*700637cbSDimitry Andric                                       projected<I2, Proj2>> Pred = ranges::equal_to>
885*700637cbSDimitry Andric  constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
886*700637cbSDimitry Andric                                        Pred pred = {},
887*700637cbSDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
888*700637cbSDimitry Andric
889*700637cbSDimitry Andric  template<forward_range R1, forward_range R2,
890*700637cbSDimitry Andric         class Proj1 = identity, class Proj2 = identity,
891*700637cbSDimitry Andric         indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
892*700637cbSDimitry Andric                                       projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
893*700637cbSDimitry Andric  constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
894*700637cbSDimitry Andric                                        Proj1 proj1 = {}, Proj2 proj2 = {});                       // since C++20
895*700637cbSDimitry Andric
896*700637cbSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
897*700637cbSDimitry Andric           sentinel_for<I2> S2, class Pred = ranges::equal_to,
898*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
899*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
900*700637cbSDimitry Andric    constexpr subrange<I1>
901*700637cbSDimitry Andric      ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
902*700637cbSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
903*700637cbSDimitry Andric
904*700637cbSDimitry Andric  template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
905*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
906*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
907*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R1>
908*700637cbSDimitry Andric      ranges::search(R1&& r1, R2&& r2, Pred pred = {},
909*700637cbSDimitry Andric                     Proj1 proj1 = {}, Proj2 proj2 = {});                                           // since C++20
910*700637cbSDimitry Andric
911*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T,
912*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj = identity>
913*700637cbSDimitry Andric    requires indirectly_comparable<I, const T*, Pred, Proj>
914*700637cbSDimitry Andric    constexpr subrange<I>
915*700637cbSDimitry Andric      ranges::search_n(I first, S last, iter_difference_t<I> count,
916*700637cbSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
917*700637cbSDimitry Andric
918*700637cbSDimitry Andric  template<forward_range R, class T, class Pred = ranges::equal_to,
919*700637cbSDimitry Andric           class Proj = identity>
920*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
921*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
922*700637cbSDimitry Andric      ranges::search_n(R&& r, range_difference_t<R> count,
923*700637cbSDimitry Andric                       const T& value, Pred pred = {}, Proj proj = {});                             // since C++20
924*700637cbSDimitry Andric
925*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
926*700637cbSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
927*700637cbSDimitry Andric    constexpr auto ranges::fold_left(I first, S last, T init, F f);                                 // since C++23
928*700637cbSDimitry Andric
929*700637cbSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
930*700637cbSDimitry Andric    constexpr auto fold_left(R&& r, T init, F f);                                                   // since C++23
931*700637cbSDimitry Andric
932*700637cbSDimitry Andric  template<class I, class T>
933*700637cbSDimitry Andric    using fold_left_with_iter_result = in_value_result<I, T>;                                       // since C++23
934*700637cbSDimitry Andric
935*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T,
936*700637cbSDimitry Andric           indirectly-binary-left-foldable<T, I> F>
937*700637cbSDimitry Andric    constexpr see below fold_left_with_iter(I first, S last, T init, F f);                          // since C++23
938*700637cbSDimitry Andric
939*700637cbSDimitry Andric  template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
940*700637cbSDimitry Andric    constexpr see below fold_left_with_iter(R&& r, T init, F f);                                    // since C++23
941*700637cbSDimitry Andric
942*700637cbSDimitry Andric  template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
943*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
944*700637cbSDimitry Andric    requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
945*700637cbSDimitry Andric    constexpr subrange<I1>
946*700637cbSDimitry Andric      ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
947*700637cbSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
948*700637cbSDimitry Andric
949*700637cbSDimitry Andric  template<forward_range R1, forward_range R2,
950*700637cbSDimitry Andric           class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
951*700637cbSDimitry Andric    requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
952*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R1>
953*700637cbSDimitry Andric      ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
954*700637cbSDimitry Andric                       Proj1 proj1 = {}, Proj2 proj2 = {});                                         // since C++20
955*700637cbSDimitry Andric
956*700637cbSDimitry Andric  template<class I1, class I2, class O>
957*700637cbSDimitry Andric    using set_symmetric_difference_result = in_in_out_result<I1, I2, O>;                            // since C++20
958*700637cbSDimitry Andric
959*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
960*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
961*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
962*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
963*700637cbSDimitry Andric    constexpr set_symmetric_difference_result<I1, I2, O>
964*700637cbSDimitry Andric      set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
965*700637cbSDimitry Andric                               Comp comp = {}, Proj1 proj1 = {},
966*700637cbSDimitry Andric                               Proj2 proj2 = {});                                                   // since C++20
967*700637cbSDimitry Andric
968*700637cbSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
969*700637cbSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
970*700637cbSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
971*700637cbSDimitry Andric    constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
972*700637cbSDimitry Andric                                                      borrowed_iterator_t<R2>, O>
973*700637cbSDimitry Andric      set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
974*700637cbSDimitry Andric                               Proj1 proj1 = {}, Proj2 proj2 = {});                                 // since C++20
975*700637cbSDimitry Andric
976*700637cbSDimitry Andric  template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
977*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
978*700637cbSDimitry Andric    constexpr subrange<I>
979*700637cbSDimitry Andric      equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});                 // since C++20
980*700637cbSDimitry Andric
981*700637cbSDimitry Andric  template<forward_range R, class T, class Proj = identity,
982*700637cbSDimitry Andric           indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
983*700637cbSDimitry Andric             ranges::less>
984*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
985*700637cbSDimitry Andric      equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});                           // since C++20
986*700637cbSDimitry Andric
987*700637cbSDimitry Andric  template<class I1, class I2, class O>
988*700637cbSDimitry Andric    using set_union_result = in_in_out_result<I1, I2, O>;                                           // since C++20
989*700637cbSDimitry Andric
990*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
991*700637cbSDimitry Andric           weakly_incrementable O, class Comp = ranges::less,
992*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity>
993*700637cbSDimitry Andric    requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
994*700637cbSDimitry Andric    constexpr set_union_result<I1, I2, O>
995*700637cbSDimitry Andric      set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
996*700637cbSDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
997*700637cbSDimitry Andric
998*700637cbSDimitry Andric  template<input_range R1, input_range R2, weakly_incrementable O,
999*700637cbSDimitry Andric           class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1000*700637cbSDimitry Andric    requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1001*700637cbSDimitry Andric    constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1002*700637cbSDimitry Andric      set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1003*700637cbSDimitry Andric                Proj1 proj1 = {}, Proj2 proj2 = {});                                                // since C++20
1004*700637cbSDimitry Andric
1005*700637cbSDimitry Andric  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006*700637cbSDimitry Andric           class Proj1 = identity, class Proj2 = identity,
1007*700637cbSDimitry Andric           indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1008*700637cbSDimitry Andric             ranges::less>
1009*700637cbSDimitry Andric    constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
1010*700637cbSDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
1011*700637cbSDimitry Andric
1012*700637cbSDimitry Andric  template<input_range R1, input_range R2, class Proj1 = identity,
1013*700637cbSDimitry Andric           class Proj2 = identity,
1014*700637cbSDimitry Andric           indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1015*700637cbSDimitry Andric                                      projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1016*700637cbSDimitry Andric    constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
1017*700637cbSDimitry Andric                            Proj1 proj1 = {}, Proj2 proj2 = {});                                   // since C++20
1018*700637cbSDimitry Andric
1019*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1020*700637cbSDimitry Andric           class Proj = identity>
1021*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
1022*700637cbSDimitry Andric    I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});                    // since C++20
1023*700637cbSDimitry Andric
1024*700637cbSDimitry Andric  template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1025*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
1026*700637cbSDimitry Andric    borrowed_iterator_t<R>
1027*700637cbSDimitry Andric      inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
1028*700637cbSDimitry Andric                    Proj proj = {});                                                               // since C++20
1029*700637cbSDimitry Andric
1030*700637cbSDimitry Andric  template<permutable I, sentinel_for<I> S, class Proj = identity,
1031*700637cbSDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1032*700637cbSDimitry Andric    constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {});                    // since C++20
1033*700637cbSDimitry Andric
1034*700637cbSDimitry Andric  template<forward_range R, class Proj = identity,
1035*700637cbSDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1036*700637cbSDimitry Andric    requires permutable<iterator_t<R>>
1037*700637cbSDimitry Andric    constexpr borrowed_subrange_t<R>
1038*700637cbSDimitry Andric      unique(R&& r, C comp = {}, Proj proj = {});                                                  // since C++20
1039*700637cbSDimitry Andric
1040*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1041*700637cbSDimitry Andric           indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1042*700637cbSDimitry Andric    requires indirectly_copyable<I, O> &&
1043*700637cbSDimitry Andric             (forward_iterator<I> ||
1044*700637cbSDimitry Andric              (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1045*700637cbSDimitry Andric              indirectly_copyable_storable<I, O>)
1046*700637cbSDimitry Andric    constexpr unique_copy_result<I, O>
1047*700637cbSDimitry Andric      unique_copy(I first, S last, O result, C comp = {}, Proj proj = {});                         // since C++20
1048*700637cbSDimitry Andric
1049*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
1050*700637cbSDimitry Andric           indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1051*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
1052*700637cbSDimitry Andric             (forward_iterator<iterator_t<R>> ||
1053*700637cbSDimitry Andric              (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1054*700637cbSDimitry Andric              indirectly_copyable_storable<iterator_t<R>, O>)
1055*700637cbSDimitry Andric    constexpr unique_copy_result<borrowed_iterator_t<R>, O>
1056*700637cbSDimitry Andric      unique_copy(R&& r, O result, C comp = {}, Proj proj = {});                                   // since C++20
1057*700637cbSDimitry Andric
1058*700637cbSDimitry Andric  template<class I, class O>
1059*700637cbSDimitry Andric      using remove_copy_result = in_out_result<I, O>;                                              // since C++20
1060*700637cbSDimitry Andric
1061*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1062*700637cbSDimitry Andric           class Proj = identity>
1063*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1064*700637cbSDimitry Andric    constexpr remove_copy_result<I, O>
1065*700637cbSDimitry Andric      remove_copy(I first, S last, O result, const T& value, Proj proj = {});                      // since C++20
1066*700637cbSDimitry Andric
1067*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1068*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
1069*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to,
1070*700637cbSDimitry Andric                                       projected<iterator_t<R>, Proj>, const T*>
1071*700637cbSDimitry Andric    constexpr remove_copy_result<borrowed_iterator_t<R>, O>
1072*700637cbSDimitry Andric      remove_copy(R&& r, O result, const T& value, Proj proj = {});                                // since C++20
1073*700637cbSDimitry Andric
1074*700637cbSDimitry Andric  template<class I, class O>
1075*700637cbSDimitry Andric      using remove_copy_if_result = in_out_result<I, O>;                                           // since C++20
1076*700637cbSDimitry Andric
1077*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1078*700637cbSDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1079*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
1080*700637cbSDimitry Andric    constexpr remove_copy_if_result<I, O>
1081*700637cbSDimitry Andric      remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});                        // since C++20
1082*700637cbSDimitry Andric
1083*700637cbSDimitry Andric  template<input_range R, weakly_incrementable O, class Proj = identity,
1084*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1085*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
1086*700637cbSDimitry Andric    constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
1087*700637cbSDimitry Andric      remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});                                  // since C++20
1088*700637cbSDimitry Andric
1089*700637cbSDimitry Andric  template<class I, class O>
1090*700637cbSDimitry Andric      using replace_copy_result = in_out_result<I, O>;                                             // since C++20
1091*700637cbSDimitry Andric
1092*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1093*700637cbSDimitry Andric           output_iterator<const T2&> O, class Proj = identity>
1094*700637cbSDimitry Andric    requires indirectly_copyable<I, O> &&
1095*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1096*700637cbSDimitry Andric    constexpr replace_copy_result<I, O>
1097*700637cbSDimitry Andric      replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
1098*700637cbSDimitry Andric                   Proj proj = {});                                                                // since C++20
1099*700637cbSDimitry Andric
1100*700637cbSDimitry Andric  template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1101*700637cbSDimitry Andric           class Proj = identity>
1102*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O> &&
1103*700637cbSDimitry Andric             indirect_binary_predicate<ranges::equal_to,
1104*700637cbSDimitry Andric                                       projected<iterator_t<R>, Proj>, const T1*>
1105*700637cbSDimitry Andric    constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1106*700637cbSDimitry Andric      replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
1107*700637cbSDimitry Andric                   Proj proj = {});                                                                // since C++20
1108*700637cbSDimitry Andric
1109*700637cbSDimitry Andric  template<class I, class O>
1110*700637cbSDimitry Andric      using replace_copy_if_result = in_out_result<I, O>;                                          // since C++20
1111*700637cbSDimitry Andric
1112*700637cbSDimitry Andric  template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1113*700637cbSDimitry Andric           class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1114*700637cbSDimitry Andric    requires indirectly_copyable<I, O>
1115*700637cbSDimitry Andric    constexpr replace_copy_if_result<I, O>
1116*700637cbSDimitry Andric      replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
1117*700637cbSDimitry Andric                      Proj proj = {});                                                             // since C++20
1118*700637cbSDimitry Andric
1119*700637cbSDimitry Andric  template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1120*700637cbSDimitry Andric           indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1121*700637cbSDimitry Andric    requires indirectly_copyable<iterator_t<R>, O>
1122*700637cbSDimitry Andric    constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1123*700637cbSDimitry Andric      replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
1124*700637cbSDimitry Andric                      Proj proj = {});                                                             // since C++20
1125*700637cbSDimitry Andric
1126*700637cbSDimitry Andric  template<class I>
1127*700637cbSDimitry Andric    using prev_permutation_result = in_found_result<I>;                                            // since C++20
1128*700637cbSDimitry Andric
1129*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1130*700637cbSDimitry Andric           class Proj = identity>
1131*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
1132*700637cbSDimitry Andric    constexpr ranges::prev_permutation_result<I>
1133*700637cbSDimitry Andric      ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
1134*700637cbSDimitry Andric
1135*700637cbSDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
1136*700637cbSDimitry Andric           class Proj = identity>
1137*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
1138*700637cbSDimitry Andric    constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
1139*700637cbSDimitry Andric      ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
1140*700637cbSDimitry Andric
1141*700637cbSDimitry Andric  template<class I>
1142*700637cbSDimitry Andric    using next_permutation_result = in_found_result<I>;                                            // since C++20
1143*700637cbSDimitry Andric
1144*700637cbSDimitry Andric  template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1145*700637cbSDimitry Andric           class Proj = identity>
1146*700637cbSDimitry Andric    requires sortable<I, Comp, Proj>
1147*700637cbSDimitry Andric    constexpr ranges::next_permutation_result<I>
1148*700637cbSDimitry Andric      ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {});                   // since C++20
1149*700637cbSDimitry Andric
1150*700637cbSDimitry Andric  template<bidirectional_range R, class Comp = ranges::less,
1151*700637cbSDimitry Andric           class Proj = identity>
1152*700637cbSDimitry Andric    requires sortable<iterator_t<R>, Comp, Proj>
1153*700637cbSDimitry Andric    constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
1154*700637cbSDimitry Andric      ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {});                             // since C++20
1155*700637cbSDimitry Andric
1156*700637cbSDimitry Andric}
1157*700637cbSDimitry Andric
1158*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1159*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1160*700637cbSDimitry Andric    all_of(InputIterator first, InputIterator last, Predicate pred);
1161*700637cbSDimitry Andric
1162*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1163*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1164*700637cbSDimitry Andric    any_of(InputIterator first, InputIterator last, Predicate pred);
1165*700637cbSDimitry Andric
1166*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1167*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1168*700637cbSDimitry Andric    none_of(InputIterator first, InputIterator last, Predicate pred);
1169*700637cbSDimitry Andric
1170*700637cbSDimitry Andrictemplate <class InputIterator, class Function>
1171*700637cbSDimitry Andric    constexpr Function          // constexpr in C++20
1172*700637cbSDimitry Andric    for_each(InputIterator first, InputIterator last, Function f);
1173*700637cbSDimitry Andric
1174*700637cbSDimitry Andrictemplate<class InputIterator, class Size, class Function>
1175*700637cbSDimitry Andric    constexpr InputIterator     // constexpr in C++20
1176*700637cbSDimitry Andric    for_each_n(InputIterator first, Size n, Function f); // C++17
1177*700637cbSDimitry Andric
1178*700637cbSDimitry Andrictemplate <class InputIterator, class T>
1179*700637cbSDimitry Andric    constexpr InputIterator     // constexpr in C++20
1180*700637cbSDimitry Andric    find(InputIterator first, InputIterator last, const T& value);
1181*700637cbSDimitry Andric
1182*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1183*700637cbSDimitry Andric    constexpr InputIterator     // constexpr in C++20
1184*700637cbSDimitry Andric    find_if(InputIterator first, InputIterator last, Predicate pred);
1185*700637cbSDimitry Andric
1186*700637cbSDimitry Andrictemplate<class InputIterator, class Predicate>
1187*700637cbSDimitry Andric    constexpr InputIterator     // constexpr in C++20
1188*700637cbSDimitry Andric    find_if_not(InputIterator first, InputIterator last, Predicate pred);
1189*700637cbSDimitry Andric
1190*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1191*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
1192*700637cbSDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1193*700637cbSDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2);
1194*700637cbSDimitry Andric
1195*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1196*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
1197*700637cbSDimitry Andric    find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1198*700637cbSDimitry Andric             ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1199*700637cbSDimitry Andric
1200*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1201*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
1202*700637cbSDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1203*700637cbSDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2);
1204*700637cbSDimitry Andric
1205*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1206*700637cbSDimitry Andric    constexpr ForwardIterator1  // constexpr in C++20
1207*700637cbSDimitry Andric    find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1208*700637cbSDimitry Andric                  ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1209*700637cbSDimitry Andric
1210*700637cbSDimitry Andrictemplate <class ForwardIterator>
1211*700637cbSDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
1212*700637cbSDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last);
1213*700637cbSDimitry Andric
1214*700637cbSDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1215*700637cbSDimitry Andric    constexpr ForwardIterator   // constexpr in C++20
1216*700637cbSDimitry Andric    adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1217*700637cbSDimitry Andric
1218*700637cbSDimitry Andrictemplate <class InputIterator, class T>
1219*700637cbSDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type  // constexpr in C++20
1220*700637cbSDimitry Andric    count(InputIterator first, InputIterator last, const T& value);
1221*700637cbSDimitry Andric
1222*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1223*700637cbSDimitry Andric    constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1224*700637cbSDimitry Andric    count_if(InputIterator first, InputIterator last, Predicate pred);
1225*700637cbSDimitry Andric
1226*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1227*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
1228*700637cbSDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1229*700637cbSDimitry Andric
1230*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1231*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
1232*700637cbSDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
1233*700637cbSDimitry Andric             InputIterator2 first2, InputIterator2 last2); // **C++14**
1234*700637cbSDimitry Andric
1235*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1236*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
1237*700637cbSDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
1238*700637cbSDimitry Andric             InputIterator2 first2, BinaryPredicate pred);
1239*700637cbSDimitry Andric
1240*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1241*700637cbSDimitry Andric    constexpr pair<InputIterator1, InputIterator2>   // constexpr in C++20
1242*700637cbSDimitry Andric    mismatch(InputIterator1 first1, InputIterator1 last1,
1243*700637cbSDimitry Andric             InputIterator2 first2, InputIterator2 last2,
1244*700637cbSDimitry Andric             BinaryPredicate pred); // **C++14**
1245*700637cbSDimitry Andric
1246*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1247*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1248*700637cbSDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1249*700637cbSDimitry Andric
1250*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1251*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1252*700637cbSDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
1253*700637cbSDimitry Andric          InputIterator2 first2, InputIterator2 last2); // **C++14**
1254*700637cbSDimitry Andric
1255*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1256*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1257*700637cbSDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
1258*700637cbSDimitry Andric          InputIterator2 first2, BinaryPredicate pred);
1259*700637cbSDimitry Andric
1260*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class BinaryPredicate>
1261*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1262*700637cbSDimitry Andric    equal(InputIterator1 first1, InputIterator1 last1,
1263*700637cbSDimitry Andric          InputIterator2 first2, InputIterator2 last2,
1264*700637cbSDimitry Andric          BinaryPredicate pred); // **C++14**
1265*700637cbSDimitry Andric
1266*700637cbSDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
1267*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1268*700637cbSDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1269*700637cbSDimitry Andric                   ForwardIterator2 first2);
1270*700637cbSDimitry Andric
1271*700637cbSDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2>
1272*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1273*700637cbSDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1274*700637cbSDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1275*700637cbSDimitry Andric
1276*700637cbSDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1277*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1278*700637cbSDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1279*700637cbSDimitry Andric                   ForwardIterator2 first2, BinaryPredicate pred);
1280*700637cbSDimitry Andric
1281*700637cbSDimitry Andrictemplate<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1282*700637cbSDimitry Andric    constexpr bool      // constexpr in C++20
1283*700637cbSDimitry Andric    is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1284*700637cbSDimitry Andric                   ForwardIterator2 first2, ForwardIterator2 last2,
1285*700637cbSDimitry Andric                   BinaryPredicate pred);  // **C++14**
1286*700637cbSDimitry Andric
1287*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1288*700637cbSDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
1289*700637cbSDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
1290*700637cbSDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2);
1291*700637cbSDimitry Andric
1292*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1293*700637cbSDimitry Andric    constexpr ForwardIterator1      // constexpr in C++20
1294*700637cbSDimitry Andric    search(ForwardIterator1 first1, ForwardIterator1 last1,
1295*700637cbSDimitry Andric           ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1296*700637cbSDimitry Andric
1297*700637cbSDimitry Andrictemplate <class ForwardIterator, class Size, class T>
1298*700637cbSDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
1299*700637cbSDimitry Andric    search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1300*700637cbSDimitry Andric
1301*700637cbSDimitry Andrictemplate <class ForwardIterator, class Size, class T, class BinaryPredicate>
1302*700637cbSDimitry Andric    constexpr ForwardIterator       // constexpr in C++20
1303*700637cbSDimitry Andric    search_n(ForwardIterator first, ForwardIterator last,
1304*700637cbSDimitry Andric             Size count, const T& value, BinaryPredicate pred);
1305*700637cbSDimitry Andric
1306*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator>
1307*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1308*700637cbSDimitry Andric    copy(InputIterator first, InputIterator last, OutputIterator result);
1309*700637cbSDimitry Andric
1310*700637cbSDimitry Andrictemplate<class InputIterator, class OutputIterator, class Predicate>
1311*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1312*700637cbSDimitry Andric    copy_if(InputIterator first, InputIterator last,
1313*700637cbSDimitry Andric            OutputIterator result, Predicate pred);
1314*700637cbSDimitry Andric
1315*700637cbSDimitry Andrictemplate<class InputIterator, class Size, class OutputIterator>
1316*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1317*700637cbSDimitry Andric    copy_n(InputIterator first, Size n, OutputIterator result);
1318*700637cbSDimitry Andric
1319*700637cbSDimitry Andrictemplate <class BidirectionalIterator1, class BidirectionalIterator2>
1320*700637cbSDimitry Andric    constexpr BidirectionalIterator2      // constexpr in C++20
1321*700637cbSDimitry Andric    copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1322*700637cbSDimitry Andric                  BidirectionalIterator2 result);
1323*700637cbSDimitry Andric
1324*700637cbSDimitry Andric// [alg.move], move
1325*700637cbSDimitry Andrictemplate<class InputIterator, class OutputIterator>
1326*700637cbSDimitry Andric    constexpr OutputIterator move(InputIterator first, InputIterator last,
1327*700637cbSDimitry Andric                                OutputIterator result);
1328*700637cbSDimitry Andric
1329*700637cbSDimitry Andrictemplate<class BidirectionalIterator1, class BidirectionalIterator2>
1330*700637cbSDimitry Andric    constexpr BidirectionalIterator2
1331*700637cbSDimitry Andric    move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1332*700637cbSDimitry Andric                  BidirectionalIterator2 result);
1333*700637cbSDimitry Andric
1334*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1335*700637cbSDimitry Andric    constexpr ForwardIterator2    // constexpr in C++20
1336*700637cbSDimitry Andric    swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1337*700637cbSDimitry Andric
1338*700637cbSDimitry Andricnamespace ranges {
1339*700637cbSDimitry Andric    template<class I1, class I2>
1340*700637cbSDimitry Andric    using swap_ranges_result = in_in_result<I1, I2>;
1341*700637cbSDimitry Andric
1342*700637cbSDimitry Andrictemplate<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1343*700637cbSDimitry Andric        requires indirectly_swappable<I1, I2>
1344*700637cbSDimitry Andric    constexpr ranges::swap_ranges_result<I1, I2>
1345*700637cbSDimitry Andric        swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
1346*700637cbSDimitry Andric
1347*700637cbSDimitry Andrictemplate<input_range R1, input_range R2>
1348*700637cbSDimitry Andric        requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1349*700637cbSDimitry Andric    constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
1350*700637cbSDimitry Andric        swap_ranges(R1&& r1, R2&& r2);
1351*700637cbSDimitry Andric}
1352*700637cbSDimitry Andric
1353*700637cbSDimitry Andrictemplate <class ForwardIterator1, class ForwardIterator2>
1354*700637cbSDimitry Andric    constexpr void                // constexpr in C++20
1355*700637cbSDimitry Andric    iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1356*700637cbSDimitry Andric
1357*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class UnaryOperation>
1358*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1359*700637cbSDimitry Andric    transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1360*700637cbSDimitry Andric
1361*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
1362*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1363*700637cbSDimitry Andric    transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1364*700637cbSDimitry Andric              OutputIterator result, BinaryOperation binary_op);
1365*700637cbSDimitry Andric
1366*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1367*700637cbSDimitry Andric    constexpr void      // constexpr in C++20
1368*700637cbSDimitry Andric    replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1369*700637cbSDimitry Andric
1370*700637cbSDimitry Andrictemplate <class ForwardIterator, class Predicate, class T>
1371*700637cbSDimitry Andric    constexpr void      // constexpr in C++20
1372*700637cbSDimitry Andric    replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1373*700637cbSDimitry Andric
1374*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
1375*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1376*700637cbSDimitry Andric    replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1377*700637cbSDimitry Andric                 const T& old_value, const T& new_value);
1378*700637cbSDimitry Andric
1379*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate, class T>
1380*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1381*700637cbSDimitry Andric    replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1382*700637cbSDimitry Andric
1383*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1384*700637cbSDimitry Andric    constexpr void      // constexpr in C++20
1385*700637cbSDimitry Andric    fill(ForwardIterator first, ForwardIterator last, const T& value);
1386*700637cbSDimitry Andric
1387*700637cbSDimitry Andrictemplate <class OutputIterator, class Size, class T>
1388*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1389*700637cbSDimitry Andric    fill_n(OutputIterator first, Size n, const T& value);
1390*700637cbSDimitry Andric
1391*700637cbSDimitry Andrictemplate <class ForwardIterator, class Generator>
1392*700637cbSDimitry Andric    constexpr void      // constexpr in C++20
1393*700637cbSDimitry Andric    generate(ForwardIterator first, ForwardIterator last, Generator gen);
1394*700637cbSDimitry Andric
1395*700637cbSDimitry Andrictemplate <class OutputIterator, class Size, class Generator>
1396*700637cbSDimitry Andric    constexpr OutputIterator      // constexpr in C++20
1397*700637cbSDimitry Andric    generate_n(OutputIterator first, Size n, Generator gen);
1398*700637cbSDimitry Andric
1399*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1400*700637cbSDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
1401*700637cbSDimitry Andric    remove(ForwardIterator first, ForwardIterator last, const T& value);
1402*700637cbSDimitry Andric
1403*700637cbSDimitry Andrictemplate <class ForwardIterator, class Predicate>
1404*700637cbSDimitry Andric    constexpr ForwardIterator     // constexpr in C++20
1405*700637cbSDimitry Andric    remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1406*700637cbSDimitry Andric
1407*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class T>
1408*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr in C++20
1409*700637cbSDimitry Andric    remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1410*700637cbSDimitry Andric
1411*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class Predicate>
1412*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr in C++20
1413*700637cbSDimitry Andric    remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1414*700637cbSDimitry Andric
1415*700637cbSDimitry Andrictemplate <class ForwardIterator>
1416*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
1417*700637cbSDimitry Andric    unique(ForwardIterator first, ForwardIterator last);
1418*700637cbSDimitry Andric
1419*700637cbSDimitry Andrictemplate <class ForwardIterator, class BinaryPredicate>
1420*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
1421*700637cbSDimitry Andric    unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1422*700637cbSDimitry Andric
1423*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator>
1424*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr in C++20
1425*700637cbSDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1426*700637cbSDimitry Andric
1427*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator, class BinaryPredicate>
1428*700637cbSDimitry Andric    constexpr OutputIterator     // constexpr in C++20
1429*700637cbSDimitry Andric    unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1430*700637cbSDimitry Andric
1431*700637cbSDimitry Andrictemplate <class BidirectionalIterator>
1432*700637cbSDimitry Andric    constexpr void               // constexpr in C++20
1433*700637cbSDimitry Andric    reverse(BidirectionalIterator first, BidirectionalIterator last);
1434*700637cbSDimitry Andric
1435*700637cbSDimitry Andrictemplate <class BidirectionalIterator, class OutputIterator>
1436*700637cbSDimitry Andric    constexpr OutputIterator       // constexpr in C++20
1437*700637cbSDimitry Andric    reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1438*700637cbSDimitry Andric
1439*700637cbSDimitry Andrictemplate <class ForwardIterator>
1440*700637cbSDimitry Andric    constexpr ForwardIterator      // constexpr in C++20
1441*700637cbSDimitry Andric    rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1442*700637cbSDimitry Andric
1443*700637cbSDimitry Andrictemplate <class ForwardIterator, class OutputIterator>
1444*700637cbSDimitry Andric    constexpr OutputIterator       // constexpr in C++20
1445*700637cbSDimitry Andric    rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1446*700637cbSDimitry Andric
1447*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1448*700637cbSDimitry Andric    void
1449*700637cbSDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
1450*700637cbSDimitry Andric
1451*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class RandomNumberGenerator>
1452*700637cbSDimitry Andric    void
1453*700637cbSDimitry Andric    random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
1454*700637cbSDimitry Andric                   RandomNumberGenerator& rand);  // deprecated in C++14, removed in C++17
1455*700637cbSDimitry Andric
1456*700637cbSDimitry Andrictemplate<class PopulationIterator, class SampleIterator,
1457*700637cbSDimitry Andric         class Distance, class UniformRandomBitGenerator>
1458*700637cbSDimitry Andric    SampleIterator sample(PopulationIterator first, PopulationIterator last,
1459*700637cbSDimitry Andric                          SampleIterator out, Distance n,
1460*700637cbSDimitry Andric                          UniformRandomBitGenerator&& g); // C++17
1461*700637cbSDimitry Andric
1462*700637cbSDimitry Andrictemplate<class RandomAccessIterator, class UniformRandomNumberGenerator>
1463*700637cbSDimitry Andric    void shuffle(RandomAccessIterator first, RandomAccessIterator last,
1464*700637cbSDimitry Andric                 UniformRandomNumberGenerator&& g);
1465*700637cbSDimitry Andric
1466*700637cbSDimitry Andrictemplate<class ForwardIterator>
1467*700637cbSDimitry Andric  constexpr ForwardIterator
1468*700637cbSDimitry Andric    shift_left(ForwardIterator first, ForwardIterator last,
1469*700637cbSDimitry Andric               typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1470*700637cbSDimitry Andric
1471*700637cbSDimitry Andrictemplate<class ForwardIterator>
1472*700637cbSDimitry Andric  constexpr ForwardIterator
1473*700637cbSDimitry Andric    shift_right(ForwardIterator first, ForwardIterator last,
1474*700637cbSDimitry Andric                typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1475*700637cbSDimitry Andric
1476*700637cbSDimitry Andrictemplate <class InputIterator, class Predicate>
1477*700637cbSDimitry Andric    constexpr bool  // constexpr in C++20
1478*700637cbSDimitry Andric    is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1479*700637cbSDimitry Andric
1480*700637cbSDimitry Andrictemplate <class ForwardIterator, class Predicate>
1481*700637cbSDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
1482*700637cbSDimitry Andric    partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1483*700637cbSDimitry Andric
1484*700637cbSDimitry Andrictemplate <class InputIterator, class OutputIterator1,
1485*700637cbSDimitry Andric          class OutputIterator2, class Predicate>
1486*700637cbSDimitry Andric    constexpr pair<OutputIterator1, OutputIterator2>   // constexpr in C++20
1487*700637cbSDimitry Andric    partition_copy(InputIterator first, InputIterator last,
1488*700637cbSDimitry Andric                   OutputIterator1 out_true, OutputIterator2 out_false,
1489*700637cbSDimitry Andric                   Predicate pred);
1490*700637cbSDimitry Andric
1491*700637cbSDimitry Andrictemplate <class ForwardIterator, class Predicate>
1492*700637cbSDimitry Andric    ForwardIterator
1493*700637cbSDimitry Andric    stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1494*700637cbSDimitry Andric
1495*700637cbSDimitry Andrictemplate<class ForwardIterator, class Predicate>
1496*700637cbSDimitry Andric    constexpr ForwardIterator  // constexpr in C++20
1497*700637cbSDimitry Andric    partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1498*700637cbSDimitry Andric
1499*700637cbSDimitry Andrictemplate <class ForwardIterator>
1500*700637cbSDimitry Andric    constexpr bool  // constexpr in C++20
1501*700637cbSDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last);
1502*700637cbSDimitry Andric
1503*700637cbSDimitry Andrictemplate <class ForwardIterator, class Compare>
1504*700637cbSDimitry Andric    constexpr bool  // constexpr in C++20
1505*700637cbSDimitry Andric    is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1506*700637cbSDimitry Andric
1507*700637cbSDimitry Andrictemplate<class ForwardIterator>
1508*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
1509*700637cbSDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last);
1510*700637cbSDimitry Andric
1511*700637cbSDimitry Andrictemplate <class ForwardIterator, class Compare>
1512*700637cbSDimitry Andric    constexpr ForwardIterator    // constexpr in C++20
1513*700637cbSDimitry Andric    is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1514*700637cbSDimitry Andric
1515*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1516*700637cbSDimitry Andric    constexpr void               // constexpr in C++20
1517*700637cbSDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last);
1518*700637cbSDimitry Andric
1519*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1520*700637cbSDimitry Andric    constexpr void               // constexpr in C++20
1521*700637cbSDimitry Andric    sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1522*700637cbSDimitry Andric
1523*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1524*700637cbSDimitry Andric    void
1525*700637cbSDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1526*700637cbSDimitry Andric
1527*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1528*700637cbSDimitry Andric    void
1529*700637cbSDimitry Andric    stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1530*700637cbSDimitry Andric
1531*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1532*700637cbSDimitry Andric    constexpr void                    // constexpr in C++20
1533*700637cbSDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1534*700637cbSDimitry Andric
1535*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1536*700637cbSDimitry Andric    constexpr void                    // constexpr in C++20
1537*700637cbSDimitry Andric    partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1538*700637cbSDimitry Andric
1539*700637cbSDimitry Andrictemplate <class InputIterator, class RandomAccessIterator>
1540*700637cbSDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
1541*700637cbSDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
1542*700637cbSDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last);
1543*700637cbSDimitry Andric
1544*700637cbSDimitry Andrictemplate <class InputIterator, class RandomAccessIterator, class Compare>
1545*700637cbSDimitry Andric    constexpr RandomAccessIterator    // constexpr in C++20
1546*700637cbSDimitry Andric    partial_sort_copy(InputIterator first, InputIterator last,
1547*700637cbSDimitry Andric                      RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1548*700637cbSDimitry Andric
1549*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1550*700637cbSDimitry Andric    constexpr void                    // constexpr in C++20
1551*700637cbSDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1552*700637cbSDimitry Andric
1553*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1554*700637cbSDimitry Andric    constexpr void                    // constexpr in C++20
1555*700637cbSDimitry Andric    nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1556*700637cbSDimitry Andric
1557*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1558*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
1559*700637cbSDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1560*700637cbSDimitry Andric
1561*700637cbSDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1562*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
1563*700637cbSDimitry Andric    lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1564*700637cbSDimitry Andric
1565*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1566*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
1567*700637cbSDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1568*700637cbSDimitry Andric
1569*700637cbSDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1570*700637cbSDimitry Andric    constexpr ForwardIterator                         // constexpr in C++20
1571*700637cbSDimitry Andric    upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1572*700637cbSDimitry Andric
1573*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1574*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
1575*700637cbSDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1576*700637cbSDimitry Andric
1577*700637cbSDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1578*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++20
1579*700637cbSDimitry Andric    equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1580*700637cbSDimitry Andric
1581*700637cbSDimitry Andrictemplate <class ForwardIterator, class T>
1582*700637cbSDimitry Andric    constexpr bool                                    // constexpr in C++20
1583*700637cbSDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1584*700637cbSDimitry Andric
1585*700637cbSDimitry Andrictemplate <class ForwardIterator, class T, class Compare>
1586*700637cbSDimitry Andric    constexpr bool                                    // constexpr in C++20
1587*700637cbSDimitry Andric    binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1588*700637cbSDimitry Andric
1589*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1590*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
1591*700637cbSDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
1592*700637cbSDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1593*700637cbSDimitry Andric
1594*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1595*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
1596*700637cbSDimitry Andric    merge(InputIterator1 first1, InputIterator1 last1,
1597*700637cbSDimitry Andric          InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1598*700637cbSDimitry Andric
1599*700637cbSDimitry Andrictemplate <class BidirectionalIterator>
1600*700637cbSDimitry Andric    void
1601*700637cbSDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1602*700637cbSDimitry Andric
1603*700637cbSDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1604*700637cbSDimitry Andric    void
1605*700637cbSDimitry Andric    inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1606*700637cbSDimitry Andric
1607*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1608*700637cbSDimitry Andric    constexpr bool                                    // constexpr in C++20
1609*700637cbSDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1610*700637cbSDimitry Andric
1611*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
1612*700637cbSDimitry Andric    constexpr bool                                    // constexpr in C++20
1613*700637cbSDimitry Andric    includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1614*700637cbSDimitry Andric
1615*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1616*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
1617*700637cbSDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
1618*700637cbSDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1619*700637cbSDimitry Andric
1620*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1621*700637cbSDimitry Andric    constexpr OutputIterator                          // constexpr in C++20
1622*700637cbSDimitry Andric    set_union(InputIterator1 first1, InputIterator1 last1,
1623*700637cbSDimitry Andric              InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1624*700637cbSDimitry Andric
1625*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1626*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1627*700637cbSDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
1628*700637cbSDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1629*700637cbSDimitry Andric
1630*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1631*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1632*700637cbSDimitry Andric    set_intersection(InputIterator1 first1, InputIterator1 last1,
1633*700637cbSDimitry Andric                     InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1634*700637cbSDimitry Andric
1635*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1636*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1637*700637cbSDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
1638*700637cbSDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1639*700637cbSDimitry Andric
1640*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1641*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1642*700637cbSDimitry Andric    set_difference(InputIterator1 first1, InputIterator1 last1,
1643*700637cbSDimitry Andric                   InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1644*700637cbSDimitry Andric
1645*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator>
1646*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1647*700637cbSDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1648*700637cbSDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1649*700637cbSDimitry Andric
1650*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1651*700637cbSDimitry Andric    constexpr OutputIterator                         // constexpr in C++20
1652*700637cbSDimitry Andric    set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1653*700637cbSDimitry Andric                             InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1654*700637cbSDimitry Andric
1655*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1656*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1657*700637cbSDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last);
1658*700637cbSDimitry Andric
1659*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1660*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1661*700637cbSDimitry Andric    push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1662*700637cbSDimitry Andric
1663*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1664*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1665*700637cbSDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1666*700637cbSDimitry Andric
1667*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1668*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1669*700637cbSDimitry Andric    pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1670*700637cbSDimitry Andric
1671*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1672*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1673*700637cbSDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last);
1674*700637cbSDimitry Andric
1675*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1676*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1677*700637cbSDimitry Andric    make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1678*700637cbSDimitry Andric
1679*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1680*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1681*700637cbSDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1682*700637cbSDimitry Andric
1683*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1684*700637cbSDimitry Andric    constexpr void                                   // constexpr in C++20
1685*700637cbSDimitry Andric    sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1686*700637cbSDimitry Andric
1687*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1688*700637cbSDimitry Andric    constexpr bool   // constexpr in C++20
1689*700637cbSDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last);
1690*700637cbSDimitry Andric
1691*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1692*700637cbSDimitry Andric    constexpr bool   // constexpr in C++20
1693*700637cbSDimitry Andric    is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1694*700637cbSDimitry Andric
1695*700637cbSDimitry Andrictemplate <class RandomAccessIterator>
1696*700637cbSDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
1697*700637cbSDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
1698*700637cbSDimitry Andric
1699*700637cbSDimitry Andrictemplate <class RandomAccessIterator, class Compare>
1700*700637cbSDimitry Andric    constexpr RandomAccessIterator   // constexpr in C++20
1701*700637cbSDimitry Andric    is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1702*700637cbSDimitry Andric
1703*700637cbSDimitry Andrictemplate <class ForwardIterator>
1704*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1705*700637cbSDimitry Andric    min_element(ForwardIterator first, ForwardIterator last);
1706*700637cbSDimitry Andric
1707*700637cbSDimitry Andrictemplate <class ForwardIterator, class Compare>
1708*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1709*700637cbSDimitry Andric    min_element(ForwardIterator first, ForwardIterator last, Compare comp);
1710*700637cbSDimitry Andric
1711*700637cbSDimitry Andrictemplate <class T>
1712*700637cbSDimitry Andric    constexpr const T&               // constexpr in C++14
1713*700637cbSDimitry Andric    min(const T& a, const T& b);
1714*700637cbSDimitry Andric
1715*700637cbSDimitry Andrictemplate <class T, class Compare>
1716*700637cbSDimitry Andric    constexpr const T&               // constexpr in C++14
1717*700637cbSDimitry Andric    min(const T& a, const T& b, Compare comp);
1718*700637cbSDimitry Andric
1719*700637cbSDimitry Andrictemplate<class T>
1720*700637cbSDimitry Andric    constexpr T                      // constexpr in C++14
1721*700637cbSDimitry Andric    min(initializer_list<T> t);
1722*700637cbSDimitry Andric
1723*700637cbSDimitry Andrictemplate<class T, class Compare>
1724*700637cbSDimitry Andric    constexpr T                      // constexpr in C++14
1725*700637cbSDimitry Andric    min(initializer_list<T> t, Compare comp);
1726*700637cbSDimitry Andric
1727*700637cbSDimitry Andrictemplate<class T>
1728*700637cbSDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi);               // C++17
1729*700637cbSDimitry Andric
1730*700637cbSDimitry Andrictemplate<class T, class Compare>
1731*700637cbSDimitry Andric    constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
1732*700637cbSDimitry Andric
1733*700637cbSDimitry Andrictemplate <class ForwardIterator>
1734*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1735*700637cbSDimitry Andric    max_element(ForwardIterator first, ForwardIterator last);
1736*700637cbSDimitry Andric
1737*700637cbSDimitry Andrictemplate <class ForwardIterator, class Compare>
1738*700637cbSDimitry Andric    constexpr ForwardIterator        // constexpr in C++14
1739*700637cbSDimitry Andric    max_element(ForwardIterator first, ForwardIterator last, Compare comp);
1740*700637cbSDimitry Andric
1741*700637cbSDimitry Andrictemplate <class T>
1742*700637cbSDimitry Andric    constexpr const T&               // constexpr in C++14
1743*700637cbSDimitry Andric    max(const T& a, const T& b);
1744*700637cbSDimitry Andric
1745*700637cbSDimitry Andrictemplate <class T, class Compare>
1746*700637cbSDimitry Andric    constexpr const T&               // constexpr in C++14
1747*700637cbSDimitry Andric    max(const T& a, const T& b, Compare comp);
1748*700637cbSDimitry Andric
1749*700637cbSDimitry Andrictemplate<class T>
1750*700637cbSDimitry Andric    constexpr T                      // constexpr in C++14
1751*700637cbSDimitry Andric    max(initializer_list<T> t);
1752*700637cbSDimitry Andric
1753*700637cbSDimitry Andrictemplate<class T, class Compare>
1754*700637cbSDimitry Andric    constexpr T                      // constexpr in C++14
1755*700637cbSDimitry Andric    max(initializer_list<T> t, Compare comp);
1756*700637cbSDimitry Andric
1757*700637cbSDimitry Andrictemplate<class ForwardIterator>
1758*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1759*700637cbSDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last);
1760*700637cbSDimitry Andric
1761*700637cbSDimitry Andrictemplate<class ForwardIterator, class Compare>
1762*700637cbSDimitry Andric    constexpr pair<ForwardIterator, ForwardIterator>  // constexpr in C++14
1763*700637cbSDimitry Andric    minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
1764*700637cbSDimitry Andric
1765*700637cbSDimitry Andrictemplate<class T>
1766*700637cbSDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1767*700637cbSDimitry Andric    minmax(const T& a, const T& b);
1768*700637cbSDimitry Andric
1769*700637cbSDimitry Andrictemplate<class T, class Compare>
1770*700637cbSDimitry Andric    constexpr pair<const T&, const T&>  // constexpr in C++14
1771*700637cbSDimitry Andric    minmax(const T& a, const T& b, Compare comp);
1772*700637cbSDimitry Andric
1773*700637cbSDimitry Andrictemplate<class T>
1774*700637cbSDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1775*700637cbSDimitry Andric    minmax(initializer_list<T> t);
1776*700637cbSDimitry Andric
1777*700637cbSDimitry Andrictemplate<class T, class Compare>
1778*700637cbSDimitry Andric    constexpr pair<T, T>                // constexpr in C++14
1779*700637cbSDimitry Andric    minmax(initializer_list<T> t, Compare comp);
1780*700637cbSDimitry Andric
1781*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2>
1782*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1783*700637cbSDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1784*700637cbSDimitry Andric
1785*700637cbSDimitry Andrictemplate <class InputIterator1, class InputIterator2, class Compare>
1786*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1787*700637cbSDimitry Andric    lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1788*700637cbSDimitry Andric                            InputIterator2 first2, InputIterator2 last2, Compare comp);
1789*700637cbSDimitry Andric
1790*700637cbSDimitry Andrictemplate<class InputIterator1, class InputIterator2, class Cmp>
1791*700637cbSDimitry Andric    constexpr auto
1792*700637cbSDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1793*700637cbSDimitry Andric                                      InputIterator2 first2, InputIterator2 last2,
1794*700637cbSDimitry Andric                                      Cmp comp)
1795*700637cbSDimitry Andric      -> decltype(comp(*b1, *b2));                                                        // since C++20
1796*700637cbSDimitry Andric
1797*700637cbSDimitry Andrictemplate<class InputIterator1, class InputIterator2>
1798*700637cbSDimitry Andric    constexpr auto
1799*700637cbSDimitry Andric    lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1800*700637cbSDimitry Andric                                      InputIterator2 first2, InputIterator2 last2);      // since C++20
1801*700637cbSDimitry Andric
1802*700637cbSDimitry Andrictemplate <class BidirectionalIterator>
1803*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1804*700637cbSDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1805*700637cbSDimitry Andric
1806*700637cbSDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1807*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1808*700637cbSDimitry Andric    next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1809*700637cbSDimitry Andric
1810*700637cbSDimitry Andrictemplate <class BidirectionalIterator>
1811*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1812*700637cbSDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1813*700637cbSDimitry Andric
1814*700637cbSDimitry Andrictemplate <class BidirectionalIterator, class Compare>
1815*700637cbSDimitry Andric    constexpr bool     // constexpr in C++20
1816*700637cbSDimitry Andric    prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1817*700637cbSDimitry Andric}  // std
1818*700637cbSDimitry Andric
1819*700637cbSDimitry Andric*/
1820*700637cbSDimitry Andric
1821*700637cbSDimitry Andric#include <__cxx03/__config>
1822*700637cbSDimitry Andric
1823*700637cbSDimitry Andric#include <__cxx03/__algorithm/adjacent_find.h>
1824*700637cbSDimitry Andric#include <__cxx03/__algorithm/all_of.h>
1825*700637cbSDimitry Andric#include <__cxx03/__algorithm/any_of.h>
1826*700637cbSDimitry Andric#include <__cxx03/__algorithm/binary_search.h>
1827*700637cbSDimitry Andric#include <__cxx03/__algorithm/copy.h>
1828*700637cbSDimitry Andric#include <__cxx03/__algorithm/copy_backward.h>
1829*700637cbSDimitry Andric#include <__cxx03/__algorithm/copy_if.h>
1830*700637cbSDimitry Andric#include <__cxx03/__algorithm/copy_n.h>
1831*700637cbSDimitry Andric#include <__cxx03/__algorithm/count.h>
1832*700637cbSDimitry Andric#include <__cxx03/__algorithm/count_if.h>
1833*700637cbSDimitry Andric#include <__cxx03/__algorithm/equal.h>
1834*700637cbSDimitry Andric#include <__cxx03/__algorithm/equal_range.h>
1835*700637cbSDimitry Andric#include <__cxx03/__algorithm/fill.h>
1836*700637cbSDimitry Andric#include <__cxx03/__algorithm/fill_n.h>
1837*700637cbSDimitry Andric#include <__cxx03/__algorithm/find.h>
1838*700637cbSDimitry Andric#include <__cxx03/__algorithm/find_end.h>
1839*700637cbSDimitry Andric#include <__cxx03/__algorithm/find_first_of.h>
1840*700637cbSDimitry Andric#include <__cxx03/__algorithm/find_if.h>
1841*700637cbSDimitry Andric#include <__cxx03/__algorithm/find_if_not.h>
1842*700637cbSDimitry Andric#include <__cxx03/__algorithm/for_each.h>
1843*700637cbSDimitry Andric#include <__cxx03/__algorithm/generate.h>
1844*700637cbSDimitry Andric#include <__cxx03/__algorithm/generate_n.h>
1845*700637cbSDimitry Andric#include <__cxx03/__algorithm/includes.h>
1846*700637cbSDimitry Andric#include <__cxx03/__algorithm/inplace_merge.h>
1847*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_heap.h>
1848*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_heap_until.h>
1849*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_partitioned.h>
1850*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_permutation.h>
1851*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_sorted.h>
1852*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_sorted_until.h>
1853*700637cbSDimitry Andric#include <__cxx03/__algorithm/iter_swap.h>
1854*700637cbSDimitry Andric#include <__cxx03/__algorithm/lexicographical_compare.h>
1855*700637cbSDimitry Andric#include <__cxx03/__algorithm/lower_bound.h>
1856*700637cbSDimitry Andric#include <__cxx03/__algorithm/make_heap.h>
1857*700637cbSDimitry Andric#include <__cxx03/__algorithm/max.h>
1858*700637cbSDimitry Andric#include <__cxx03/__algorithm/max_element.h>
1859*700637cbSDimitry Andric#include <__cxx03/__algorithm/merge.h>
1860*700637cbSDimitry Andric#include <__cxx03/__algorithm/min.h>
1861*700637cbSDimitry Andric#include <__cxx03/__algorithm/min_element.h>
1862*700637cbSDimitry Andric#include <__cxx03/__algorithm/minmax.h>
1863*700637cbSDimitry Andric#include <__cxx03/__algorithm/minmax_element.h>
1864*700637cbSDimitry Andric#include <__cxx03/__algorithm/mismatch.h>
1865*700637cbSDimitry Andric#include <__cxx03/__algorithm/move.h>
1866*700637cbSDimitry Andric#include <__cxx03/__algorithm/move_backward.h>
1867*700637cbSDimitry Andric#include <__cxx03/__algorithm/next_permutation.h>
1868*700637cbSDimitry Andric#include <__cxx03/__algorithm/none_of.h>
1869*700637cbSDimitry Andric#include <__cxx03/__algorithm/nth_element.h>
1870*700637cbSDimitry Andric#include <__cxx03/__algorithm/partial_sort.h>
1871*700637cbSDimitry Andric#include <__cxx03/__algorithm/partial_sort_copy.h>
1872*700637cbSDimitry Andric#include <__cxx03/__algorithm/partition.h>
1873*700637cbSDimitry Andric#include <__cxx03/__algorithm/partition_copy.h>
1874*700637cbSDimitry Andric#include <__cxx03/__algorithm/partition_point.h>
1875*700637cbSDimitry Andric#include <__cxx03/__algorithm/pop_heap.h>
1876*700637cbSDimitry Andric#include <__cxx03/__algorithm/prev_permutation.h>
1877*700637cbSDimitry Andric#include <__cxx03/__algorithm/push_heap.h>
1878*700637cbSDimitry Andric#include <__cxx03/__algorithm/remove.h>
1879*700637cbSDimitry Andric#include <__cxx03/__algorithm/remove_copy.h>
1880*700637cbSDimitry Andric#include <__cxx03/__algorithm/remove_copy_if.h>
1881*700637cbSDimitry Andric#include <__cxx03/__algorithm/remove_if.h>
1882*700637cbSDimitry Andric#include <__cxx03/__algorithm/replace.h>
1883*700637cbSDimitry Andric#include <__cxx03/__algorithm/replace_copy.h>
1884*700637cbSDimitry Andric#include <__cxx03/__algorithm/replace_copy_if.h>
1885*700637cbSDimitry Andric#include <__cxx03/__algorithm/replace_if.h>
1886*700637cbSDimitry Andric#include <__cxx03/__algorithm/reverse.h>
1887*700637cbSDimitry Andric#include <__cxx03/__algorithm/reverse_copy.h>
1888*700637cbSDimitry Andric#include <__cxx03/__algorithm/rotate.h>
1889*700637cbSDimitry Andric#include <__cxx03/__algorithm/rotate_copy.h>
1890*700637cbSDimitry Andric#include <__cxx03/__algorithm/search.h>
1891*700637cbSDimitry Andric#include <__cxx03/__algorithm/search_n.h>
1892*700637cbSDimitry Andric#include <__cxx03/__algorithm/set_difference.h>
1893*700637cbSDimitry Andric#include <__cxx03/__algorithm/set_intersection.h>
1894*700637cbSDimitry Andric#include <__cxx03/__algorithm/set_symmetric_difference.h>
1895*700637cbSDimitry Andric#include <__cxx03/__algorithm/set_union.h>
1896*700637cbSDimitry Andric#include <__cxx03/__algorithm/shuffle.h>
1897*700637cbSDimitry Andric#include <__cxx03/__algorithm/sort.h>
1898*700637cbSDimitry Andric#include <__cxx03/__algorithm/sort_heap.h>
1899*700637cbSDimitry Andric#include <__cxx03/__algorithm/stable_partition.h>
1900*700637cbSDimitry Andric#include <__cxx03/__algorithm/stable_sort.h>
1901*700637cbSDimitry Andric#include <__cxx03/__algorithm/swap_ranges.h>
1902*700637cbSDimitry Andric#include <__cxx03/__algorithm/transform.h>
1903*700637cbSDimitry Andric#include <__cxx03/__algorithm/unique.h>
1904*700637cbSDimitry Andric#include <__cxx03/__algorithm/unique_copy.h>
1905*700637cbSDimitry Andric#include <__cxx03/__algorithm/upper_bound.h>
1906*700637cbSDimitry Andric
1907*700637cbSDimitry Andric#include <__cxx03/version>
1908*700637cbSDimitry Andric
1909*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1910*700637cbSDimitry Andric#  pragma GCC system_header
1911*700637cbSDimitry Andric#endif
1912*700637cbSDimitry Andric
1913*700637cbSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
1914*700637cbSDimitry Andric#  include <__cxx03/atomic>
1915*700637cbSDimitry Andric#  include <__cxx03/cstdlib>
1916*700637cbSDimitry Andric#  include <__cxx03/cstring>
1917*700637cbSDimitry Andric#  include <__cxx03/iterator>
1918*700637cbSDimitry Andric#  include <__cxx03/memory>
1919*700637cbSDimitry Andric#  include <__cxx03/stdexcept>
1920*700637cbSDimitry Andric#  include <__cxx03/type_traits>
1921*700637cbSDimitry Andric#  include <__cxx03/utility>
1922*700637cbSDimitry Andric#endif
1923*700637cbSDimitry Andric
1924*700637cbSDimitry Andric#endif // _LIBCPP___CXX03_ALGORITHM
1925