2 //===----------------------------------------------------------------------===//
4 // 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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_ALGORITHM
11 #define _LIBCPP_ALGORITHM
16 #include <initializer_list>
23 // [algorithms.results], algorithm result types
24 template <class I, class F>
25 struct in_fun_result; // since C++20
27 template <class I1, class I2>
28 struct in_in_result; // since C++20
30 template <class I, class O>
31 struct in_out_result; // since C++20
33 template <class I1, class I2, class O>
34 struct in_in_out_result; // since C++20
36 template <class I, class O1, class O2>
37 struct in_out_out_result; // since C++20
39 template <class I1, class I2>
40 struct min_max_result; // since C++20
43 struct in_found_result; // since C++20
45 template <class I, class T>
46 struct in_value_result; // since C++23
48 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
49 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
50 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
52 template<forward_range R, class Proj = identity,
53 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
54 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
56 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
57 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
58 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
60 template<forward_range R, class Proj = identity,
61 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
62 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
64 template<class I1, class I2>
65 using mismatch_result = in_in_result<I1, I2>;
67 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>
70 constexpr mismatch_result<_I1, _I2> // since C++20
71 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})
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>>
77 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
79 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
80 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
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>
85 find(R&& r, const T& value, Proj proj = {}); // since C++20
87 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
88 indirect_unary_predicate<projected<I, Proj>> Pred>
89 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
91 template<input_range R, class Proj = identity,
92 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
93 constexpr borrowed_iterator_t<R>
94 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
96 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
97 indirect_unary_predicate<projected<I, Proj>> Pred>
98 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
100 template<input_range R, class Proj = identity,
101 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
102 constexpr borrowed_iterator_t<R>
103 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
105 template<class T, class Proj = identity,
106 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
107 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
109 template<copyable T, class Proj = identity,
110 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
111 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
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>
117 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
119 template<class T, class Proj = identity,
120 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
121 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
123 template<copyable T, class Proj = identity,
124 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
125 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
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>
131 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
133 template<class I, class O>
134 using unary_transform_result = in_out_result<I, O>; // since C++20
136 template<class I1, class I2, class O>
137 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
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>
143 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
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>
149 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
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,
158 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
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,
166 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
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>
171 count(I first, S last, const T& value, Proj proj = {}); // since C++20
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>
176 count(R&& r, const T& value, Proj proj = {}); // since C++20
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>
181 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
183 template<input_range R, class Proj = identity,
184 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
185 constexpr range_difference_t<R>
186 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
189 using minmax_result = min_max_result<T>;
191 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&>
194 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
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>
199 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
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>>
205 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
208 using minmax_element_result = min_max_result<I>;
210 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>
213 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
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>>
218 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
220 template<class I, class O>
221 using copy_result = in_out_result<I, O>; // since C++20
223 template<class I, class O>
224 using copy_n_result = in_out_result<I, O>; // since C++20
226 template<class I, class O>
227 using copy_if_result = in_out_result<I, O>; // since C++20
229 template<class I1, class I2>
230 using copy_backward_result = in_out_result<I1, I2>; // since C++20
232 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
233 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
234 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
236 template<input_range R, class T, class Proj = identity>
237 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
238 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
240 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
241 requires indirectly_copyable<I, O>
242 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
244 template<input_range R, weakly_incrementable O>
245 requires indirectly_copyable<iterator_t<R>, O>
246 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
248 template<input_iterator I, weakly_incrementable O>
249 requires indirectly_copyable<I, O>
250 constexpr ranges::copy_n_result<I, O>
251 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
253 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
254 indirect_unary_predicate<projected<I, Proj>> Pred>
255 requires indirectly_copyable<I, O>
256 constexpr ranges::copy_if_result<I, O>
257 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
259 template<input_range R, weakly_incrementable O, class Proj = identity,
260 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
261 requires indirectly_copyable<iterator_t<R>, O>
262 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
263 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
265 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
266 requires indirectly_copyable<I1, I2>
267 constexpr ranges::copy_backward_result<I1, I2>
268 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
270 template<bidirectional_range R, bidirectional_iterator I>
271 requires indirectly_copyable<iterator_t<R>, I>
272 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
273 ranges::copy_backward(R&& r, I result); // since C++20
275 template<class I, class F>
276 using for_each_result = in_fun_result<I, F>; // since C++20
278 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
279 indirectly_unary_invocable<projected<I, Proj>> Fun>
280 constexpr ranges::for_each_result<I, Fun>
281 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
283 template<input_range R, class Proj = identity,
284 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
285 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
286 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
288 template<input_iterator I, class Proj = identity,
289 indirectly_unary_invocable<projected<I, Proj>> Fun>
290 constexpr ranges::for_each_n_result<I, Fun>
291 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
293 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
294 indirect_unary_predicate<projected<I, Proj>> Pred>
295 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
297 template<input_range R, class Proj = identity,
298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
301 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
302 class Proj = identity>
303 requires sortable<I, Comp, Proj>
305 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
307 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
308 requires sortable<iterator_t<R>, Comp, Proj>
309 constexpr borrowed_iterator_t<R>
310 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
312 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
313 class Proj = identity>
314 requires sortable<I, Comp, Proj>
316 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
318 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
319 requires sortable<iterator_t<R>, Comp, Proj>
320 constexpr borrowed_iterator_t<R>
321 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
323 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
324 class Proj = identity>
325 requires sortable<I, Comp, Proj>
327 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
329 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
330 requires sortable<iterator_t<R>, Comp, Proj>
331 constexpr borrowed_iterator_t<R>
332 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
334 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
335 class Proj = identity>
336 requires sortable<I, Comp, Proj>
338 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
340 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
341 requires sortable<iterator_t<R>, Comp, Proj>
342 constexpr borrowed_iterator_t<R>
343 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
345 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
346 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
347 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
349 template<random_access_range R, class Proj = identity,
350 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
351 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
353 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
354 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
355 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
357 template<random_access_range R, class Proj = identity,
358 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
359 constexpr borrowed_iterator_t<R>
360 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
362 template<bidirectional_iterator I, sentinel_for<I> S>
363 requires permutable<I>
364 constexpr I ranges::reverse(I first, S last); // since C++20
366 template<bidirectional_range R>
367 requires permutable<iterator_t<R>>
368 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
370 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
371 class Proj = identity>
372 requires sortable<I, Comp, Proj>
374 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
376 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
377 requires sortable<iterator_t<R>, Comp, Proj>
378 constexpr borrowed_iterator_t<R>
379 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
381 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
382 class Proj = identity>
383 requires sortable<I, Comp, Proj>
384 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
386 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
387 requires sortable<iterator_t<R>, Comp, Proj>
388 borrowed_iterator_t<R>
389 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
391 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
392 class Proj = identity>
393 requires sortable<I, Comp, Proj>
395 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
397 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
398 requires sortable<iterator_t<R>, Comp, Proj>
399 constexpr borrowed_iterator_t<R>
400 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
402 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
403 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
405 template<class T, output_range<const T&> R>
406 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
408 template<class T, output_iterator<const T&> O>
409 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
411 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
412 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
413 constexpr O generate(O first, S last, F gen); // since C++20
415 template<class ExecutionPolicy, class ForwardIterator, class Generator>
416 void generate(ExecutionPolicy&& exec,
417 ForwardIterator first, ForwardIterator last,
418 Generator gen); // since C++17
420 template<class R, copy_constructible F>
421 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
422 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
424 template<input_or_output_iterator O, copy_constructible F>
425 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
426 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
428 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
429 ForwardIterator generate_n(ExecutionPolicy&& exec,
430 ForwardIterator first, Size n, Generator gen); // since C++17
432 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
433 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
434 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
435 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
437 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
439 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
440 class Proj1 = identity, class Proj2 = identity>
441 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
442 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
443 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
445 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
446 indirect_unary_predicate<projected<I, Proj>> Pred>
447 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
449 template<input_range R, class Proj = identity,
450 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
451 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
453 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
454 indirect_unary_predicate<projected<I, Proj>> Pred>
455 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
457 template<input_range R, class Proj = identity,
458 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
459 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
461 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
462 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
463 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
464 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
465 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
466 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
467 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
469 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
470 class Proj2 = identity>
471 requires (forward_range<R1> || sized_range<R1>) &&
472 (forward_range<R2> || sized_range<R2>) &&
473 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
474 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
475 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
477 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
478 indirect_unary_predicate<projected<I, Proj>> Pred>
479 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
481 template<input_range R, class Proj = identity,
482 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
483 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
485 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
486 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
487 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
488 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
489 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
491 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
492 class Proj2 = identity>
493 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
494 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
495 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
497 template<input_iterator I1, sentinel_for<I1> S1,
498 random_access_iterator I2, sentinel_for<I2> S2,
499 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
500 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
501 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
502 constexpr partial_sort_copy_result<I1, I2>
503 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
504 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
506 template<input_range R1, random_access_range R2, class Comp = ranges::less,
507 class Proj1 = identity, class Proj2 = identity>
508 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
509 sortable<iterator_t<R2>, Comp, Proj2> &&
510 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
511 projected<iterator_t<R2>, Proj2>>
512 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
513 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
514 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
516 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
517 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
518 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
520 template<forward_range R, class Proj = identity,
521 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
522 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
524 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
525 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
526 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
528 template<forward_range R, class Proj = identity,
529 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
530 constexpr borrowed_iterator_t<R>
531 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
533 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
534 class Proj = identity>
535 requires sortable<I, Comp, Proj>
537 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
539 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
540 requires sortable<iterator_t<R>, Comp, Proj>
541 constexpr borrowed_iterator_t<R>
542 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
544 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
545 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
546 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
548 template<forward_range R, class T, class Proj = identity,
549 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
551 constexpr borrowed_iterator_t<R>
552 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
554 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
555 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
556 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
557 Proj proj = {}); // since C++20
558 template<forward_range R, class T, class Proj = identity,
559 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
561 constexpr borrowed_iterator_t<R>
562 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
564 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
565 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
566 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
567 Proj proj = {}); // since C++20
569 template<forward_range R, class T, class Proj = identity,
570 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
572 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
573 Proj proj = {}); // since C++20
575 template<permutable I, sentinel_for<I> S, class Proj = identity,
576 indirect_unary_predicate<projected<I, Proj>> Pred>
577 constexpr subrange<I>
578 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
580 template<forward_range R, class Proj = identity,
581 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
582 requires permutable<iterator_t<R>>
583 constexpr borrowed_subrange_t<R>
584 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
586 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
587 indirect_unary_predicate<projected<I, Proj>> Pred>
588 requires permutable<I>
589 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
591 template<bidirectional_range R, class Proj = identity,
592 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
593 requires permutable<iterator_t<R>>
594 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
596 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
597 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
598 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
599 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
601 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
603 template<input_range R1, forward_range R2,
604 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
605 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
606 constexpr borrowed_iterator_t<R1>
607 ranges::find_first_of(R1&& r1, R2&& r2,
609 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
611 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
612 indirect_binary_predicate<projected<I, Proj>,
613 projected<I, Proj>> Pred = ranges::equal_to>
614 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
616 template<forward_range R, class Proj = identity,
617 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
618 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
619 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
621 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
622 requires indirectly_writable<I, const T2&> &&
623 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
625 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
627 template<input_range R, class T1, class T2, class Proj = identity>
628 requires indirectly_writable<iterator_t<R>, const T2&> &&
629 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
630 constexpr borrowed_iterator_t<R>
631 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
633 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
634 indirect_unary_predicate<projected<I, Proj>> Pred>
635 requires indirectly_writable<I, const T&>
636 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
638 template<input_range R, class T, class Proj = identity,
639 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
640 requires indirectly_writable<iterator_t<R>, const T&>
641 constexpr borrowed_iterator_t<R>
642 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
644 template<class T, class Proj = identity,
645 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
647 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
649 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
650 class Proj1 = identity, class Proj2 = identity,
651 indirect_strict_weak_order<projected<I1, Proj1>,
652 projected<I2, Proj2>> Comp = ranges::less>
654 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
655 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
657 template<input_range R1, input_range R2, class Proj1 = identity,
658 class Proj2 = identity,
659 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
660 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
662 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
663 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
665 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
666 requires indirectly_movable<I1, I2>
667 constexpr ranges::move_backward_result<I1, I2>
668 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
670 template<bidirectional_range R, bidirectional_iterator I>
671 requires indirectly_movable<iterator_t<R>, I>
672 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
673 ranges::move_backward(R&& r, I result); // since C++20
675 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
676 requires indirectly_movable<I, O>
677 constexpr ranges::move_result<I, O>
678 ranges::move(I first, S last, O result); // since C++20
680 template<input_range R, weakly_incrementable O>
681 requires indirectly_movable<iterator_t<R>, O>
682 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
683 ranges::move(R&& r, O result); // since C++20
685 template<class I, class O1, class O2>
686 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
688 template<input_iterator I, sentinel_for<I> S,
689 weakly_incrementable O1, weakly_incrementable O2,
690 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
691 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
692 constexpr partition_copy_result<I, O1, O2>
693 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
694 Proj proj = {}); // since C++20
696 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
697 class Proj = identity,
698 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
699 requires indirectly_copyable<iterator_t<R>, O1> &&
700 indirectly_copyable<iterator_t<R>, O2>
701 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
702 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
704 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
705 indirect_unary_predicate<projected<I, Proj>> Pred>
706 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
708 template<forward_range R, class Proj = identity,
709 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
710 constexpr borrowed_iterator_t<R>
711 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
713 template<class I1, class I2, class O>
714 using merge_result = in_in_out_result<I1, I2, O>; // since C++20
716 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
717 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
718 class Proj2 = identity>
719 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
720 constexpr merge_result<I1, I2, O>
721 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
722 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
724 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
725 class Proj1 = identity, class Proj2 = identity>
726 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
727 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
728 merge(R1&& r1, R2&& r2, O result,
729 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
731 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
732 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
733 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
735 template<forward_range R, class T, class Proj = identity>
736 requires permutable<iterator_t<R>> &&
737 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
738 constexpr borrowed_subrange_t<R>
739 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
741 template<permutable I, sentinel_for<I> S, class Proj = identity,
742 indirect_unary_predicate<projected<I, Proj>> Pred>
743 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
745 template<forward_range R, class Proj = identity,
746 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
747 requires permutable<iterator_t<R>>
748 constexpr borrowed_subrange_t<R>
749 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
751 template<class I, class O>
752 using set_difference_result = in_out_result<I, O>; // since C++20
754 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
755 weakly_incrementable O, class Comp = ranges::less,
756 class Proj1 = identity, class Proj2 = identity>
757 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758 constexpr set_difference_result<I1, O>
759 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
760 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
762 template<input_range R1, input_range R2, weakly_incrementable O,
763 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
764 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
766 set_difference(R1&& r1, R2&& r2, O result,
767 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
769 template<class I1, class I2, class O>
770 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
772 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
773 weakly_incrementable O, class Comp = ranges::less,
774 class Proj1 = identity, class Proj2 = identity>
775 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
776 constexpr set_intersection_result<I1, I2, O>
777 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
778 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
780 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
781 weakly_incrementable O, class Comp = ranges::less,
782 class Proj1 = identity, class Proj2 = identity>
783 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
784 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
785 set_intersection(R1&& r1, R2&& r2, O result,
786 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
788 template <class _InIter, class _OutIter>
789 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
791 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
792 requires indirectly_copyable<I, O>
793 constexpr ranges::reverse_copy_result<I, O>
794 ranges::reverse_copy(I first, S last, O result); // since C++20
796 template<bidirectional_range R, weakly_incrementable O>
797 requires indirectly_copyable<iterator_t<R>, O>
798 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
799 ranges::reverse_copy(R&& r, O result); // since C++20
801 template<permutable I, sentinel_for<I> S>
802 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
804 template<forward_range R>
805 requires permutable<iterator_t<R>>
806 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
808 template <class _InIter, class _OutIter>
809 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
811 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
812 requires indirectly_copyable<I, O>
813 constexpr ranges::rotate_copy_result<I, O>
814 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
816 template<forward_range R, weakly_incrementable O>
817 requires indirectly_copyable<iterator_t<R>, O>
818 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
819 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
821 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
822 requires (forward_iterator<I> || random_access_iterator<O>) &&
823 indirectly_copyable<I, O> &&
824 uniform_random_bit_generator<remove_reference_t<Gen>>
825 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
827 template<input_range R, weakly_incrementable O, class Gen>
828 requires (forward_range<R> || random_access_iterator<O>) &&
829 indirectly_copyable<iterator_t<R>, O> &&
830 uniform_random_bit_generator<remove_reference_t<Gen>>
831 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
833 template<random_access_iterator I, sentinel_for<I> S, class Gen>
834 requires permutable<I> &&
835 uniform_random_bit_generator<remove_reference_t<Gen>>
836 I shuffle(I first, S last, Gen&& g); // since C++20
838 template<random_access_range R, class Gen>
839 requires permutable<iterator_t<R>> &&
840 uniform_random_bit_generator<remove_reference_t<Gen>>
841 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
843 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
844 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
845 indirect_equivalence_relation<projected<I1, Proj1>,
846 projected<I2, Proj2>> Pred = ranges::equal_to>
847 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
849 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
851 template<forward_range R1, forward_range R2,
852 class Proj1 = identity, class Proj2 = identity,
853 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
854 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
855 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
856 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
858 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
859 sentinel_for<I2> S2, class Pred = ranges::equal_to,
860 class Proj1 = identity, class Proj2 = identity>
861 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
862 constexpr subrange<I1>
863 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
864 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
866 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
867 class Proj1 = identity, class Proj2 = identity>
868 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
869 constexpr borrowed_subrange_t<R1>
870 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
871 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
873 template<forward_iterator I, sentinel_for<I> S, class T,
874 class Pred = ranges::equal_to, class Proj = identity>
875 requires indirectly_comparable<I, const T*, Pred, Proj>
876 constexpr subrange<I>
877 ranges::search_n(I first, S last, iter_difference_t<I> count,
878 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
880 template<forward_range R, class T, class Pred = ranges::equal_to,
881 class Proj = identity>
882 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
883 constexpr borrowed_subrange_t<R>
884 ranges::search_n(R&& r, range_difference_t<R> count,
885 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
887 template<input_iterator I, sentinel_for<I> S, class T,
888 indirectly-binary-left-foldable<T, I> F>
889 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
891 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
892 constexpr auto fold_left(R&& r, T init, F f); // since C++23
894 template<class I, class T>
895 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
897 template<input_iterator I, sentinel_for<I> S, class T,
898 indirectly-binary-left-foldable<T, I> F>
899 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
901 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
902 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
904 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
905 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
906 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
907 constexpr subrange<I1>
908 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
911 template<forward_range R1, forward_range R2,
912 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
913 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
914 constexpr borrowed_subrange_t<R1>
915 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
916 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
918 template<class I1, class I2, class O>
919 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
921 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
922 weakly_incrementable O, class Comp = ranges::less,
923 class Proj1 = identity, class Proj2 = identity>
924 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
925 constexpr set_symmetric_difference_result<I1, I2, O>
926 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
927 Comp comp = {}, Proj1 proj1 = {},
928 Proj2 proj2 = {}); // since C++20
930 template<input_range R1, input_range R2, weakly_incrementable O,
931 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
932 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
933 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
934 borrowed_iterator_t<R2>, O>
935 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
936 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
938 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
939 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
940 constexpr subrange<I>
941 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
943 template<forward_range R, class T, class Proj = identity,
944 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
946 constexpr borrowed_subrange_t<R>
947 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
949 template<class I1, class I2, class O>
950 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
952 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
953 weakly_incrementable O, class Comp = ranges::less,
954 class Proj1 = identity, class Proj2 = identity>
955 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
956 constexpr set_union_result<I1, I2, O>
957 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
958 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
960 template<input_range R1, input_range R2, weakly_incrementable O,
961 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
962 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
963 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
964 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
965 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
967 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
968 class Proj1 = identity, class Proj2 = identity,
969 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
971 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
972 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
974 template<input_range R1, input_range R2, class Proj1 = identity,
975 class Proj2 = identity,
976 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
977 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
978 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
979 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
981 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
982 class Proj = identity>
983 requires sortable<I, Comp, Proj>
984 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
986 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
987 requires sortable<iterator_t<R>, Comp, Proj>
988 borrowed_iterator_t<R>
989 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
990 Proj proj = {}); // since C++20
992 template<permutable I, sentinel_for<I> S, class Proj = identity,
993 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
994 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
996 template<forward_range R, class Proj = identity,
997 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
998 requires permutable<iterator_t<R>>
999 constexpr borrowed_subrange_t<R>
1000 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
1002 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1003 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1004 requires indirectly_copyable<I, O> &&
1005 (forward_iterator<I> ||
1006 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1007 indirectly_copyable_storable<I, O>)
1008 constexpr unique_copy_result<I, O>
1009 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
1011 template<input_range R, weakly_incrementable O, class Proj = identity,
1012 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1013 requires indirectly_copyable<iterator_t<R>, O> &&
1014 (forward_iterator<iterator_t<R>> ||
1015 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1016 indirectly_copyable_storable<iterator_t<R>, O>)
1017 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
1018 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
1020 template<class I, class O>
1021 using remove_copy_result = in_out_result<I, O>; // since C++20
1023 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1024 class Proj = identity>
1025 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1026 constexpr remove_copy_result<I, O>
1027 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
1029 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1030 requires indirectly_copyable<iterator_t<R>, O> &&
1031 indirect_binary_predicate<ranges::equal_to,
1032 projected<iterator_t<R>, Proj>, const T*>
1033 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
1034 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
1036 template<class I, class O>
1037 using remove_copy_if_result = in_out_result<I, O>; // since C++20
1039 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1040 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1041 requires indirectly_copyable<I, O>
1042 constexpr remove_copy_if_result<I, O>
1043 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
1045 template<input_range R, weakly_incrementable O, class Proj = identity,
1046 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1047 requires indirectly_copyable<iterator_t<R>, O>
1048 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
1049 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
1051 template<class I, class O>
1052 using replace_copy_result = in_out_result<I, O>; // since C++20
1054 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1055 output_iterator<const T2&> O, class Proj = identity>
1056 requires indirectly_copyable<I, O> &&
1057 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1058 constexpr replace_copy_result<I, O>
1059 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
1060 Proj proj = {}); // since C++20
1062 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1063 class Proj = identity>
1064 requires indirectly_copyable<iterator_t<R>, O> &&
1065 indirect_binary_predicate<ranges::equal_to,
1066 projected<iterator_t<R>, Proj>, const T1*>
1067 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1068 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
1069 Proj proj = {}); // since C++20
1071 template<class I, class O>
1072 using replace_copy_if_result = in_out_result<I, O>; // since C++20
1074 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1075 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1076 requires indirectly_copyable<I, O>
1077 constexpr replace_copy_if_result<I, O>
1078 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
1079 Proj proj = {}); // since C++20
1081 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1082 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1083 requires indirectly_copyable<iterator_t<R>, O>
1084 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1085 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
1086 Proj proj = {}); // since C++20
1089 using prev_permutation_result = in_found_result<I>; // since C++20
1091 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1092 class Proj = identity>
1093 requires sortable<I, Comp, Proj>
1094 constexpr ranges::prev_permutation_result<I>
1095 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1097 template<bidirectional_range R, class Comp = ranges::less,
1098 class Proj = identity>
1099 requires sortable<iterator_t<R>, Comp, Proj>
1100 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
1101 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1104 using next_permutation_result = in_found_result<I>; // since C++20
1106 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1107 class Proj = identity>
1108 requires sortable<I, Comp, Proj>
1109 constexpr ranges::next_permutation_result<I>
1110 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1112 template<bidirectional_range R, class Comp = ranges::less,
1113 class Proj = identity>
1114 requires sortable<iterator_t<R>, Comp, Proj>
1115 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
1116 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1120 template <class InputIterator, class Predicate>
1121 constexpr bool // constexpr in C++20
1122 all_of(InputIterator first, InputIterator last, Predicate pred);
1124 template <class InputIterator, class Predicate>
1125 constexpr bool // constexpr in C++20
1126 any_of(InputIterator first, InputIterator last, Predicate pred);
1128 template <class InputIterator, class Predicate>
1129 constexpr bool // constexpr in C++20
1130 none_of(InputIterator first, InputIterator last, Predicate pred);
1132 template <class InputIterator, class Function>
1133 constexpr Function // constexpr in C++20
1134 for_each(InputIterator first, InputIterator last, Function f);
1136 template<class InputIterator, class Size, class Function>
1137 constexpr InputIterator // constexpr in C++20
1138 for_each_n(InputIterator first, Size n, Function f); // C++17
1140 template <class InputIterator, class T>
1141 constexpr InputIterator // constexpr in C++20
1142 find(InputIterator first, InputIterator last, const T& value);
1144 template <class InputIterator, class Predicate>
1145 constexpr InputIterator // constexpr in C++20
1146 find_if(InputIterator first, InputIterator last, Predicate pred);
1148 template<class InputIterator, class Predicate>
1149 constexpr InputIterator // constexpr in C++20
1150 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1152 template <class ForwardIterator1, class ForwardIterator2>
1153 constexpr ForwardIterator1 // constexpr in C++20
1154 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1155 ForwardIterator2 first2, ForwardIterator2 last2);
1157 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1158 constexpr ForwardIterator1 // constexpr in C++20
1159 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1160 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1162 template <class ForwardIterator1, class ForwardIterator2>
1163 constexpr ForwardIterator1 // constexpr in C++20
1164 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1165 ForwardIterator2 first2, ForwardIterator2 last2);
1167 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1168 constexpr ForwardIterator1 // constexpr in C++20
1169 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1170 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1172 template <class ForwardIterator>
1173 constexpr ForwardIterator // constexpr in C++20
1174 adjacent_find(ForwardIterator first, ForwardIterator last);
1176 template <class ForwardIterator, class BinaryPredicate>
1177 constexpr ForwardIterator // constexpr in C++20
1178 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1180 template <class InputIterator, class T>
1181 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1182 count(InputIterator first, InputIterator last, const T& value);
1184 template <class InputIterator, class Predicate>
1185 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1186 count_if(InputIterator first, InputIterator last, Predicate pred);
1188 template <class InputIterator1, class InputIterator2>
1189 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1190 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1192 template <class InputIterator1, class InputIterator2>
1193 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1194 mismatch(InputIterator1 first1, InputIterator1 last1,
1195 InputIterator2 first2, InputIterator2 last2); // **C++14**
1197 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1198 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1199 mismatch(InputIterator1 first1, InputIterator1 last1,
1200 InputIterator2 first2, BinaryPredicate pred);
1202 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1203 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1204 mismatch(InputIterator1 first1, InputIterator1 last1,
1205 InputIterator2 first2, InputIterator2 last2,
1206 BinaryPredicate pred); // **C++14**
1208 template <class InputIterator1, class InputIterator2>
1209 constexpr bool // constexpr in C++20
1210 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1212 template <class InputIterator1, class InputIterator2>
1213 constexpr bool // constexpr in C++20
1214 equal(InputIterator1 first1, InputIterator1 last1,
1215 InputIterator2 first2, InputIterator2 last2); // **C++14**
1217 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1218 constexpr bool // constexpr in C++20
1219 equal(InputIterator1 first1, InputIterator1 last1,
1220 InputIterator2 first2, BinaryPredicate pred);
1222 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1223 constexpr bool // constexpr in C++20
1224 equal(InputIterator1 first1, InputIterator1 last1,
1225 InputIterator2 first2, InputIterator2 last2,
1226 BinaryPredicate pred); // **C++14**
1228 template<class ForwardIterator1, class ForwardIterator2>
1229 constexpr bool // constexpr in C++20
1230 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1231 ForwardIterator2 first2);
1233 template<class ForwardIterator1, class ForwardIterator2>
1234 constexpr bool // constexpr in C++20
1235 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1236 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1238 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1239 constexpr bool // constexpr in C++20
1240 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1241 ForwardIterator2 first2, BinaryPredicate pred);
1243 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1244 constexpr bool // constexpr in C++20
1245 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1246 ForwardIterator2 first2, ForwardIterator2 last2,
1247 BinaryPredicate pred); // **C++14**
1249 template <class ForwardIterator1, class ForwardIterator2>
1250 constexpr ForwardIterator1 // constexpr in C++20
1251 search(ForwardIterator1 first1, ForwardIterator1 last1,
1252 ForwardIterator2 first2, ForwardIterator2 last2);
1254 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1255 constexpr ForwardIterator1 // constexpr in C++20
1256 search(ForwardIterator1 first1, ForwardIterator1 last1,
1257 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1259 template <class ForwardIterator, class Size, class T>
1260 constexpr ForwardIterator // constexpr in C++20
1261 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1263 template <class ForwardIterator, class Size, class T, class BinaryPredicate>
1264 constexpr ForwardIterator // constexpr in C++20
1265 search_n(ForwardIterator first, ForwardIterator last,
1266 Size count, const T& value, BinaryPredicate pred);
1268 template <class InputIterator, class OutputIterator>
1269 constexpr OutputIterator // constexpr in C++20
1270 copy(InputIterator first, InputIterator last, OutputIterator result);
1272 template<class InputIterator, class OutputIterator, class Predicate>
1273 constexpr OutputIterator // constexpr in C++20
1274 copy_if(InputIterator first, InputIterator last,
1275 OutputIterator result, Predicate pred);
1277 template<class InputIterator, class Size, class OutputIterator>
1278 constexpr OutputIterator // constexpr in C++20
1279 copy_n(InputIterator first, Size n, OutputIterator result);
1281 template <class BidirectionalIterator1, class BidirectionalIterator2>
1282 constexpr BidirectionalIterator2 // constexpr in C++20
1283 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1284 BidirectionalIterator2 result);
1287 template<class InputIterator, class OutputIterator>
1288 constexpr OutputIterator move(InputIterator first, InputIterator last,
1289 OutputIterator result);
1291 template<class BidirectionalIterator1, class BidirectionalIterator2>
1292 constexpr BidirectionalIterator2
1293 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1294 BidirectionalIterator2 result);
1296 template <class ForwardIterator1, class ForwardIterator2>
1297 constexpr ForwardIterator2 // constexpr in C++20
1298 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1301 template<class I1, class I2>
1302 using swap_ranges_result = in_in_result<I1, I2>;
1304 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1305 requires indirectly_swappable<I1, I2>
1306 constexpr ranges::swap_ranges_result<I1, I2>
1307 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
1309 template<input_range R1, input_range R2>
1310 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1311 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
1312 swap_ranges(R1&& r1, R2&& r2);
1315 template <class ForwardIterator1, class ForwardIterator2>
1316 constexpr void // constexpr in C++20
1317 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1319 template <class InputIterator, class OutputIterator, class UnaryOperation>
1320 constexpr OutputIterator // constexpr in C++20
1321 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1323 template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
1324 constexpr OutputIterator // constexpr in C++20
1325 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1326 OutputIterator result, BinaryOperation binary_op);
1328 template <class ForwardIterator, class T>
1329 constexpr void // constexpr in C++20
1330 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1332 template <class ForwardIterator, class Predicate, class T>
1333 constexpr void // constexpr in C++20
1334 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1336 template <class InputIterator, class OutputIterator, class T>
1337 constexpr OutputIterator // constexpr in C++20
1338 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1339 const T& old_value, const T& new_value);
1341 template <class InputIterator, class OutputIterator, class Predicate, class T>
1342 constexpr OutputIterator // constexpr in C++20
1343 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1345 template <class ForwardIterator, class T>
1346 constexpr void // constexpr in C++20
1347 fill(ForwardIterator first, ForwardIterator last, const T& value);
1349 template <class OutputIterator, class Size, class T>
1350 constexpr OutputIterator // constexpr in C++20
1351 fill_n(OutputIterator first, Size n, const T& value);
1353 template <class ForwardIterator, class Generator>
1354 constexpr void // constexpr in C++20
1355 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1357 template <class OutputIterator, class Size, class Generator>
1358 constexpr OutputIterator // constexpr in C++20
1359 generate_n(OutputIterator first, Size n, Generator gen);
1361 template <class ForwardIterator, class T>
1362 constexpr ForwardIterator // constexpr in C++20
1363 remove(ForwardIterator first, ForwardIterator last, const T& value);
1365 template <class ForwardIterator, class Predicate>
1366 constexpr ForwardIterator // constexpr in C++20
1367 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1369 template <class InputIterator, class OutputIterator, class T>
1370 constexpr OutputIterator // constexpr in C++20
1371 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1373 template <class InputIterator, class OutputIterator, class Predicate>
1374 constexpr OutputIterator // constexpr in C++20
1375 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1377 template <class ForwardIterator>
1378 constexpr ForwardIterator // constexpr in C++20
1379 unique(ForwardIterator first, ForwardIterator last);
1381 template <class ForwardIterator, class BinaryPredicate>
1382 constexpr ForwardIterator // constexpr in C++20
1383 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1385 template <class InputIterator, class OutputIterator>
1386 constexpr OutputIterator // constexpr in C++20
1387 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1389 template <class InputIterator, class OutputIterator, class BinaryPredicate>
1390 constexpr OutputIterator // constexpr in C++20
1391 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1393 template <class BidirectionalIterator>
1394 constexpr void // constexpr in C++20
1395 reverse(BidirectionalIterator first, BidirectionalIterator last);
1397 template <class BidirectionalIterator, class OutputIterator>
1398 constexpr OutputIterator // constexpr in C++20
1399 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1401 template <class ForwardIterator>
1402 constexpr ForwardIterator // constexpr in C++20
1403 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1405 template <class ForwardIterator, class OutputIterator>
1406 constexpr OutputIterator // constexpr in C++20
1407 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1409 template <class RandomAccessIterator>
1411 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
1413 template <class RandomAccessIterator, class RandomNumberGenerator>
1415 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
1416 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
1418 template<class PopulationIterator, class SampleIterator,
1419 class Distance, class UniformRandomBitGenerator>
1420 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1421 SampleIterator out, Distance n,
1422 UniformRandomBitGenerator&& g); // C++17
1424 template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1425 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
1426 UniformRandomNumberGenerator&& g);
1428 template<class ForwardIterator>
1429 constexpr ForwardIterator
1430 shift_left(ForwardIterator first, ForwardIterator last,
1431 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1433 template<class ForwardIterator>
1434 constexpr ForwardIterator
1435 shift_right(ForwardIterator first, ForwardIterator last,
1436 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1438 template <class InputIterator, class Predicate>
1439 constexpr bool // constexpr in C++20
1440 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1442 template <class ForwardIterator, class Predicate>
1443 constexpr ForwardIterator // constexpr in C++20
1444 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1446 template <class InputIterator, class OutputIterator1,
1447 class OutputIterator2, class Predicate>
1448 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
1449 partition_copy(InputIterator first, InputIterator last,
1450 OutputIterator1 out_true, OutputIterator2 out_false,
1453 template <class ForwardIterator, class Predicate>
1455 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1457 template<class ForwardIterator, class Predicate>
1458 constexpr ForwardIterator // constexpr in C++20
1459 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1461 template <class ForwardIterator>
1462 constexpr bool // constexpr in C++20
1463 is_sorted(ForwardIterator first, ForwardIterator last);
1465 template <class ForwardIterator, class Compare>
1466 constexpr bool // constexpr in C++20
1467 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1469 template<class ForwardIterator>
1470 constexpr ForwardIterator // constexpr in C++20
1471 is_sorted_until(ForwardIterator first, ForwardIterator last);
1473 template <class ForwardIterator, class Compare>
1474 constexpr ForwardIterator // constexpr in C++20
1475 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1477 template <class RandomAccessIterator>
1478 constexpr void // constexpr in C++20
1479 sort(RandomAccessIterator first, RandomAccessIterator last);
1481 template <class RandomAccessIterator, class Compare>
1482 constexpr void // constexpr in C++20
1483 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1485 template <class RandomAccessIterator>
1487 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1489 template <class RandomAccessIterator, class Compare>
1491 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1493 template <class RandomAccessIterator>
1494 constexpr void // constexpr in C++20
1495 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1497 template <class RandomAccessIterator, class Compare>
1498 constexpr void // constexpr in C++20
1499 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1501 template <class InputIterator, class RandomAccessIterator>
1502 constexpr RandomAccessIterator // constexpr in C++20
1503 partial_sort_copy(InputIterator first, InputIterator last,
1504 RandomAccessIterator result_first, RandomAccessIterator result_last);
1506 template <class InputIterator, class RandomAccessIterator, class Compare>
1507 constexpr RandomAccessIterator // constexpr in C++20
1508 partial_sort_copy(InputIterator first, InputIterator last,
1509 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1511 template <class RandomAccessIterator>
1512 constexpr void // constexpr in C++20
1513 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1515 template <class RandomAccessIterator, class Compare>
1516 constexpr void // constexpr in C++20
1517 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1519 template <class ForwardIterator, class T>
1520 constexpr ForwardIterator // constexpr in C++20
1521 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1523 template <class ForwardIterator, class T, class Compare>
1524 constexpr ForwardIterator // constexpr in C++20
1525 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1527 template <class ForwardIterator, class T>
1528 constexpr ForwardIterator // constexpr in C++20
1529 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1531 template <class ForwardIterator, class T, class Compare>
1532 constexpr ForwardIterator // constexpr in C++20
1533 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1535 template <class ForwardIterator, class T>
1536 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1537 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1539 template <class ForwardIterator, class T, class Compare>
1540 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1541 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1543 template <class ForwardIterator, class T>
1544 constexpr bool // constexpr in C++20
1545 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1547 template <class ForwardIterator, class T, class Compare>
1548 constexpr bool // constexpr in C++20
1549 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1551 template <class InputIterator1, class InputIterator2, class OutputIterator>
1552 constexpr OutputIterator // constexpr in C++20
1553 merge(InputIterator1 first1, InputIterator1 last1,
1554 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1556 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1557 constexpr OutputIterator // constexpr in C++20
1558 merge(InputIterator1 first1, InputIterator1 last1,
1559 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1561 template <class BidirectionalIterator>
1563 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1565 template <class BidirectionalIterator, class Compare>
1567 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1569 template <class InputIterator1, class InputIterator2>
1570 constexpr bool // constexpr in C++20
1571 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1573 template <class InputIterator1, class InputIterator2, class Compare>
1574 constexpr bool // constexpr in C++20
1575 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1577 template <class InputIterator1, class InputIterator2, class OutputIterator>
1578 constexpr OutputIterator // constexpr in C++20
1579 set_union(InputIterator1 first1, InputIterator1 last1,
1580 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1582 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1583 constexpr OutputIterator // constexpr in C++20
1584 set_union(InputIterator1 first1, InputIterator1 last1,
1585 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1587 template <class InputIterator1, class InputIterator2, class OutputIterator>
1588 constexpr OutputIterator // constexpr in C++20
1589 set_intersection(InputIterator1 first1, InputIterator1 last1,
1590 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1592 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1593 constexpr OutputIterator // constexpr in C++20
1594 set_intersection(InputIterator1 first1, InputIterator1 last1,
1595 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1597 template <class InputIterator1, class InputIterator2, class OutputIterator>
1598 constexpr OutputIterator // constexpr in C++20
1599 set_difference(InputIterator1 first1, InputIterator1 last1,
1600 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1602 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1603 constexpr OutputIterator // constexpr in C++20
1604 set_difference(InputIterator1 first1, InputIterator1 last1,
1605 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1607 template <class InputIterator1, class InputIterator2, class OutputIterator>
1608 constexpr OutputIterator // constexpr in C++20
1609 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1610 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1612 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1613 constexpr OutputIterator // constexpr in C++20
1614 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1615 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1617 template <class RandomAccessIterator>
1618 constexpr void // constexpr in C++20
1619 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1621 template <class RandomAccessIterator, class Compare>
1622 constexpr void // constexpr in C++20
1623 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1625 template <class RandomAccessIterator>
1626 constexpr void // constexpr in C++20
1627 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1629 template <class RandomAccessIterator, class Compare>
1630 constexpr void // constexpr in C++20
1631 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1633 template <class RandomAccessIterator>
1634 constexpr void // constexpr in C++20
1635 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1637 template <class RandomAccessIterator, class Compare>
1638 constexpr void // constexpr in C++20
1639 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1641 template <class RandomAccessIterator>
1642 constexpr void // constexpr in C++20
1643 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1645 template <class RandomAccessIterator, class Compare>
1646 constexpr void // constexpr in C++20
1647 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1649 template <class RandomAccessIterator>
1650 constexpr bool // constexpr in C++20
1651 is_heap(RandomAccessIterator first, RandomAccessiterator last);
1653 template <class RandomAccessIterator, class Compare>
1654 constexpr bool // constexpr in C++20
1655 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1657 template <class RandomAccessIterator>
1658 constexpr RandomAccessIterator // constexpr in C++20
1659 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
1661 template <class RandomAccessIterator, class Compare>
1662 constexpr RandomAccessIterator // constexpr in C++20
1663 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1665 template <class ForwardIterator>
1666 constexpr ForwardIterator // constexpr in C++14
1667 min_element(ForwardIterator first, ForwardIterator last);
1669 template <class ForwardIterator, class Compare>
1670 constexpr ForwardIterator // constexpr in C++14
1671 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
1674 constexpr const T& // constexpr in C++14
1675 min(const T& a, const T& b);
1677 template <class T, class Compare>
1678 constexpr const T& // constexpr in C++14
1679 min(const T& a, const T& b, Compare comp);
1682 constexpr T // constexpr in C++14
1683 min(initializer_list<T> t);
1685 template<class T, class Compare>
1686 constexpr T // constexpr in C++14
1687 min(initializer_list<T> t, Compare comp);
1690 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
1692 template<class T, class Compare>
1693 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
1695 template <class ForwardIterator>
1696 constexpr ForwardIterator // constexpr in C++14
1697 max_element(ForwardIterator first, ForwardIterator last);
1699 template <class ForwardIterator, class Compare>
1700 constexpr ForwardIterator // constexpr in C++14
1701 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
1704 constexpr const T& // constexpr in C++14
1705 max(const T& a, const T& b);
1707 template <class T, class Compare>
1708 constexpr const T& // constexpr in C++14
1709 max(const T& a, const T& b, Compare comp);
1712 constexpr T // constexpr in C++14
1713 max(initializer_list<T> t);
1715 template<class T, class Compare>
1716 constexpr T // constexpr in C++14
1717 max(initializer_list<T> t, Compare comp);
1719 template<class ForwardIterator>
1720 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1721 minmax_element(ForwardIterator first, ForwardIterator last);
1723 template<class ForwardIterator, class Compare>
1724 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1725 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
1728 constexpr pair<const T&, const T&> // constexpr in C++14
1729 minmax(const T& a, const T& b);
1731 template<class T, class Compare>
1732 constexpr pair<const T&, const T&> // constexpr in C++14
1733 minmax(const T& a, const T& b, Compare comp);
1736 constexpr pair<T, T> // constexpr in C++14
1737 minmax(initializer_list<T> t);
1739 template<class T, class Compare>
1740 constexpr pair<T, T> // constexpr in C++14
1741 minmax(initializer_list<T> t, Compare comp);
1743 template <class InputIterator1, class InputIterator2>
1744 constexpr bool // constexpr in C++20
1745 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1747 template <class InputIterator1, class InputIterator2, class Compare>
1748 constexpr bool // constexpr in C++20
1749 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1750 InputIterator2 first2, InputIterator2 last2, Compare comp);
1752 template<class InputIterator1, class InputIterator2, class Cmp>
1754 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1755 InputIterator2 first2, InputIterator2 last2,
1757 -> decltype(comp(*b1, *b2)); // since C++20
1759 template<class InputIterator1, class InputIterator2>
1761 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1762 InputIterator2 first2, InputIterator2 last2); // since C++20
1764 template <class BidirectionalIterator>
1765 constexpr bool // constexpr in C++20
1766 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1768 template <class BidirectionalIterator, class Compare>
1769 constexpr bool // constexpr in C++20
1770 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1772 template <class BidirectionalIterator>
1773 constexpr bool // constexpr in C++20
1774 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1776 template <class BidirectionalIterator, class Compare>
1777 constexpr bool // constexpr in C++20
1778 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1783 #include <__assert> // all public C++ headers provide the assertion handler
1787 #include <__algorithm/adjacent_find.h>
1788 #include <__algorithm/all_of.h>
1789 #include <__algorithm/any_of.h>
1790 #include <__algorithm/binary_search.h>
1791 #include <__algorithm/clamp.h>
1792 #include <__algorithm/comp.h>
1793 #include <__algorithm/comp_ref_type.h>
1794 #include <__algorithm/copy.h>
1795 #include <__algorithm/copy_backward.h>
1796 #include <__algorithm/copy_if.h>
1797 #include <__algorithm/copy_n.h>
1798 #include <__algorithm/count.h>
1799 #include <__algorithm/count_if.h>
1800 #include <__algorithm/equal.h>
1801 #include <__algorithm/equal_range.h>
1802 #include <__algorithm/fill.h>
1803 #include <__algorithm/fill_n.h>
1804 #include <__algorithm/find.h>
1805 #include <__algorithm/find_end.h>
1806 #include <__algorithm/find_first_of.h>
1807 #include <__algorithm/find_if.h>
1808 #include <__algorithm/find_if_not.h>
1809 #include <__algorithm/fold.h>
1810 #include <__algorithm/for_each.h>
1811 #include <__algorithm/for_each_n.h>
1812 #include <__algorithm/generate.h>
1813 #include <__algorithm/generate_n.h>
1814 #include <__algorithm/half_positive.h>
1815 #include <__algorithm/in_found_result.h>
1816 #include <__algorithm/in_fun_result.h>
1817 #include <__algorithm/in_in_out_result.h>
1818 #include <__algorithm/in_in_result.h>
1819 #include <__algorithm/in_out_out_result.h>
1820 #include <__algorithm/in_out_result.h>
1821 #include <__algorithm/includes.h>
1822 #include <__algorithm/inplace_merge.h>
1823 #include <__algorithm/is_heap.h>
1824 #include <__algorithm/is_heap_until.h>
1825 #include <__algorithm/is_partitioned.h>
1826 #include <__algorithm/is_permutation.h>
1827 #include <__algorithm/is_sorted.h>
1828 #include <__algorithm/is_sorted_until.h>
1829 #include <__algorithm/iter_swap.h>
1830 #include <__algorithm/lexicographical_compare.h>
1831 #include <__algorithm/lexicographical_compare_three_way.h>
1832 #include <__algorithm/lower_bound.h>
1833 #include <__algorithm/make_heap.h>
1834 #include <__algorithm/max.h>
1835 #include <__algorithm/max_element.h>
1836 #include <__algorithm/merge.h>
1837 #include <__algorithm/min.h>
1838 #include <__algorithm/min_element.h>
1839 #include <__algorithm/min_max_result.h>
1840 #include <__algorithm/minmax.h>
1841 #include <__algorithm/minmax_element.h>
1842 #include <__algorithm/mismatch.h>
1843 #include <__algorithm/move.h>
1844 #include <__algorithm/move_backward.h>
1845 #include <__algorithm/next_permutation.h>
1846 #include <__algorithm/none_of.h>
1847 #include <__algorithm/nth_element.h>
1848 #include <__algorithm/partial_sort.h>
1849 #include <__algorithm/partial_sort_copy.h>
1850 #include <__algorithm/partition.h>
1851 #include <__algorithm/partition_copy.h>
1852 #include <__algorithm/partition_point.h>
1853 #include <__algorithm/pop_heap.h>
1854 #include <__algorithm/prev_permutation.h>
1855 #include <__algorithm/pstl_any_all_none_of.h>
1856 #include <__algorithm/pstl_copy.h>
1857 #include <__algorithm/pstl_count.h>
1858 #include <__algorithm/pstl_equal.h>
1859 #include <__algorithm/pstl_fill.h>
1860 #include <__algorithm/pstl_find.h>
1861 #include <__algorithm/pstl_for_each.h>
1862 #include <__algorithm/pstl_generate.h>
1863 #include <__algorithm/pstl_is_partitioned.h>
1864 #include <__algorithm/pstl_merge.h>
1865 #include <__algorithm/pstl_move.h>
1866 #include <__algorithm/pstl_replace.h>
1867 #include <__algorithm/pstl_rotate_copy.h>
1868 #include <__algorithm/pstl_sort.h>
1869 #include <__algorithm/pstl_stable_sort.h>
1870 #include <__algorithm/pstl_transform.h>
1871 #include <__algorithm/push_heap.h>
1872 #include <__algorithm/ranges_adjacent_find.h>
1873 #include <__algorithm/ranges_all_of.h>
1874 #include <__algorithm/ranges_any_of.h>
1875 #include <__algorithm/ranges_binary_search.h>
1876 #include <__algorithm/ranges_clamp.h>
1877 #include <__algorithm/ranges_contains.h>
1878 #include <__algorithm/ranges_copy.h>
1879 #include <__algorithm/ranges_copy_backward.h>
1880 #include <__algorithm/ranges_copy_if.h>
1881 #include <__algorithm/ranges_copy_n.h>
1882 #include <__algorithm/ranges_count.h>
1883 #include <__algorithm/ranges_count_if.h>
1884 #include <__algorithm/ranges_ends_with.h>
1885 #include <__algorithm/ranges_equal.h>
1886 #include <__algorithm/ranges_equal_range.h>
1887 #include <__algorithm/ranges_fill.h>
1888 #include <__algorithm/ranges_fill_n.h>
1889 #include <__algorithm/ranges_find.h>
1890 #include <__algorithm/ranges_find_end.h>
1891 #include <__algorithm/ranges_find_first_of.h>
1892 #include <__algorithm/ranges_find_if.h>
1893 #include <__algorithm/ranges_find_if_not.h>
1894 #include <__algorithm/ranges_for_each.h>
1895 #include <__algorithm/ranges_for_each_n.h>
1896 #include <__algorithm/ranges_generate.h>
1897 #include <__algorithm/ranges_generate_n.h>
1898 #include <__algorithm/ranges_includes.h>
1899 #include <__algorithm/ranges_inplace_merge.h>
1900 #include <__algorithm/ranges_is_heap.h>
1901 #include <__algorithm/ranges_is_heap_until.h>
1902 #include <__algorithm/ranges_is_partitioned.h>
1903 #include <__algorithm/ranges_is_permutation.h>
1904 #include <__algorithm/ranges_is_sorted.h>
1905 #include <__algorithm/ranges_is_sorted_until.h>
1906 #include <__algorithm/ranges_lexicographical_compare.h>
1907 #include <__algorithm/ranges_lower_bound.h>
1908 #include <__algorithm/ranges_make_heap.h>
1909 #include <__algorithm/ranges_max.h>
1910 #include <__algorithm/ranges_max_element.h>
1911 #include <__algorithm/ranges_merge.h>
1912 #include <__algorithm/ranges_min.h>
1913 #include <__algorithm/ranges_min_element.h>
1914 #include <__algorithm/ranges_minmax.h>
1915 #include <__algorithm/ranges_minmax_element.h>
1916 #include <__algorithm/ranges_mismatch.h>
1917 #include <__algorithm/ranges_move.h>
1918 #include <__algorithm/ranges_move_backward.h>
1919 #include <__algorithm/ranges_next_permutation.h>
1920 #include <__algorithm/ranges_none_of.h>
1921 #include <__algorithm/ranges_nth_element.h>
1922 #include <__algorithm/ranges_partial_sort.h>
1923 #include <__algorithm/ranges_partial_sort_copy.h>
1924 #include <__algorithm/ranges_partition.h>
1925 #include <__algorithm/ranges_partition_copy.h>
1926 #include <__algorithm/ranges_partition_point.h>
1927 #include <__algorithm/ranges_pop_heap.h>
1928 #include <__algorithm/ranges_prev_permutation.h>
1929 #include <__algorithm/ranges_push_heap.h>
1930 #include <__algorithm/ranges_remove.h>
1931 #include <__algorithm/ranges_remove_copy.h>
1932 #include <__algorithm/ranges_remove_copy_if.h>
1933 #include <__algorithm/ranges_remove_if.h>
1934 #include <__algorithm/ranges_replace.h>
1935 #include <__algorithm/ranges_replace_copy.h>
1936 #include <__algorithm/ranges_replace_copy_if.h>
1937 #include <__algorithm/ranges_replace_if.h>
1938 #include <__algorithm/ranges_reverse.h>
1939 #include <__algorithm/ranges_reverse_copy.h>
1940 #include <__algorithm/ranges_rotate.h>
1941 #include <__algorithm/ranges_rotate_copy.h>
1942 #include <__algorithm/ranges_sample.h>
1943 #include <__algorithm/ranges_search.h>
1944 #include <__algorithm/ranges_search_n.h>
1945 #include <__algorithm/ranges_set_difference.h>
1946 #include <__algorithm/ranges_set_intersection.h>
1947 #include <__algorithm/ranges_set_symmetric_difference.h>
1948 #include <__algorithm/ranges_set_union.h>
1949 #include <__algorithm/ranges_shuffle.h>
1950 #include <__algorithm/ranges_sort.h>
1951 #include <__algorithm/ranges_sort_heap.h>
1952 #include <__algorithm/ranges_stable_partition.h>
1953 #include <__algorithm/ranges_stable_sort.h>
1954 #include <__algorithm/ranges_starts_with.h>
1955 #include <__algorithm/ranges_swap_ranges.h>
1956 #include <__algorithm/ranges_transform.h>
1957 #include <__algorithm/ranges_unique.h>
1958 #include <__algorithm/ranges_unique_copy.h>
1959 #include <__algorithm/ranges_upper_bound.h>
1960 #include <__algorithm/remove.h>
1961 #include <__algorithm/remove_copy.h>
1962 #include <__algorithm/remove_copy_if.h>
1963 #include <__algorithm/remove_if.h>
1964 #include <__algorithm/replace.h>
1965 #include <__algorithm/replace_copy.h>
1966 #include <__algorithm/replace_copy_if.h>
1967 #include <__algorithm/replace_if.h>
1968 #include <__algorithm/reverse.h>
1969 #include <__algorithm/reverse_copy.h>
1970 #include <__algorithm/rotate.h>
1971 #include <__algorithm/rotate_copy.h>
1972 #include <__algorithm/sample.h>
1973 #include <__algorithm/search.h>
1974 #include <__algorithm/search_n.h>
1975 #include <__algorithm/set_difference.h>
1976 #include <__algorithm/set_intersection.h>
1977 #include <__algorithm/set_symmetric_difference.h>
1978 #include <__algorithm/set_union.h>
1979 #include <__algorithm/shift_left.h>
1980 #include <__algorithm/shift_right.h>
1981 #include <__algorithm/shuffle.h>
1982 #include <__algorithm/sift_down.h>
1983 #include <__algorithm/sort.h>
1984 #include <__algorithm/sort_heap.h>
1985 #include <__algorithm/stable_partition.h>
1986 #include <__algorithm/stable_sort.h>
1987 #include <__algorithm/swap_ranges.h>
1988 #include <__algorithm/transform.h>
1989 #include <__algorithm/unique.h>
1990 #include <__algorithm/unique_copy.h>
1991 #include <__algorithm/unwrap_iter.h>
1992 #include <__algorithm/upper_bound.h>
1994 // standard-mandated includes
1997 #include <initializer_list>
1999 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2000 # pragma GCC system_header
2003 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2006 # include <concepts>
2009 # include <iterator>
2011 # include <stdexcept>
2012 # include <type_traits>
2016 #endif // _LIBCPP_ALGORITHM