blob: 70e30bc87e8128b8700b4bc7aae5156d6486c204 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:161// -*- C++ -*-
Louis Dionneeb8650a2021-11-17 21:25:012//===----------------------------------------------------------------------===//
Howard Hinnant3e519522010-05-11 19:42:163//
Chandler Carruth57b08b02019-01-19 10:56:404// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Howard Hinnant3e519522010-05-11 19:42:167//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_ALGORITHM
11#define _LIBCPP_ALGORITHM
12
13/*
14 algorithm synopsis
15
16#include <initializer_list>
17
18namespace std
19{
20
Nikolas Klauserd3729bb2022-01-14 01:55:5121namespace ranges {
Konstantin Varlamov79a2b4b2022-06-28 18:59:5922
23 // [algorithms.results], algorithm result types
Nikolas Klauser1e77b392022-02-11 16:01:5824 template <class I, class F>
Mark de Weverde6827b2023-02-24 20:35:4125 struct in_fun_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5826
Nikolas Klauserd3729bb2022-01-14 01:55:5127 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4128 struct in_in_result; // since C++20
Nikolas Klauserf3514af2022-01-25 10:21:4729
Konstantin Varlamov79a2b4b2022-06-28 18:59:5930 template <class I, class O>
Mark de Weverde6827b2023-02-24 20:35:4131 struct in_out_result; // since C++20
Konstantin Varlamov79a2b4b2022-06-28 18:59:5932
Nikolas Klauserf3514af2022-01-25 10:21:4733 template <class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:4134 struct in_in_out_result; // since C++20
Nikolas Klauser610979b2022-02-03 01:17:0335
36 template <class I, class O1, class O2>
Mark de Weverde6827b2023-02-24 20:35:4137 struct in_out_out_result; // since C++20
Nikolas Klauser1e77b392022-02-11 16:01:5838
Nikolas Klauser807766b2022-02-21 21:48:3639 template <class I1, class I2>
Mark de Weverde6827b2023-02-24 20:35:4140 struct min_max_result; // since C++20
Nikolas Klauser807766b2022-02-21 21:48:3641
Nikolas Klauser68f41312022-02-21 22:07:0242 template <class I>
Mark de Weverde6827b2023-02-24 20:35:4143 struct in_found_result; // since C++20
Nikolas Klauser68f41312022-02-21 22:07:0244
Christopher Di Bella39034382023-12-20 05:57:5045 template <class I, class T>
46 struct in_value_result; // since C++23
47
Nikolas Klauser3b470d12022-02-11 12:11:5748 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4149 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5750 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
51
52 template<forward_range R, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:4153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
Nikolas Klauser3b470d12022-02-11 12:11:5754 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
Nikolas Klauserc2cd15a2022-03-08 22:12:3555
Nikolas Klauser40f7fca32022-05-22 11:43:3756 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4158 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3759
60 template<forward_range R, class Proj = identity,
61 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:4162 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser40f7fca32022-05-22 11:43:3763
Konstantin Varlamov79a2b4b2022-06-28 18:59:5964 template<class I1, class I2>
65 using mismatch_result = in_in_result<I1, I2>;
66
Nikolas Klauserc2cd15a2022-03-08 22:12:3567 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
68 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
69 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
Mark de Weverde6827b2023-02-24 20:35:4170 constexpr mismatch_result<_I1, _I2> // since C++20
71 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
Nikolas Klauserc2cd15a2022-03-08 22:12:3572
73 template <input_range R1, input_range R2,
74 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
75 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
76 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Mark de Weverde6827b2023-02-24 20:35:4177 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3578
Nikolas Klauseree0f8c42022-03-12 00:45:3579 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
Mark de Weverde6827b2023-02-24 20:35:4180 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3581
82 template<input_range R, class T, class Proj = identity>
83 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
84 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4185 find(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3586
87 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
88 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4189 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3590
91 template<input_range R, class Proj = identity,
92 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
93 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:4194 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3595
96 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
97 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:4198 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauseree0f8c42022-03-12 00:45:3599
100 template<input_range R, class Proj = identity,
101 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
102 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41103 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08104
Nikolas Klausere476df52022-04-03 07:17:01105 template<class T, class Proj = identity,
106 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41107 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08108
Nikolas Klausere476df52022-04-03 07:17:01109 template<copyable T, class Proj = identity,
110 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41111 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauserf83d8332022-03-18 01:57:08112
113 template<input_range R, class Proj = identity,
114 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
115 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
116 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41117 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01118
119 template<class T, class Proj = identity,
120 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41121 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01122
123 template<copyable T, class Proj = identity,
124 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41125 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klausere476df52022-04-03 07:17:01126
127 template<input_range R, class Proj = identity,
128 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
129 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
130 constexpr range_value_t<R>
Mark de Weverde6827b2023-02-24 20:35:41131 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36132
133 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41134 using unary_transform_result = in_out_result<I, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36135
136 template<class I1, class I2, class O>
Mark de Weverde6827b2023-02-24 20:35:41137 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36138
139 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
140 copy_constructible F, class Proj = identity>
141 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
142 constexpr ranges::unary_transform_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:41143 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36144
145 template<input_range R, weakly_incrementable O, copy_constructible F,
146 class Proj = identity>
147 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
148 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:41149 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36150
151 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
152 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
153 class Proj2 = identity>
154 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
155 projected<I2, Proj2>>>
156 constexpr ranges::binary_transform_result<I1, I2, O>
157 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
Mark de Weverde6827b2023-02-24 20:35:41158 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser3ba85482022-04-05 09:05:36159
160 template<input_range R1, input_range R2, weakly_incrementable O,
161 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
162 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
163 projected<iterator_t<R2>, Proj2>>>
164 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
165 transform(R1&& r1, R2&& r2, O result,
Mark de Weverde6827b2023-02-24 20:35:41166 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02167
168 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
169 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
170 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41171 count(I first, S last, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02172
173 template<input_range R, class T, class Proj = identity>
174 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
175 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41176 count(R&& r, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02177
178 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
179 indirect_unary_predicate<projected<I, Proj>> Pred>
180 constexpr iter_difference_t<I>
Mark de Weverde6827b2023-02-24 20:35:41181 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser1306b102022-04-07 11:02:02182
183 template<input_range R, class Proj = identity,
184 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
185 constexpr range_difference_t<R>
Mark de Weverde6827b2023-02-24 20:35:41186 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09187
Konstantin Varlamov79a2b4b2022-06-28 18:59:59188 template<class T>
189 using minmax_result = min_max_result<T>;
190
Nikolas Klauser58d9ab72022-04-13 20:59:09191 template<class T, class Proj = identity,
192 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
193 constexpr ranges::minmax_result<const T&>
Mark de Weverde6827b2023-02-24 20:35:41194 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09195
196 template<copyable T, class Proj = identity,
197 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
198 constexpr ranges::minmax_result<T>
Mark de Weverde6827b2023-02-24 20:35:41199 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09200
201 template<input_range R, class Proj = identity,
202 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
203 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
204 constexpr ranges::minmax_result<range_value_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41205 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09206
Konstantin Varlamov79a2b4b2022-06-28 18:59:59207 template<class I>
208 using minmax_element_result = min_max_result<I>;
209
Nikolas Klauser58d9ab72022-04-13 20:59:09210 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
211 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
212 constexpr ranges::minmax_element_result<I>
Mark de Weverde6827b2023-02-24 20:35:41213 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser58d9ab72022-04-13 20:59:09214
215 template<forward_range R, class Proj = identity,
216 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
217 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41218 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40219
ZijunZhaoCCKa6b846a2024-02-13 23:42:37220 template<forward_iterator I1, sentinel_for<I1> S1,
221 forward_iterator I2, sentinel_for<I2> S2,
222 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
223 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
224 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
225 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
226
227 template<forward_range R1, forward_range R2,
228 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
229 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
230 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
231 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
232
Nikolas Klauser1d837502022-04-15 11:43:40233 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41234 using copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40235
Konstantin Varlamov79a2b4b2022-06-28 18:59:59236 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:41237 using copy_n_result = in_out_result<I, O>; // since C++20
Nikolas Klauser1d837502022-04-15 11:43:40238
239 template<class I, class O>
240 using copy_if_result = in_out_result<I, O>; // since C++20
241
242 template<class I1, class I2>
243 using copy_backward_result = in_out_result<I1, I2>; // since C++20
244
ZijunZhaoCCKfdd089b2023-12-20 00:34:19245 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
246 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
247 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
248
249 template<input_range R, class T, class Proj = identity>
250 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
251 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
252
Nikolas Klauser1d837502022-04-15 11:43:40253 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
254 requires indirectly_copyable<I, O>
255 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
256
257 template<input_range R, weakly_incrementable O>
258 requires indirectly_copyable<iterator_t<R>, O>
259 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
260
261 template<input_iterator I, weakly_incrementable O>
262 requires indirectly_copyable<I, O>
263 constexpr ranges::copy_n_result<I, O>
264 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
265
266 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
267 indirect_unary_predicate<projected<I, Proj>> Pred>
268 requires indirectly_copyable<I, O>
269 constexpr ranges::copy_if_result<I, O>
270 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
271
272 template<input_range R, weakly_incrementable O, class Proj = identity,
273 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
274 requires indirectly_copyable<iterator_t<R>, O>
275 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
276 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
277
278 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
279 requires indirectly_copyable<I1, I2>
280 constexpr ranges::copy_backward_result<I1, I2>
281 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
282
283 template<bidirectional_range R, bidirectional_iterator I>
284 requires indirectly_copyable<iterator_t<R>, I>
285 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
286 ranges::copy_backward(R&& r, I result); // since C++20
Nikolas Klauser80045e92022-05-04 18:27:07287
288 template<class I, class F>
289 using for_each_result = in_fun_result<I, F>; // since C++20
290
291 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
292 indirectly_unary_invocable<projected<I, Proj>> Fun>
293 constexpr ranges::for_each_result<I, Fun>
294 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
295
296 template<input_range R, class Proj = identity,
297 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
298 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
299 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
300
301 template<input_iterator I, class Proj = identity,
302 indirectly_unary_invocable<projected<I, Proj>> Fun>
303 constexpr ranges::for_each_n_result<I, Fun>
304 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
Nikolas Klauser37ba1b92022-05-04 12:19:09305
306 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
307 indirect_unary_predicate<projected<I, Proj>> Pred>
308 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
309
310 template<input_range R, class Proj = identity,
311 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
312 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
313
Konstantin Varlamovc945bd02022-07-08 20:46:27314 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
315 class Proj = identity>
316 requires sortable<I, Comp, Proj>
317 constexpr I
318 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
319
320 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
321 requires sortable<iterator_t<R>, Comp, Proj>
322 constexpr borrowed_iterator_t<R>
323 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
324
325 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
326 class Proj = identity>
327 requires sortable<I, Comp, Proj>
328 constexpr I
329 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
330
331 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
332 requires sortable<iterator_t<R>, Comp, Proj>
333 constexpr borrowed_iterator_t<R>
334 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
335
336 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
337 class Proj = identity>
338 requires sortable<I, Comp, Proj>
339 constexpr I
340 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
341
342 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
343 requires sortable<iterator_t<R>, Comp, Proj>
344 constexpr borrowed_iterator_t<R>
345 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
346
347 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
348 class Proj = identity>
349 requires sortable<I, Comp, Proj>
350 constexpr I
351 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
352
353 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
354 requires sortable<iterator_t<R>, Comp, Proj>
355 constexpr borrowed_iterator_t<R>
356 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
357
Konstantin Varlamovd406c642022-07-26 23:11:09358 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
359 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41360 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09361
362 template<random_access_range R, class Proj = identity,
363 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41364 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09365
366 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
367 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
Mark de Weverde6827b2023-02-24 20:35:41368 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09369
370 template<random_access_range R, class Proj = identity,
371 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
372 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41373 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovd406c642022-07-26 23:11:09374
Nikolas Klauser1d1a1912022-05-24 08:32:50375 template<bidirectional_iterator I, sentinel_for<I> S>
376 requires permutable<I>
377 constexpr I ranges::reverse(I first, S last); // since C++20
378
379 template<bidirectional_range R>
380 requires permutable<iterator_t<R>>
381 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
382
Konstantin Varlamovff3989e2022-06-16 22:20:53383 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
384 class Proj = identity>
385 requires sortable<I, Comp, Proj>
386 constexpr I
Konstantin Varlamov94c7b892022-07-01 23:34:08387 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53388
389 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
390 requires sortable<iterator_t<R>, Comp, Proj>
391 constexpr borrowed_iterator_t<R>
Konstantin Varlamov94c7b892022-07-01 23:34:08392 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
393
394 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
395 class Proj = identity>
396 requires sortable<I, Comp, Proj>
397 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
398
399 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
400 requires sortable<iterator_t<R>, Comp, Proj>
401 borrowed_iterator_t<R>
402 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamovff3989e2022-06-16 22:20:53403
varconst5dd19ad2022-07-20 03:10:02404 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
405 class Proj = identity>
406 requires sortable<I, Comp, Proj>
407 constexpr I
408 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
409
410 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
411 requires sortable<iterator_t<R>, Comp, Proj>
412 constexpr borrowed_iterator_t<R>
413 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
414
Nikolas Klauser7af89a32022-05-21 16:26:29415 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
416 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
417
418 template<class T, output_range<const T&> R>
419 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
420
421 template<class T, output_iterator<const T&> O>
422 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
Nikolas Klauser569d6632022-05-25 09:09:43423
Konstantin Varlamovead73022022-07-26 22:50:14424 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
425 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41426 constexpr O generate(O first, S last, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14427
Nikolas Klausercd916102023-06-09 20:45:34428 template<class ExecutionPolicy, class ForwardIterator, class Generator>
429 void generate(ExecutionPolicy&& exec,
430 ForwardIterator first, ForwardIterator last,
431 Generator gen); // since C++17
432
Konstantin Varlamovead73022022-07-26 22:50:14433 template<class R, copy_constructible F>
434 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41435 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14436
437 template<input_or_output_iterator O, copy_constructible F>
438 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
Mark de Weverde6827b2023-02-24 20:35:41439 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
Konstantin Varlamovead73022022-07-26 22:50:14440
Nikolas Klausercd916102023-06-09 20:45:34441 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
442 ForwardIterator generate_n(ExecutionPolicy&& exec,
443 ForwardIterator first, Size n, Generator gen); // since C++17
444
Nikolas Klauser569d6632022-05-25 09:09:43445 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
446 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
447 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
448 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
449 Pred pred = {},
450 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
451
452 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
453 class Proj1 = identity, class Proj2 = identity>
454 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
455 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
456 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
457
Nikolas Klauser0e3dc1a2022-05-26 14:42:46458 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
459 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41460 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46461
462 template<input_range R, class Proj = identity,
463 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41464 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46465
466 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
467 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41468 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46469
470 template<input_range R, class Proj = identity,
471 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41472 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46473
Zijun Zhao0218ea42023-09-18 18:28:11474 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
475 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
476 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
477 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
478 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
479 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
480 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
481
482 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
483 class Proj2 = identity>
484 requires (forward_range<R1> || sized_range<R1>) &&
485 (forward_range<R2> || sized_range<R2>) &&
486 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
487 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
488 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
489
Nikolas Klauser0e3dc1a2022-05-26 14:42:46490 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
491 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41492 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46493
494 template<input_range R, class Proj = identity,
495 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41496 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser0e3dc1a2022-05-26 14:42:46497
zijunzhao20517552023-05-08 22:04:00498 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
499 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
500 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
501 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
502 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
503
504 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
505 class Proj2 = identity>
506 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
507 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
508 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
509
Konstantin Varlamovdb7d7952022-07-30 09:42:05510 template<input_iterator I1, sentinel_for<I1> S1,
511 random_access_iterator I2, sentinel_for<I2> S2,
512 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
513 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
514 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
515 constexpr partial_sort_copy_result<I1, I2>
516 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
Mark de Weverde6827b2023-02-24 20:35:41517 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05518
519 template<input_range R1, random_access_range R2, class Comp = ranges::less,
520 class Proj1 = identity, class Proj2 = identity>
521 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
522 sortable<iterator_t<R2>, Comp, Proj2> &&
523 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
524 projected<iterator_t<R2>, Proj2>>
525 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
526 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41527 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Konstantin Varlamovdb7d7952022-07-30 09:42:05528
Nikolas Klauser11e3ad22022-05-26 14:08:55529 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
530 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
531 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
532
533 template<forward_range R, class Proj = identity,
534 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
535 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
536
537 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
538 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
539 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
540
541 template<forward_range R, class Proj = identity,
542 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
543 constexpr borrowed_iterator_t<R>
544 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16545
Konstantin Varlamov23c73282022-07-08 03:35:51546 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
547 class Proj = identity>
548 requires sortable<I, Comp, Proj>
549 constexpr I
Mark de Weverde6827b2023-02-24 20:35:41550 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51551
552 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
553 requires sortable<iterator_t<R>, Comp, Proj>
554 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41555 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
Konstantin Varlamov23c73282022-07-08 03:35:51556
Nikolas Klauser81715862022-06-05 19:15:16557 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
Mark de Weverde6827b2023-02-24 20:35:41558 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
559 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
Nikolas Klauser81715862022-06-05 19:15:16560
561 template<forward_range R, class T, class Proj = identity,
562 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
563 ranges::less>
564 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41565 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16566
567 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
568 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
569 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41570 Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16571 template<forward_range R, class T, class Proj = identity,
572 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
573 ranges::less>
574 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41575 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16576
577 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
578 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
579 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41580 Proj proj = {}); // since C++20
Nikolas Klauserb79b2b62022-06-06 11:57:34581
Nikolas Klauser81715862022-06-05 19:15:16582 template<forward_range R, class T, class Proj = identity,
583 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
584 ranges::less>
585 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41586 Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51587
588 template<permutable I, sentinel_for<I> S, class Proj = identity,
589 indirect_unary_predicate<projected<I, Proj>> Pred>
590 constexpr subrange<I>
Mark de Weverde6827b2023-02-24 20:35:41591 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51592
593 template<forward_range R, class Proj = identity,
594 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
595 requires permutable<iterator_t<R>>
596 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:41597 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51598
599 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
600 indirect_unary_predicate<projected<I, Proj>> Pred>
601 requires permutable<I>
Mark de Weverde6827b2023-02-24 20:35:41602 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51603
604 template<bidirectional_range R, class Proj = identity,
605 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
606 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41607 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov8ed702b2022-07-19 04:05:51608
Nikolas Klauserb79b2b62022-06-06 11:57:34609 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
610 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
611 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
612 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
613 Pred pred = {},
614 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
615
616 template<input_range R1, forward_range R2,
617 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
618 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
619 constexpr borrowed_iterator_t<R1>
620 ranges::find_first_of(R1&& r1, R2&& r2,
621 Pred pred = {},
622 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser81715862022-06-05 19:15:16623
Nikolas Klauser916e9052022-06-08 10:14:12624 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
625 indirect_binary_predicate<projected<I, Proj>,
626 projected<I, Proj>> Pred = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:41627 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
Nikolas Klauser916e9052022-06-08 10:14:12628
629 template<forward_range R, class Proj = identity,
630 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
631 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
632 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
633
Nikolas Klauserff6d5de2022-06-07 07:42:10634 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
635 requires indirectly_writable<I, const T2&> &&
636 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
637 constexpr I
638 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
639
640 template<input_range R, class T1, class T2, class Proj = identity>
641 requires indirectly_writable<iterator_t<R>, const T2&> &&
642 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
643 constexpr borrowed_iterator_t<R>
644 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
645
646 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
647 indirect_unary_predicate<projected<I, Proj>> Pred>
648 requires indirectly_writable<I, const T&>
649 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
650
651 template<input_range R, class T, class Proj = identity,
652 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
653 requires indirectly_writable<iterator_t<R>, const T&>
654 constexpr borrowed_iterator_t<R>
655 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
656
Nikolas Klausera203acb2022-08-03 23:30:50657 template<class T, class Proj = identity,
658 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
659 constexpr const T&
660 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
661
Nikolas Klauserafd5a4f2022-06-15 14:24:43662 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
663 class Proj1 = identity, class Proj2 = identity,
664 indirect_strict_weak_order<projected<I1, Proj1>,
665 projected<I2, Proj2>> Comp = ranges::less>
666 constexpr bool
667 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
Mark de Weverde6827b2023-02-24 20:35:41668 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43669
670 template<input_range R1, input_range R2, class Proj1 = identity,
671 class Proj2 = identity,
672 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
673 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
674 constexpr bool
675 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41676 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserafd5a4f2022-06-15 14:24:43677
Nikolas Klauser2c3bbac2022-06-23 10:23:41678 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
679 requires indirectly_movable<I1, I2>
680 constexpr ranges::move_backward_result<I1, I2>
681 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
682
683 template<bidirectional_range R, bidirectional_iterator I>
684 requires indirectly_movable<iterator_t<R>, I>
685 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
686 ranges::move_backward(R&& r, I result); // since C++20
687
688 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
689 requires indirectly_movable<I, O>
690 constexpr ranges::move_result<I, O>
691 ranges::move(I first, S last, O result); // since C++20
692
693 template<input_range R, weakly_incrementable O>
694 requires indirectly_movable<iterator_t<R>, O>
695 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
696 ranges::move(R&& r, O result); // since C++20
697
Konstantin Varlamov065202f2022-07-20 08:57:13698 template<class I, class O1, class O2>
699 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
700
701 template<input_iterator I, sentinel_for<I> S,
702 weakly_incrementable O1, weakly_incrementable O2,
703 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
704 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
705 constexpr partition_copy_result<I, O1, O2>
706 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
Mark de Weverde6827b2023-02-24 20:35:41707 Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13708
709 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
710 class Proj = identity,
711 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
712 requires indirectly_copyable<iterator_t<R>, O1> &&
713 indirectly_copyable<iterator_t<R>, O2>
714 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
Mark de Weverde6827b2023-02-24 20:35:41715 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13716
717 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
718 indirect_unary_predicate<projected<I, Proj>> Pred>
Mark de Weverde6827b2023-02-24 20:35:41719 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13720
721 template<forward_range R, class Proj = identity,
722 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
723 constexpr borrowed_iterator_t<R>
Mark de Weverde6827b2023-02-24 20:35:41724 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
Konstantin Varlamov065202f2022-07-20 08:57:13725
Hui Xie25607d12022-06-26 15:13:43726 template<class I1, class I2, class O>
727 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
728
729 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
730 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
731 class Proj2 = identity>
732 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
733 constexpr merge_result<I1, I2, O>
734 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
735 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
736
737 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
738 class Proj1 = identity, class Proj2 = identity>
739 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
740 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
741 merge(R1&& r1, R2&& r2, O result,
742 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser2c3bbac2022-06-23 10:23:41743
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00744 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
745 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
746 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
747
748 template<forward_range R, class T, class Proj = identity>
749 requires permutable<iterator_t<R>> &&
750 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
751 constexpr borrowed_subrange_t<R>
752 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
753
754 template<permutable I, sentinel_for<I> S, class Proj = identity,
755 indirect_unary_predicate<projected<I, Proj>> Pred>
756 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
757
758 template<forward_range R, class Proj = identity,
759 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
760 requires permutable<iterator_t<R>>
761 constexpr borrowed_subrange_t<R>
762 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser7d426a32022-07-11 15:07:35763
Hui Xie1cdec6c2022-06-26 15:13:43764 template<class I, class O>
Nikolas Klauser7d426a32022-07-11 15:07:35765 using set_difference_result = in_out_result<I, O>; // since C++20
Hui Xie1cdec6c2022-06-26 15:13:43766
767 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
768 weakly_incrementable O, class Comp = ranges::less,
769 class Proj1 = identity, class Proj2 = identity>
770 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
771 constexpr set_difference_result<I1, O>
772 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
773 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
774
775 template<input_range R1, input_range R2, weakly_incrementable O,
776 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
777 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
778 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
779 set_difference(R1&& r1, R2&& r2, O result,
780 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:00781
Hui Xie96b674f2022-07-08 14:21:40782 template<class I1, class I2, class O>
783 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
784
785 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
786 weakly_incrementable O, class Comp = ranges::less,
787 class Proj1 = identity, class Proj2 = identity>
788 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
789 constexpr set_intersection_result<I1, I2, O>
790 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
791 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
792
793 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
794 weakly_incrementable O, class Comp = ranges::less,
795 class Proj1 = identity, class Proj2 = identity>
796 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
797 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
798 set_intersection(R1&& r1, R2&& r2, O result,
799 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
800
Nikolas Klauser7d426a32022-07-11 15:07:35801 template <class _InIter, class _OutIter>
802 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
803
804 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
805 requires indirectly_copyable<I, O>
806 constexpr ranges::reverse_copy_result<I, O>
807 ranges::reverse_copy(I first, S last, O result); // since C++20
808
809 template<bidirectional_range R, weakly_incrementable O>
810 requires indirectly_copyable<iterator_t<R>, O>
811 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
812 ranges::reverse_copy(R&& r, O result); // since C++20
813
Konstantin Varlamov36c746c2022-08-03 23:04:14814 template<permutable I, sentinel_for<I> S>
815 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
816
817 template<forward_range R>
818 requires permutable<iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:41819 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
Konstantin Varlamov36c746c2022-08-03 23:04:14820
Nikolas Klauser7d426a32022-07-11 15:07:35821 template <class _InIter, class _OutIter>
822 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
823
824 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
825 requires indirectly_copyable<I, O>
826 constexpr ranges::rotate_copy_result<I, O>
827 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
828
829 template<forward_range R, weakly_incrementable O>
830 requires indirectly_copyable<iterator_t<R>, O>
831 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
832 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
833
Konstantin Varlamov6bdb6422022-08-03 05:33:12834 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
835 requires (forward_iterator<I> || random_access_iterator<O>) &&
836 indirectly_copyable<I, O> &&
837 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41838 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12839
840 template<input_range R, weakly_incrementable O, class Gen>
841 requires (forward_range<R> || random_access_iterator<O>) &&
842 indirectly_copyable<iterator_t<R>, O> &&
843 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41844 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
Konstantin Varlamov6bdb6422022-08-03 05:33:12845
Konstantin Varlamov14cf74d2022-07-22 16:58:56846 template<random_access_iterator I, sentinel_for<I> S, class Gen>
847 requires permutable<I> &&
848 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41849 I shuffle(I first, S last, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56850
851 template<random_access_range R, class Gen>
852 requires permutable<iterator_t<R>> &&
853 uniform_random_bit_generator<remove_reference_t<Gen>>
Mark de Weverde6827b2023-02-24 20:35:41854 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
Konstantin Varlamov14cf74d2022-07-22 16:58:56855
Nikolas Klauser101d1e92022-07-13 16:07:26856 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser4038c852022-08-04 17:54:13857 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
858 indirect_equivalence_relation<projected<I1, Proj1>,
859 projected<I2, Proj2>> Pred = ranges::equal_to>
860 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
861 Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41862 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13863
864 template<forward_range R1, forward_range R2,
865 class Proj1 = identity, class Proj2 = identity,
866 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
867 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
868 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
Mark de Weverde6827b2023-02-24 20:35:41869 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Nikolas Klauser4038c852022-08-04 17:54:13870
871 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
Nikolas Klauser101d1e92022-07-13 16:07:26872 sentinel_for<I2> S2, class Pred = ranges::equal_to,
873 class Proj1 = identity, class Proj2 = identity>
874 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
875 constexpr subrange<I1>
876 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
877 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
878
879 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
880 class Proj1 = identity, class Proj2 = identity>
881 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
882 constexpr borrowed_subrange_t<R1>
883 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
884 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
885
886 template<forward_iterator I, sentinel_for<I> S, class T,
887 class Pred = ranges::equal_to, class Proj = identity>
888 requires indirectly_comparable<I, const T*, Pred, Proj>
889 constexpr subrange<I>
890 ranges::search_n(I first, S last, iter_difference_t<I> count,
891 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
892
893 template<forward_range R, class T, class Pred = ranges::equal_to,
894 class Proj = identity>
895 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
896 constexpr borrowed_subrange_t<R>
897 ranges::search_n(R&& r, range_difference_t<R> count,
898 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
899
Christopher Di Bella39034382023-12-20 05:57:50900 template<input_iterator I, sentinel_for<I> S, class T,
901 indirectly-binary-left-foldable<T, I> F>
902 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
903
904 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
905 constexpr auto fold_left(R&& r, T init, F f); // since C++23
906
907 template<class I, class T>
908 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
909
910 template<input_iterator I, sentinel_for<I> S, class T,
911 indirectly-binary-left-foldable<T, I> F>
912 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
913
914 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
915 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
916
Nikolas Klauser101d1e92022-07-13 16:07:26917 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
918 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
919 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
920 constexpr subrange<I1>
921 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
922 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
923
924 template<forward_range R1, forward_range R2,
925 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
926 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
927 constexpr borrowed_subrange_t<R1>
928 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
929 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
930
Hui Xiea5c06382022-07-11 22:39:59931 template<class I1, class I2, class O>
932 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
933
934 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
935 weakly_incrementable O, class Comp = ranges::less,
936 class Proj1 = identity, class Proj2 = identity>
937 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
938 constexpr set_symmetric_difference_result<I1, I2, O>
939 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
940 Comp comp = {}, Proj1 proj1 = {},
941 Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16942
Hui Xiea5c06382022-07-11 22:39:59943 template<input_range R1, input_range R2, weakly_incrementable O,
944 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
945 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
946 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
947 borrowed_iterator_t<R2>, O>
948 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
949 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie0f6364b82022-07-14 19:35:15950
951 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
952 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
953 constexpr subrange<I>
954 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16955
Hui Xie0f6364b82022-07-14 19:35:15956 template<forward_range R, class T, class Proj = identity,
957 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
958 ranges::less>
959 constexpr borrowed_subrange_t<R>
960 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16961
Hui Xie3151b952022-07-13 16:20:22962 template<class I1, class I2, class O>
963 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
964
965 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
966 weakly_incrementable O, class Comp = ranges::less,
967 class Proj1 = identity, class Proj2 = identity>
968 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
969 constexpr set_union_result<I1, I2, O>
970 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
971 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
972
973 template<input_range R1, input_range R2, weakly_incrementable O,
974 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
975 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
976 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
977 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
978 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xiec5599642022-07-19 19:54:35979
980 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
981 class Proj1 = identity, class Proj2 = identity,
982 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
983 ranges::less>
984 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41985 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16986
Hui Xiec5599642022-07-19 19:54:35987 template<input_range R1, input_range R2, class Proj1 = identity,
988 class Proj2 = identity,
989 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
990 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
991 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:41992 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16993
994 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
995 class Proj = identity>
996 requires sortable<I, Comp, Proj>
Mark de Weverde6827b2023-02-24 20:35:41997 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
Hui Xie8a617492022-07-27 12:20:16998
999 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1000 requires sortable<iterator_t<R>, Comp, Proj>
1001 borrowed_iterator_t<R>
1002 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
Mark de Weverde6827b2023-02-24 20:35:411003 Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251004
1005 template<permutable I, sentinel_for<I> S, class Proj = identity,
1006 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
Mark de Weverde6827b2023-02-24 20:35:411007 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251008
1009 template<forward_range R, class Proj = identity,
1010 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1011 requires permutable<iterator_t<R>>
1012 constexpr borrowed_subrange_t<R>
Mark de Weverde6827b2023-02-24 20:35:411013 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251014
1015 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1016 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1017 requires indirectly_copyable<I, O> &&
1018 (forward_iterator<I> ||
1019 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1020 indirectly_copyable_storable<I, O>)
1021 constexpr unique_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411022 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
Hui Xie72f57e32022-07-23 00:44:251023
1024 template<input_range R, weakly_incrementable O, class Proj = identity,
1025 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1026 requires indirectly_copyable<iterator_t<R>, O> &&
1027 (forward_iterator<iterator_t<R>> ||
1028 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1029 indirectly_copyable_storable<iterator_t<R>, O>)
1030 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411031 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591032
1033 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411034 using remove_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591035
1036 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1037 class Proj = identity>
1038 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1039 constexpr remove_copy_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411040 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591041
1042 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1043 requires indirectly_copyable<iterator_t<R>, O> &&
1044 indirect_binary_predicate<ranges::equal_to,
1045 projected<iterator_t<R>, Proj>, const T*>
1046 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411047 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591048
1049 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411050 using remove_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591051
1052 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1053 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1054 requires indirectly_copyable<I, O>
1055 constexpr remove_copy_if_result<I, O>
Mark de Weverde6827b2023-02-24 20:35:411056 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591057
1058 template<input_range R, weakly_incrementable O, class Proj = identity,
1059 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1060 requires indirectly_copyable<iterator_t<R>, O>
1061 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
Mark de Weverde6827b2023-02-24 20:35:411062 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
Nikolas Klauser760d2b42022-08-03 05:13:591063
Nikolas Klauser93172c12022-08-03 05:25:001064 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411065 using replace_copy_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001066
1067 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1068 output_iterator<const T2&> O, class Proj = identity>
1069 requires indirectly_copyable<I, O> &&
1070 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1071 constexpr replace_copy_result<I, O>
1072 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411073 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001074
1075 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1076 class Proj = identity>
1077 requires indirectly_copyable<iterator_t<R>, O> &&
1078 indirect_binary_predicate<ranges::equal_to,
1079 projected<iterator_t<R>, Proj>, const T1*>
1080 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1081 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
Mark de Weverde6827b2023-02-24 20:35:411082 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001083
1084 template<class I, class O>
Mark de Weverde6827b2023-02-24 20:35:411085 using replace_copy_if_result = in_out_result<I, O>; // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001086
1087 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1088 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1089 requires indirectly_copyable<I, O>
1090 constexpr replace_copy_if_result<I, O>
1091 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411092 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001093
1094 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1095 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1096 requires indirectly_copyable<iterator_t<R>, O>
1097 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1098 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
Mark de Weverde6827b2023-02-24 20:35:411099 Proj proj = {}); // since C++20
Nikolas Klauser93172c12022-08-03 05:25:001100
Nikolas Klauser68264b62022-08-03 05:40:131101 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411102 using prev_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131103
1104 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1105 class Proj = identity>
1106 requires sortable<I, Comp, Proj>
1107 constexpr ranges::prev_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411108 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131109
1110 template<bidirectional_range R, class Comp = ranges::less,
1111 class Proj = identity>
1112 requires sortable<iterator_t<R>, Comp, Proj>
1113 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411114 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131115
1116 template<class I>
Mark de Weverde6827b2023-02-24 20:35:411117 using next_permutation_result = in_found_result<I>; // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131118
1119 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1120 class Proj = identity>
1121 requires sortable<I, Comp, Proj>
1122 constexpr ranges::next_permutation_result<I>
Mark de Weverde6827b2023-02-24 20:35:411123 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131124
1125 template<bidirectional_range R, class Comp = ranges::less,
1126 class Proj = identity>
1127 requires sortable<iterator_t<R>, Comp, Proj>
1128 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
Mark de Weverde6827b2023-02-24 20:35:411129 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
Nikolas Klauser68264b62022-08-03 05:40:131130
Nikolas Klauserd3729bb2022-01-14 01:55:511131}
1132
Nikolas Klauser68264b62022-08-03 05:40:131133template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361134 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161135 all_of(InputIterator first, InputIterator last, Predicate pred);
1136
1137template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361138 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161139 any_of(InputIterator first, InputIterator last, Predicate pred);
1140
1141template <class InputIterator, class Predicate>
Marshall Clow706ffef2018-01-15 17:20:361142 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161143 none_of(InputIterator first, InputIterator last, Predicate pred);
1144
1145template <class InputIterator, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331146 constexpr Function // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161147 for_each(InputIterator first, InputIterator last, Function f);
1148
Marshall Clowd5c65ff2017-05-25 02:29:541149template<class InputIterator, class Size, class Function>
Marshall Clow1b9a4ff2018-01-22 20:44:331150 constexpr InputIterator // constexpr in C++20
1151 for_each_n(InputIterator first, Size n, Function f); // C++17
Marshall Clowd5c65ff2017-05-25 02:29:541152
Howard Hinnant3e519522010-05-11 19:42:161153template <class InputIterator, class T>
Marshall Clow86944282018-01-15 19:26:051154 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161155 find(InputIterator first, InputIterator last, const T& value);
1156
1157template <class InputIterator, class Predicate>
Marshall Clow86944282018-01-15 19:26:051158 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161159 find_if(InputIterator first, InputIterator last, Predicate pred);
1160
1161template<class InputIterator, class Predicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181162 constexpr InputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161163 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1164
1165template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181166 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161167 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1168 ForwardIterator2 first2, ForwardIterator2 last2);
1169
1170template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181171 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161172 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1173 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1174
1175template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow86944282018-01-15 19:26:051176 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161177 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1178 ForwardIterator2 first2, ForwardIterator2 last2);
1179
1180template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051181 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161182 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1183 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1184
1185template <class ForwardIterator>
Marshall Clow86944282018-01-15 19:26:051186 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161187 adjacent_find(ForwardIterator first, ForwardIterator last);
1188
1189template <class ForwardIterator, class BinaryPredicate>
Marshall Clow86944282018-01-15 19:26:051190 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161191 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1192
1193template <class InputIterator, class T>
Marshall Clow056f15e2018-01-15 19:40:341194 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161195 count(InputIterator first, InputIterator last, const T& value);
1196
1197template <class InputIterator, class Predicate>
Marshall Clow056f15e2018-01-15 19:40:341198 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161199 count_if(InputIterator first, InputIterator last, Predicate pred);
1200
1201template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101202 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161203 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1204
Marshall Clow0b0bbd22013-05-09 21:14:231205template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101206 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381207 mismatch(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231208 InputIterator2 first2, InputIterator2 last2); // **C++14**
1209
Howard Hinnant3e519522010-05-11 19:42:161210template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101211 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161212 mismatch(InputIterator1 first1, InputIterator1 last1,
1213 InputIterator2 first2, BinaryPredicate pred);
1214
Marshall Clow0b0bbd22013-05-09 21:14:231215template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101216 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231217 mismatch(InputIterator1 first1, InputIterator1 last1,
1218 InputIterator2 first2, InputIterator2 last2,
1219 BinaryPredicate pred); // **C++14**
1220
Howard Hinnant3e519522010-05-11 19:42:161221template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101222 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161223 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1224
Marshall Clow0b0bbd22013-05-09 21:14:231225template <class InputIterator1, class InputIterator2>
Marshall Clow6538e28d2018-01-16 02:04:101226 constexpr bool // constexpr in C++20
Aditya Kumar331fb802016-08-25 11:52:381227 equal(InputIterator1 first1, InputIterator1 last1,
Marshall Clow0b0bbd22013-05-09 21:14:231228 InputIterator2 first2, InputIterator2 last2); // **C++14**
1229
Howard Hinnant3e519522010-05-11 19:42:161230template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101231 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161232 equal(InputIterator1 first1, InputIterator1 last1,
1233 InputIterator2 first2, BinaryPredicate pred);
1234
Marshall Clow0b0bbd22013-05-09 21:14:231235template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Marshall Clow6538e28d2018-01-16 02:04:101236 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231237 equal(InputIterator1 first1, InputIterator1 last1,
1238 InputIterator2 first2, InputIterator2 last2,
1239 BinaryPredicate pred); // **C++14**
1240
Howard Hinnant3e519522010-05-11 19:42:161241template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321242 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161243 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1244 ForwardIterator2 first2);
1245
Marshall Clow0b0bbd22013-05-09 21:14:231246template<class ForwardIterator1, class ForwardIterator2>
Marshall Clow49c76432018-01-15 16:16:321247 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231248 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1249 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1250
Howard Hinnant3e519522010-05-11 19:42:161251template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321252 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161253 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1254 ForwardIterator2 first2, BinaryPredicate pred);
1255
Marshall Clow0b0bbd22013-05-09 21:14:231256template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow49c76432018-01-15 16:16:321257 constexpr bool // constexpr in C++20
Marshall Clow0b0bbd22013-05-09 21:14:231258 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1259 ForwardIterator2 first2, ForwardIterator2 last2,
1260 BinaryPredicate pred); // **C++14**
1261
Howard Hinnant3e519522010-05-11 19:42:161262template <class ForwardIterator1, class ForwardIterator2>
Marshall Clow12f0a772018-01-16 15:48:271263 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161264 search(ForwardIterator1 first1, ForwardIterator1 last1,
1265 ForwardIterator2 first2, ForwardIterator2 last2);
1266
1267template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271268 constexpr ForwardIterator1 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161269 search(ForwardIterator1 first1, ForwardIterator1 last1,
1270 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1271
1272template <class ForwardIterator, class Size, class T>
Marshall Clow12f0a772018-01-16 15:48:271273 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161274 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1275
1276template <class ForwardIterator, class Size, class T, class BinaryPredicate>
Marshall Clow12f0a772018-01-16 15:48:271277 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161278 search_n(ForwardIterator first, ForwardIterator last,
1279 Size count, const T& value, BinaryPredicate pred);
1280
1281template <class InputIterator, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411282 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161283 copy(InputIterator first, InputIterator last, OutputIterator result);
1284
1285template<class InputIterator, class OutputIterator, class Predicate>
Louis Dionne13c90a52019-11-06 12:02:411286 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161287 copy_if(InputIterator first, InputIterator last,
1288 OutputIterator result, Predicate pred);
1289
1290template<class InputIterator, class Size, class OutputIterator>
Louis Dionne13c90a52019-11-06 12:02:411291 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161292 copy_n(InputIterator first, Size n, OutputIterator result);
1293
1294template <class BidirectionalIterator1, class BidirectionalIterator2>
Louis Dionne13c90a52019-11-06 12:02:411295 constexpr BidirectionalIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161296 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1297 BidirectionalIterator2 result);
1298
Konstantin Varlamov79a2b4b2022-06-28 18:59:591299// [alg.move], move
1300template<class InputIterator, class OutputIterator>
1301 constexpr OutputIterator move(InputIterator first, InputIterator last,
1302 OutputIterator result);
1303
1304template<class BidirectionalIterator1, class BidirectionalIterator2>
1305 constexpr BidirectionalIterator2
1306 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1307 BidirectionalIterator2 result);
1308
Howard Hinnant3e519522010-05-11 19:42:161309template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181310 constexpr ForwardIterator2 // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161311 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1312
Konstantin Varlamov79a2b4b2022-06-28 18:59:591313namespace ranges {
1314 template<class I1, class I2>
1315 using swap_ranges_result = in_in_result<I1, I2>;
1316
Nikolas Klauser9d905312022-02-10 12:33:031317template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1318 requires indirectly_swappable<I1, I2>
1319 constexpr ranges::swap_ranges_result<I1, I2>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591320 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
Nikolas Klauser9d905312022-02-10 12:33:031321
1322template<input_range R1, input_range R2>
1323 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1324 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
Konstantin Varlamov79a2b4b2022-06-28 18:59:591325 swap_ranges(R1&& r1, R2&& r2);
1326}
Nikolas Klauser9d905312022-02-10 12:33:031327
Howard Hinnant3e519522010-05-11 19:42:161328template <class ForwardIterator1, class ForwardIterator2>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181329 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161330 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1331
1332template <class InputIterator, class OutputIterator, class UnaryOperation>
Marshall Clow99894b62018-01-19 17:45:391333 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161334 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1335
1336template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
Marshall Clow99894b62018-01-19 17:45:391337 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161338 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1339 OutputIterator result, BinaryOperation binary_op);
1340
1341template <class ForwardIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291342 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161343 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1344
1345template <class ForwardIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291346 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161347 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1348
1349template <class InputIterator, class OutputIterator, class T>
Marshall Clow12c74232018-01-19 18:07:291350 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161351 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1352 const T& old_value, const T& new_value);
1353
1354template <class InputIterator, class OutputIterator, class Predicate, class T>
Marshall Clow12c74232018-01-19 18:07:291355 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161356 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1357
1358template <class ForwardIterator, class T>
Marshall Clow4bfb9312018-01-20 20:14:321359 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161360 fill(ForwardIterator first, ForwardIterator last, const T& value);
1361
1362template <class OutputIterator, class Size, class T>
Marshall Clow4bfb9312018-01-20 20:14:321363 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161364 fill_n(OutputIterator first, Size n, const T& value);
1365
1366template <class ForwardIterator, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321367 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161368 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1369
1370template <class OutputIterator, class Size, class Generator>
Marshall Clow4bfb9312018-01-20 20:14:321371 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161372 generate_n(OutputIterator first, Size n, Generator gen);
1373
1374template <class ForwardIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041375 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161376 remove(ForwardIterator first, ForwardIterator last, const T& value);
1377
1378template <class ForwardIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041379 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161380 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1381
1382template <class InputIterator, class OutputIterator, class T>
Marshall Clowe8ea8292018-01-22 21:43:041383 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161384 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1385
1386template <class InputIterator, class OutputIterator, class Predicate>
Marshall Clowe8ea8292018-01-22 21:43:041387 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161388 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1389
1390template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181391 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161392 unique(ForwardIterator first, ForwardIterator last);
1393
1394template <class ForwardIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181395 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161396 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1397
1398template <class InputIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181399 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161400 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1401
1402template <class InputIterator, class OutputIterator, class BinaryPredicate>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181403 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161404 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1405
1406template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081407 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161408 reverse(BidirectionalIterator first, BidirectionalIterator last);
1409
1410template <class BidirectionalIterator, class OutputIterator>
Marshall Clowe8ea8292018-01-22 21:43:041411 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161412 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1413
1414template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181415 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161416 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1417
1418template <class ForwardIterator, class OutputIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181419 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161420 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1421
1422template <class RandomAccessIterator>
1423 void
Marshall Clow0f37a412017-03-23 13:43:371424 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161425
1426template <class RandomAccessIterator, class RandomNumberGenerator>
1427 void
Marshall Clow06965c12014-03-03 06:14:191428 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
Marshall Clow0f37a412017-03-23 13:43:371429 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
Howard Hinnant3e519522010-05-11 19:42:161430
Eric Fiseliere7154702016-08-28 22:14:371431template<class PopulationIterator, class SampleIterator,
1432 class Distance, class UniformRandomBitGenerator>
1433 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1434 SampleIterator out, Distance n,
1435 UniformRandomBitGenerator&& g); // C++17
1436
Howard Hinnantf9d540b2010-05-26 17:49:341437template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1438 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
Howard Hinnantfb340102010-11-18 01:47:021439 UniformRandomNumberGenerator&& g);
Howard Hinnantf9d540b2010-05-26 17:49:341440
Arthur O'Dwyer3fbd3ea2020-12-26 06:39:031441template<class ForwardIterator>
1442 constexpr ForwardIterator
1443 shift_left(ForwardIterator first, ForwardIterator last,
1444 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1445
1446template<class ForwardIterator>
1447 constexpr ForwardIterator
1448 shift_right(ForwardIterator first, ForwardIterator last,
1449 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1450
Howard Hinnant3e519522010-05-11 19:42:161451template <class InputIterator, class Predicate>
Marshall Clow49c76432018-01-15 16:16:321452 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161453 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1454
1455template <class ForwardIterator, class Predicate>
Arthur O'Dwyerf851db32020-12-17 05:01:081456 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161457 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1458
1459template <class InputIterator, class OutputIterator1,
1460 class OutputIterator2, class Predicate>
Marshall Clow1b9a4ff2018-01-22 20:44:331461 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161462 partition_copy(InputIterator first, InputIterator last,
1463 OutputIterator1 out_true, OutputIterator2 out_false,
1464 Predicate pred);
1465
1466template <class ForwardIterator, class Predicate>
1467 ForwardIterator
1468 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1469
1470template<class ForwardIterator, class Predicate>
Marshall Clowd57c03d2018-01-16 02:34:411471 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161472 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1473
1474template <class ForwardIterator>
Marshall Clow49c76432018-01-15 16:16:321475 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161476 is_sorted(ForwardIterator first, ForwardIterator last);
1477
1478template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181479 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161480 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1481
1482template<class ForwardIterator>
Marshall Clow056f15e2018-01-15 19:40:341483 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161484 is_sorted_until(ForwardIterator first, ForwardIterator last);
1485
1486template <class ForwardIterator, class Compare>
Marshall Clow056f15e2018-01-15 19:40:341487 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161488 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1489
1490template <class RandomAccessIterator>
Arthur O'Dwyer493f1402020-12-20 20:21:421491 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161492 sort(RandomAccessIterator first, RandomAccessIterator last);
1493
1494template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer493f1402020-12-20 20:21:421495 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161496 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1497
1498template <class RandomAccessIterator>
1499 void
1500 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1501
1502template <class RandomAccessIterator, class Compare>
1503 void
1504 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1505
1506template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181507 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161508 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1509
1510template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181511 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161512 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1513
1514template <class InputIterator, class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181515 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161516 partial_sort_copy(InputIterator first, InputIterator last,
1517 RandomAccessIterator result_first, RandomAccessIterator result_last);
1518
1519template <class InputIterator, class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181520 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161521 partial_sort_copy(InputIterator first, InputIterator last,
1522 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1523
1524template <class RandomAccessIterator>
Arthur O'Dwyer5d956562021-02-04 23:12:521525 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161526 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1527
1528template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5d956562021-02-04 23:12:521529 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161530 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1531
1532template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411533 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161534 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1535
1536template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411537 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161538 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1539
1540template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411541 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161542 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1543
1544template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411545 constexpr ForwardIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161546 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1547
1548template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411549 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161550 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1551
1552template <class ForwardIterator, class T, class Compare>
Marshall Clowd57c03d2018-01-16 02:34:411553 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161554 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1555
1556template <class ForwardIterator, class T>
Marshall Clowd57c03d2018-01-16 02:34:411557 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161558 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1559
1560template <class ForwardIterator, class T, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401561 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161562 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1563
1564template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121565 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161566 merge(InputIterator1 first1, InputIterator1 last1,
1567 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1568
1569template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121570 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161571 merge(InputIterator1 first1, InputIterator1 last1,
1572 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1573
1574template <class BidirectionalIterator>
1575 void
1576 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1577
1578template <class BidirectionalIterator, class Compare>
1579 void
1580 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1581
1582template <class InputIterator1, class InputIterator2>
Marshall Clow8da1a482018-01-22 23:10:401583 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161584 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1585
1586template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401587 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161588 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1589
1590template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121591 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161592 set_union(InputIterator1 first1, InputIterator1 last1,
1593 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1594
1595template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121596 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161597 set_union(InputIterator1 first1, InputIterator1 last1,
1598 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1599
1600template <class InputIterator1, class InputIterator2, class OutputIterator>
Marshall Clow8da1a482018-01-22 23:10:401601 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161602 set_intersection(InputIterator1 first1, InputIterator1 last1,
1603 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1604
1605template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Marshall Clow8da1a482018-01-22 23:10:401606 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161607 set_intersection(InputIterator1 first1, InputIterator1 last1,
1608 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1609
1610template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121611 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161612 set_difference(InputIterator1 first1, InputIterator1 last1,
1613 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1614
1615template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121616 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161617 set_difference(InputIterator1 first1, InputIterator1 last1,
1618 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1619
1620template <class InputIterator1, class InputIterator2, class OutputIterator>
Arthur O'Dwyer14098cf2020-12-04 18:47:121621 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161622 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1623 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1624
1625template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
Arthur O'Dwyer14098cf2020-12-04 18:47:121626 constexpr OutputIterator // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161627 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1628 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1629
1630template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181631 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161632 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1633
1634template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181635 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161636 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1637
1638template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181639 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161640 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1641
1642template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181643 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161644 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1645
1646template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181647 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161648 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1649
1650template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181651 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161652 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1653
1654template <class RandomAccessIterator>
Arthur O'Dwyer5386aa22020-12-17 05:26:181655 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161656 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1657
1658template <class RandomAccessIterator, class Compare>
Arthur O'Dwyer5386aa22020-12-17 05:26:181659 constexpr void // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161660 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1661
Howard Hinnantb3371f62010-08-22 00:02:431662template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321663 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431664 is_heap(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161665
Howard Hinnantb3371f62010-08-22 00:02:431666template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321667 constexpr bool // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431668 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161669
Howard Hinnantb3371f62010-08-22 00:02:431670template <class RandomAccessIterator>
Marshall Clow49c76432018-01-15 16:16:321671 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431672 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
Howard Hinnant3e519522010-05-11 19:42:161673
Howard Hinnantb3371f62010-08-22 00:02:431674template <class RandomAccessIterator, class Compare>
Marshall Clow49c76432018-01-15 16:16:321675 constexpr RandomAccessIterator // constexpr in C++20
Howard Hinnantb3371f62010-08-22 00:02:431676 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161677
Howard Hinnant4eb27b72010-08-21 20:10:011678template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181679 constexpr ForwardIterator // constexpr in C++14
1680 min_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011681
1682template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181683 constexpr ForwardIterator // constexpr in C++14
1684 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011685
Howard Hinnant3e519522010-05-11 19:42:161686template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181687 constexpr const T& // constexpr in C++14
1688 min(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161689
1690template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181691 constexpr const T& // constexpr in C++14
1692 min(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161693
Howard Hinnant4eb27b72010-08-21 20:10:011694template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181695 constexpr T // constexpr in C++14
1696 min(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011697
1698template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181699 constexpr T // constexpr in C++14
1700 min(initializer_list<T> t, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011701
Marshall Clow146c14a2016-03-07 22:43:491702template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181703 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
Marshall Clow146c14a2016-03-07 22:43:491704
1705template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181706 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
Marshall Clow146c14a2016-03-07 22:43:491707
Howard Hinnant4eb27b72010-08-21 20:10:011708template <class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181709 constexpr ForwardIterator // constexpr in C++14
1710 max_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant4eb27b72010-08-21 20:10:011711
1712template <class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181713 constexpr ForwardIterator // constexpr in C++14
1714 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011715
Howard Hinnant3e519522010-05-11 19:42:161716template <class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181717 constexpr const T& // constexpr in C++14
1718 max(const T& a, const T& b);
Howard Hinnant3e519522010-05-11 19:42:161719
1720template <class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181721 constexpr const T& // constexpr in C++14
1722 max(const T& a, const T& b, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161723
Howard Hinnant4eb27b72010-08-21 20:10:011724template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181725 constexpr T // constexpr in C++14
1726 max(initializer_list<T> t);
Howard Hinnant3e519522010-05-11 19:42:161727
Howard Hinnant4eb27b72010-08-21 20:10:011728template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181729 constexpr T // constexpr in C++14
1730 max(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161731
Howard Hinnant4eb27b72010-08-21 20:10:011732template<class ForwardIterator>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181733 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1734 minmax_element(ForwardIterator first, ForwardIterator last);
Howard Hinnant3e519522010-05-11 19:42:161735
Howard Hinnant4eb27b72010-08-21 20:10:011736template<class ForwardIterator, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181737 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1738 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011739
1740template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181741 constexpr pair<const T&, const T&> // constexpr in C++14
1742 minmax(const T& a, const T& b);
Howard Hinnant4eb27b72010-08-21 20:10:011743
1744template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181745 constexpr pair<const T&, const T&> // constexpr in C++14
1746 minmax(const T& a, const T& b, Compare comp);
Howard Hinnant4eb27b72010-08-21 20:10:011747
1748template<class T>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181749 constexpr pair<T, T> // constexpr in C++14
1750 minmax(initializer_list<T> t);
Howard Hinnant4eb27b72010-08-21 20:10:011751
1752template<class T, class Compare>
Arthur O'Dwyerb8bc4e12020-12-03 01:02:181753 constexpr pair<T, T> // constexpr in C++14
1754 minmax(initializer_list<T> t, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161755
1756template <class InputIterator1, class InputIterator2>
Marshall Clow1b9a4ff2018-01-22 20:44:331757 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161758 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1759
1760template <class InputIterator1, class InputIterator2, class Compare>
Marshall Clow1b9a4ff2018-01-22 20:44:331761 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161762 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1763 InputIterator2 first2, InputIterator2 last2, Compare comp);
1764
Adrian Vogelsgesang2a067572022-08-04 22:21:271765template<class InputIterator1, class InputIterator2, class Cmp>
1766 constexpr auto
1767 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1768 InputIterator2 first2, InputIterator2 last2,
1769 Cmp comp)
1770 -> decltype(comp(*b1, *b2)); // since C++20
1771
1772template<class InputIterator1, class InputIterator2>
1773 constexpr auto
1774 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1775 InputIterator2 first2, InputIterator2 last2); // since C++20
1776
Howard Hinnant3e519522010-05-11 19:42:161777template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081778 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161779 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1780
1781template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081782 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161783 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1784
1785template <class BidirectionalIterator>
Arthur O'Dwyerf851db32020-12-17 05:01:081786 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161787 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1788
1789template <class BidirectionalIterator, class Compare>
Arthur O'Dwyerf851db32020-12-17 05:01:081790 constexpr bool // constexpr in C++20
Howard Hinnant3e519522010-05-11 19:42:161791 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
Howard Hinnant3e519522010-05-11 19:42:161792} // std
1793
1794*/
1795
Louis Dionne385cc252022-03-25 16:55:361796#include <__assert> // all public C++ headers provide the assertion handler
Howard Hinnant3e519522010-05-11 19:42:161797#include <__config>
Marshall Clowf56972e2018-09-12 19:41:401798#include <version>
Howard Hinnant5d1a7012013-08-14 18:00:201799
Louis Dionne134723e2021-06-17 15:30:111800#include <__algorithm/adjacent_find.h>
1801#include <__algorithm/all_of.h>
1802#include <__algorithm/any_of.h>
1803#include <__algorithm/binary_search.h>
1804#include <__algorithm/clamp.h>
1805#include <__algorithm/comp.h>
1806#include <__algorithm/comp_ref_type.h>
1807#include <__algorithm/copy.h>
1808#include <__algorithm/copy_backward.h>
1809#include <__algorithm/copy_if.h>
1810#include <__algorithm/copy_n.h>
1811#include <__algorithm/count.h>
1812#include <__algorithm/count_if.h>
1813#include <__algorithm/equal.h>
1814#include <__algorithm/equal_range.h>
Louis Dionne134723e2021-06-17 15:30:111815#include <__algorithm/fill.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051816#include <__algorithm/fill_n.h>
Louis Dionne134723e2021-06-17 15:30:111817#include <__algorithm/find.h>
1818#include <__algorithm/find_end.h>
1819#include <__algorithm/find_first_of.h>
1820#include <__algorithm/find_if.h>
1821#include <__algorithm/find_if_not.h>
Christopher Di Bella39034382023-12-20 05:57:501822#include <__algorithm/fold.h>
Louis Dionne134723e2021-06-17 15:30:111823#include <__algorithm/for_each.h>
1824#include <__algorithm/for_each_n.h>
Louis Dionne134723e2021-06-17 15:30:111825#include <__algorithm/generate.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:051826#include <__algorithm/generate_n.h>
Louis Dionne134723e2021-06-17 15:30:111827#include <__algorithm/half_positive.h>
Nikolas Klauser68f41312022-02-21 22:07:021828#include <__algorithm/in_found_result.h>
Nikolas Klauser1e77b392022-02-11 16:01:581829#include <__algorithm/in_fun_result.h>
Nikolas Klauserf3514af2022-01-25 10:21:471830#include <__algorithm/in_in_out_result.h>
Nikolas Klauserd3729bb2022-01-14 01:55:511831#include <__algorithm/in_in_result.h>
Nikolas Klauser610979b2022-02-03 01:17:031832#include <__algorithm/in_out_out_result.h>
Konstantin Varlamov8d23b742022-01-11 06:49:371833#include <__algorithm/in_out_result.h>
Louis Dionne134723e2021-06-17 15:30:111834#include <__algorithm/includes.h>
1835#include <__algorithm/inplace_merge.h>
1836#include <__algorithm/is_heap.h>
1837#include <__algorithm/is_heap_until.h>
1838#include <__algorithm/is_partitioned.h>
1839#include <__algorithm/is_permutation.h>
1840#include <__algorithm/is_sorted.h>
1841#include <__algorithm/is_sorted_until.h>
Christopher Di Bella6adbc832021-06-05 02:47:471842#include <__algorithm/iter_swap.h>
Louis Dionne134723e2021-06-17 15:30:111843#include <__algorithm/lexicographical_compare.h>
Adrian Vogelsgesang2a067572022-08-04 22:21:271844#include <__algorithm/lexicographical_compare_three_way.h>
Louis Dionne134723e2021-06-17 15:30:111845#include <__algorithm/lower_bound.h>
1846#include <__algorithm/make_heap.h>
1847#include <__algorithm/max.h>
1848#include <__algorithm/max_element.h>
1849#include <__algorithm/merge.h>
1850#include <__algorithm/min.h>
1851#include <__algorithm/min_element.h>
Nikolas Klauser807766b2022-02-21 21:48:361852#include <__algorithm/min_max_result.h>
Louis Dionne134723e2021-06-17 15:30:111853#include <__algorithm/minmax.h>
1854#include <__algorithm/minmax_element.h>
1855#include <__algorithm/mismatch.h>
1856#include <__algorithm/move.h>
1857#include <__algorithm/move_backward.h>
1858#include <__algorithm/next_permutation.h>
1859#include <__algorithm/none_of.h>
1860#include <__algorithm/nth_element.h>
1861#include <__algorithm/partial_sort.h>
1862#include <__algorithm/partial_sort_copy.h>
1863#include <__algorithm/partition.h>
1864#include <__algorithm/partition_copy.h>
1865#include <__algorithm/partition_point.h>
1866#include <__algorithm/pop_heap.h>
1867#include <__algorithm/prev_permutation.h>
Nikolas Klausere7e37112023-05-05 15:41:131868#include <__algorithm/pstl_any_all_none_of.h>
Nikolas Klauser7ace54e2023-05-15 17:38:011869#include <__algorithm/pstl_copy.h>
Nikolas Klauser7a3b5282023-06-06 15:42:401870#include <__algorithm/pstl_count.h>
Nikolas Klausered27a4e2023-11-28 21:02:181871#include <__algorithm/pstl_equal.h>
Nikolas Klausere7e37112023-05-05 15:41:131872#include <__algorithm/pstl_fill.h>
1873#include <__algorithm/pstl_find.h>
1874#include <__algorithm/pstl_for_each.h>
Nikolas Klausercd916102023-06-09 20:45:341875#include <__algorithm/pstl_generate.h>
Nikolas Klauser3a7876f2023-06-13 17:50:381876#include <__algorithm/pstl_is_partitioned.h>
Nikolas Klauserbf63b152023-05-30 16:27:101877#include <__algorithm/pstl_merge.h>
Nikolas Klauserd2a46e62023-10-22 08:23:221878#include <__algorithm/pstl_move.h>
Nikolas Klauser51131ed2023-06-06 15:43:221879#include <__algorithm/pstl_replace.h>
Nikolas Klauser5d7f3462023-10-23 10:35:121880#include <__algorithm/pstl_rotate_copy.h>
Nikolas Klauser37e5baf2023-07-20 21:45:191881#include <__algorithm/pstl_sort.h>
Nikolas Klauserd51a84b2023-06-01 22:05:111882#include <__algorithm/pstl_stable_sort.h>
Nikolas Klauser6851d072023-05-15 14:07:451883#include <__algorithm/pstl_transform.h>
Louis Dionne134723e2021-06-17 15:30:111884#include <__algorithm/push_heap.h>
Nikolas Klauser916e9052022-06-08 10:14:121885#include <__algorithm/ranges_adjacent_find.h>
Nikolas Klauser0e3dc1a2022-05-26 14:42:461886#include <__algorithm/ranges_all_of.h>
1887#include <__algorithm/ranges_any_of.h>
Nikolas Klauser81715862022-06-05 19:15:161888#include <__algorithm/ranges_binary_search.h>
Nikolas Klausera203acb2022-08-03 23:30:501889#include <__algorithm/ranges_clamp.h>
ZijunZhaoCCKfdd089b2023-12-20 00:34:191890#include <__algorithm/ranges_contains.h>
ZijunZhaoCCKa6b846a2024-02-13 23:42:371891#include <__algorithm/ranges_contains_subrange.h>
Nikolas Klauser1d837502022-04-15 11:43:401892#include <__algorithm/ranges_copy.h>
1893#include <__algorithm/ranges_copy_backward.h>
1894#include <__algorithm/ranges_copy_if.h>
1895#include <__algorithm/ranges_copy_n.h>
Nikolas Klauser1306b102022-04-07 11:02:021896#include <__algorithm/ranges_count.h>
1897#include <__algorithm/ranges_count_if.h>
Zijun Zhao0218ea42023-09-18 18:28:111898#include <__algorithm/ranges_ends_with.h>
Nikolas Klauser569d6632022-05-25 09:09:431899#include <__algorithm/ranges_equal.h>
Hui Xie0f6364b82022-07-14 19:35:151900#include <__algorithm/ranges_equal_range.h>
Nikolas Klauser7af89a32022-05-21 16:26:291901#include <__algorithm/ranges_fill.h>
1902#include <__algorithm/ranges_fill_n.h>
Nikolas Klauseree0f8c42022-03-12 00:45:351903#include <__algorithm/ranges_find.h>
Nikolas Klauser101d1e92022-07-13 16:07:261904#include <__algorithm/ranges_find_end.h>
Nikolas Klauserb79b2b62022-06-06 11:57:341905#include <__algorithm/ranges_find_first_of.h>
Nikolas Klauseree0f8c42022-03-12 00:45:351906#include <__algorithm/ranges_find_if.h>
1907#include <__algorithm/ranges_find_if_not.h>
Nikolas Klauser80045e92022-05-04 18:27:071908#include <__algorithm/ranges_for_each.h>
1909#include <__algorithm/ranges_for_each_n.h>
Konstantin Varlamovead73022022-07-26 22:50:141910#include <__algorithm/ranges_generate.h>
1911#include <__algorithm/ranges_generate_n.h>
Hui Xiec5599642022-07-19 19:54:351912#include <__algorithm/ranges_includes.h>
Hui Xie8a617492022-07-27 12:20:161913#include <__algorithm/ranges_inplace_merge.h>
Konstantin Varlamovd406c642022-07-26 23:11:091914#include <__algorithm/ranges_is_heap.h>
1915#include <__algorithm/ranges_is_heap_until.h>
Nikolas Klauser37ba1b92022-05-04 12:19:091916#include <__algorithm/ranges_is_partitioned.h>
Nikolas Klauser4038c852022-08-04 17:54:131917#include <__algorithm/ranges_is_permutation.h>
Nikolas Klauser11e3ad22022-05-26 14:08:551918#include <__algorithm/ranges_is_sorted.h>
1919#include <__algorithm/ranges_is_sorted_until.h>
Nikolas Klauserafd5a4f2022-06-15 14:24:431920#include <__algorithm/ranges_lexicographical_compare.h>
Nikolas Klauser81715862022-06-05 19:15:161921#include <__algorithm/ranges_lower_bound.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271922#include <__algorithm/ranges_make_heap.h>
Nikolas Klausere476df52022-04-03 07:17:011923#include <__algorithm/ranges_max.h>
Nikolas Klauser205557c2022-03-07 16:01:521924#include <__algorithm/ranges_max_element.h>
Hui Xie25607d12022-06-26 15:13:431925#include <__algorithm/ranges_merge.h>
Nikolas Klauserf83d8332022-03-18 01:57:081926#include <__algorithm/ranges_min.h>
Nikolas Klauser3b470d12022-02-11 12:11:571927#include <__algorithm/ranges_min_element.h>
Nikolas Klauser58d9ab72022-04-13 20:59:091928#include <__algorithm/ranges_minmax.h>
1929#include <__algorithm/ranges_minmax_element.h>
Nikolas Klauserc2cd15a2022-03-08 22:12:351930#include <__algorithm/ranges_mismatch.h>
Nikolas Klauser2c3bbac2022-06-23 10:23:411931#include <__algorithm/ranges_move.h>
1932#include <__algorithm/ranges_move_backward.h>
Nikolas Klauser68264b62022-08-03 05:40:131933#include <__algorithm/ranges_next_permutation.h>
Nikolas Klauser0e3dc1a2022-05-26 14:42:461934#include <__algorithm/ranges_none_of.h>
Konstantin Varlamov23c73282022-07-08 03:35:511935#include <__algorithm/ranges_nth_element.h>
varconst5dd19ad2022-07-20 03:10:021936#include <__algorithm/ranges_partial_sort.h>
Konstantin Varlamovdb7d7952022-07-30 09:42:051937#include <__algorithm/ranges_partial_sort_copy.h>
Konstantin Varlamov8ed702b2022-07-19 04:05:511938#include <__algorithm/ranges_partition.h>
Konstantin Varlamov065202f2022-07-20 08:57:131939#include <__algorithm/ranges_partition_copy.h>
1940#include <__algorithm/ranges_partition_point.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271941#include <__algorithm/ranges_pop_heap.h>
Nikolas Klauser68264b62022-08-03 05:40:131942#include <__algorithm/ranges_prev_permutation.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271943#include <__algorithm/ranges_push_heap.h>
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:001944#include <__algorithm/ranges_remove.h>
Nikolas Klauser760d2b42022-08-03 05:13:591945#include <__algorithm/ranges_remove_copy.h>
1946#include <__algorithm/ranges_remove_copy_if.h>
Nikolas Klauserf8cbe3cdf2022-07-06 12:03:001947#include <__algorithm/ranges_remove_if.h>
Nikolas Klauserff6d5de2022-06-07 07:42:101948#include <__algorithm/ranges_replace.h>
Nikolas Klauser93172c12022-08-03 05:25:001949#include <__algorithm/ranges_replace_copy.h>
1950#include <__algorithm/ranges_replace_copy_if.h>
Nikolas Klauserff6d5de2022-06-07 07:42:101951#include <__algorithm/ranges_replace_if.h>
Nikolas Klauser1d1a1912022-05-24 08:32:501952#include <__algorithm/ranges_reverse.h>
Nikolas Klauser7d426a32022-07-11 15:07:351953#include <__algorithm/ranges_reverse_copy.h>
Konstantin Varlamov36c746c2022-08-03 23:04:141954#include <__algorithm/ranges_rotate.h>
Nikolas Klauser7d426a32022-07-11 15:07:351955#include <__algorithm/ranges_rotate_copy.h>
Konstantin Varlamov6bdb6422022-08-03 05:33:121956#include <__algorithm/ranges_sample.h>
Nikolas Klauser101d1e92022-07-13 16:07:261957#include <__algorithm/ranges_search.h>
1958#include <__algorithm/ranges_search_n.h>
Hui Xie1cdec6c2022-06-26 15:13:431959#include <__algorithm/ranges_set_difference.h>
Hui Xie96b674f2022-07-08 14:21:401960#include <__algorithm/ranges_set_intersection.h>
Hui Xiea5c06382022-07-11 22:39:591961#include <__algorithm/ranges_set_symmetric_difference.h>
Hui Xie3151b952022-07-13 16:20:221962#include <__algorithm/ranges_set_union.h>
Konstantin Varlamov14cf74d2022-07-22 16:58:561963#include <__algorithm/ranges_shuffle.h>
Konstantin Varlamovff3989e2022-06-16 22:20:531964#include <__algorithm/ranges_sort.h>
Konstantin Varlamovc945bd02022-07-08 20:46:271965#include <__algorithm/ranges_sort_heap.h>
Konstantin Varlamov8ed702b2022-07-19 04:05:511966#include <__algorithm/ranges_stable_partition.h>
Konstantin Varlamov94c7b892022-07-01 23:34:081967#include <__algorithm/ranges_stable_sort.h>
zijunzhao20517552023-05-08 22:04:001968#include <__algorithm/ranges_starts_with.h>
Nikolas Klauser9d905312022-02-10 12:33:031969#include <__algorithm/ranges_swap_ranges.h>
Nikolas Klauser3ba85482022-04-05 09:05:361970#include <__algorithm/ranges_transform.h>
Hui Xie72f57e32022-07-23 00:44:251971#include <__algorithm/ranges_unique.h>
1972#include <__algorithm/ranges_unique_copy.h>
Nikolas Klauser81715862022-06-05 19:15:161973#include <__algorithm/ranges_upper_bound.h>
Louis Dionne134723e2021-06-17 15:30:111974#include <__algorithm/remove.h>
1975#include <__algorithm/remove_copy.h>
1976#include <__algorithm/remove_copy_if.h>
1977#include <__algorithm/remove_if.h>
1978#include <__algorithm/replace.h>
1979#include <__algorithm/replace_copy.h>
1980#include <__algorithm/replace_copy_if.h>
1981#include <__algorithm/replace_if.h>
1982#include <__algorithm/reverse.h>
1983#include <__algorithm/reverse_copy.h>
1984#include <__algorithm/rotate.h>
1985#include <__algorithm/rotate_copy.h>
1986#include <__algorithm/sample.h>
1987#include <__algorithm/search.h>
1988#include <__algorithm/search_n.h>
1989#include <__algorithm/set_difference.h>
1990#include <__algorithm/set_intersection.h>
1991#include <__algorithm/set_symmetric_difference.h>
1992#include <__algorithm/set_union.h>
1993#include <__algorithm/shift_left.h>
1994#include <__algorithm/shift_right.h>
1995#include <__algorithm/shuffle.h>
1996#include <__algorithm/sift_down.h>
1997#include <__algorithm/sort.h>
1998#include <__algorithm/sort_heap.h>
1999#include <__algorithm/stable_partition.h>
2000#include <__algorithm/stable_sort.h>
Christopher Di Bella6adbc832021-06-05 02:47:472001#include <__algorithm/swap_ranges.h>
Louis Dionne134723e2021-06-17 15:30:112002#include <__algorithm/transform.h>
Louis Dionne134723e2021-06-17 15:30:112003#include <__algorithm/unique.h>
Arthur O'Dwyer4d81a462022-01-07 14:45:052004#include <__algorithm/unique_copy.h>
Louis Dionne134723e2021-06-17 15:30:112005#include <__algorithm/unwrap_iter.h>
2006#include <__algorithm/upper_bound.h>
Eric Fiselierc1bd9192014-08-10 23:53:082007
Nikolas Klauserdb1978b2022-06-16 20:43:462008// standard-mandated includes
Nikolas Klauser473a1602022-09-22 16:05:082009
2010// [algorithm.syn]
Nikolas Klauserdb1978b2022-06-16 20:43:462011#include <initializer_list>
2012
Howard Hinnant073458b2011-10-17 20:05:102013#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyerfa6b9e42022-02-02 01:16:402014# pragma GCC system_header
Howard Hinnant073458b2011-10-17 20:05:102015#endif
Howard Hinnant3e519522010-05-11 19:42:162016
Mark de Wevere31c2a12022-09-02 15:53:282017#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Nikolas Klauserd5e26772022-09-04 22:01:152018# include <atomic>
Nikolas Klauser40a20ae2023-01-08 14:26:322019# include <bit>
Nikolas Klauser89b356f2022-11-02 19:27:422020# include <concepts>
Nikolas Klauser75196f82023-01-08 15:47:532021# include <cstdlib>
varconst5629d492023-01-14 00:56:582022# include <cstring>
Mark de Wevere31c2a12022-09-02 15:53:282023# include <iterator>
Nikolas Klauserd5e26772022-09-04 22:01:152024# include <memory>
2025# include <stdexcept>
Nikolas Klausere698c592022-12-26 15:24:012026# include <type_traits>
Mark de Wevere31c2a12022-09-02 15:53:282027# include <utility>
2028#endif
2029
Louis Dionne4cd6ca12021-04-20 16:03:322030#endif // _LIBCPP_ALGORITHM