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 <__cxx03/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<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>
106 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
107 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23
109 template<forward_range R, class T, class Proj = identity>
111 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
112 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23
114 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
115 indirect_unary_predicate<projected<I, Proj>> Pred>
116 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23
118 template<forward_range R, class Proj = identity,
119 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
120 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23
122 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
123 indirect_unary_predicate<projected<I, Proj>> Pred>
124 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23
126 template<forward_range R, class Proj = identity,
127 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
128 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23
130 template<class T, class Proj = identity,
131 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
132 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
134 template<copyable T, class Proj = identity,
135 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
136 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
138 template<input_range R, class Proj = identity,
139 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
140 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
141 constexpr range_value_t<R>
142 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
144 template<class T, class Proj = identity,
145 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
146 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
148 template<copyable T, class Proj = identity,
149 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
150 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
152 template<input_range R, class Proj = identity,
153 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
154 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
155 constexpr range_value_t<R>
156 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
158 template<class I, class O>
159 using unary_transform_result = in_out_result<I, O>; // since C++20
161 template<class I1, class I2, class O>
162 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
164 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
165 copy_constructible F, class Proj = identity>
166 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
167 constexpr ranges::unary_transform_result<I, O>
168 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
170 template<input_range R, weakly_incrementable O, copy_constructible F,
171 class Proj = identity>
172 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
173 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
174 transform(R&& r, O result, F op, Proj proj = {}); // since C++20
176 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
177 weakly_incrementable O, copy_constructible F, class Proj1 = identity,
178 class Proj2 = identity>
179 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
180 projected<I2, Proj2>>>
181 constexpr ranges::binary_transform_result<I1, I2, O>
182 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
183 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
185 template<input_range R1, input_range R2, weakly_incrementable O,
186 copy_constructible F, class Proj1 = identity, class Proj2 = identity>
187 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
188 projected<iterator_t<R2>, Proj2>>>
189 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
190 transform(R1&& r1, R2&& r2, O result,
191 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
193 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
194 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
195 constexpr iter_difference_t<I>
196 count(I first, S last, const T& value, Proj proj = {}); // since C++20
198 template<input_range R, class T, class Proj = identity>
199 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
200 constexpr range_difference_t<R>
201 count(R&& r, const T& value, Proj proj = {}); // since C++20
203 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
204 indirect_unary_predicate<projected<I, Proj>> Pred>
205 constexpr iter_difference_t<I>
206 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
208 template<input_range R, class Proj = identity,
209 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
210 constexpr range_difference_t<R>
211 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
214 using minmax_result = min_max_result<T>;
216 template<class T, class Proj = identity,
217 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
218 constexpr ranges::minmax_result<const T&>
219 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
221 template<copyable T, class Proj = identity,
222 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
223 constexpr ranges::minmax_result<T>
224 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
226 template<input_range R, class Proj = identity,
227 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
228 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
229 constexpr ranges::minmax_result<range_value_t<R>>
230 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
233 using minmax_element_result = min_max_result<I>;
235 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
236 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
237 constexpr ranges::minmax_element_result<I>
238 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
240 template<forward_range R, class Proj = identity,
241 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
242 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
243 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
245 template<forward_iterator I1, sentinel_for<I1> S1,
246 forward_iterator I2, sentinel_for<I2> S2,
247 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
248 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
249 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
250 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
252 template<forward_range R1, forward_range R2,
253 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
254 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
255 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
256 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
258 template<class I, class O>
259 using copy_result = in_out_result<I, O>; // since C++20
261 template<class I, class O>
262 using copy_n_result = in_out_result<I, O>; // since C++20
264 template<class I, class O>
265 using copy_if_result = in_out_result<I, O>; // since C++20
267 template<class I1, class I2>
268 using copy_backward_result = in_out_result<I1, I2>; // since C++20
270 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
271 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
272 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23
274 template<input_range R, class T, class Proj = identity>
275 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
276 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23
278 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
279 requires indirectly_copyable<I, O>
280 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
282 template<input_range R, weakly_incrementable O>
283 requires indirectly_copyable<iterator_t<R>, O>
284 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
286 template<input_iterator I, weakly_incrementable O>
287 requires indirectly_copyable<I, O>
288 constexpr ranges::copy_n_result<I, O>
289 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
291 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
292 indirect_unary_predicate<projected<I, Proj>> Pred>
293 requires indirectly_copyable<I, O>
294 constexpr ranges::copy_if_result<I, O>
295 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
297 template<input_range R, weakly_incrementable O, class Proj = identity,
298 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
299 requires indirectly_copyable<iterator_t<R>, O>
300 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
301 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
303 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
304 requires indirectly_copyable<I1, I2>
305 constexpr ranges::copy_backward_result<I1, I2>
306 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
308 template<bidirectional_range R, bidirectional_iterator I>
309 requires indirectly_copyable<iterator_t<R>, I>
310 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
311 ranges::copy_backward(R&& r, I result); // since C++20
313 template<class I, class F>
314 using for_each_result = in_fun_result<I, F>; // since C++20
316 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
317 indirectly_unary_invocable<projected<I, Proj>> Fun>
318 constexpr ranges::for_each_result<I, Fun>
319 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
321 template<input_range R, class Proj = identity,
322 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
323 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
324 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
326 template<input_iterator I, class Proj = identity,
327 indirectly_unary_invocable<projected<I, Proj>> Fun>
328 constexpr ranges::for_each_n_result<I, Fun>
329 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
331 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
332 indirect_unary_predicate<projected<I, Proj>> Pred>
333 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
335 template<input_range R, class Proj = identity,
336 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
337 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
339 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
340 class Proj = identity>
341 requires sortable<I, Comp, Proj>
343 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
345 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
346 requires sortable<iterator_t<R>, Comp, Proj>
347 constexpr borrowed_iterator_t<R>
348 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
350 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
351 class Proj = identity>
352 requires sortable<I, Comp, Proj>
354 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
356 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
357 requires sortable<iterator_t<R>, Comp, Proj>
358 constexpr borrowed_iterator_t<R>
359 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
361 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
362 class Proj = identity>
363 requires sortable<I, Comp, Proj>
365 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
367 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
368 requires sortable<iterator_t<R>, Comp, Proj>
369 constexpr borrowed_iterator_t<R>
370 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
372 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
373 class Proj = identity>
374 requires sortable<I, Comp, Proj>
376 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
378 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
379 requires sortable<iterator_t<R>, Comp, Proj>
380 constexpr borrowed_iterator_t<R>
381 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
383 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
384 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
385 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
387 template<random_access_range R, class Proj = identity,
388 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
389 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
391 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
392 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
393 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
395 template<random_access_range R, class Proj = identity,
396 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
397 constexpr borrowed_iterator_t<R>
398 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
400 template<bidirectional_iterator I, sentinel_for<I> S>
401 requires permutable<I>
402 constexpr I ranges::reverse(I first, S last); // since C++20
404 template<bidirectional_range R>
405 requires permutable<iterator_t<R>>
406 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
408 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
409 class Proj = identity>
410 requires sortable<I, Comp, Proj>
412 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
414 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
415 requires sortable<iterator_t<R>, Comp, Proj>
416 constexpr borrowed_iterator_t<R>
417 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
419 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
420 class Proj = identity>
421 requires sortable<I, Comp, Proj>
422 I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
424 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
425 requires sortable<iterator_t<R>, Comp, Proj>
426 borrowed_iterator_t<R>
427 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
429 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
430 class Proj = identity>
431 requires sortable<I, Comp, Proj>
433 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
435 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
436 requires sortable<iterator_t<R>, Comp, Proj>
437 constexpr borrowed_iterator_t<R>
438 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
440 template<class T, output_iterator<const T&> O, sentinel_for<O> S>
441 constexpr O ranges::fill(O first, S last, const T& value); // since C++20
443 template<class T, output_range<const T&> R>
444 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
446 template<class T, output_iterator<const T&> O>
447 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
449 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
450 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
451 constexpr O generate(O first, S last, F gen); // since C++20
453 template<class ExecutionPolicy, class ForwardIterator, class Generator>
454 void generate(ExecutionPolicy&& exec,
455 ForwardIterator first, ForwardIterator last,
456 Generator gen); // since C++17
458 template<class R, copy_constructible F>
459 requires invocable<F&> && output_range<R, invoke_result_t<F&>>
460 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20
462 template<input_or_output_iterator O, copy_constructible F>
463 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
464 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20
466 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
467 ForwardIterator generate_n(ExecutionPolicy&& exec,
468 ForwardIterator first, Size n, Generator gen); // since C++17
470 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
471 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
472 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
473 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
475 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
477 template<input_range R1, input_range R2, class Pred = ranges::equal_to,
478 class Proj1 = identity, class Proj2 = identity>
479 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
480 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
481 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
483 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
484 indirect_unary_predicate<projected<I, Proj>> Pred>
485 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
487 template<input_range R, class Proj = identity,
488 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
489 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
491 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
492 indirect_unary_predicate<projected<I, Proj>> Pred>
493 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
495 template<input_range R, class Proj = identity,
496 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
497 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
499 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
500 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
501 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
502 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
503 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
504 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
505 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
507 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
508 class Proj2 = identity>
509 requires (forward_range<R1> || sized_range<R1>) &&
510 (forward_range<R2> || sized_range<R2>) &&
511 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
512 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},
513 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
515 template<input_iterator I, sentinel_for<I> S, class Proj = identity,
516 indirect_unary_predicate<projected<I, Proj>> Pred>
517 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
519 template<input_range R, class Proj = identity,
520 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
521 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
523 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
524 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
525 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
526 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
527 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
529 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
530 class Proj2 = identity>
531 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
532 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},
533 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23
535 template<input_iterator I1, sentinel_for<I1> S1,
536 random_access_iterator I2, sentinel_for<I2> S2,
537 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
538 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
539 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
540 constexpr partial_sort_copy_result<I1, I2>
541 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
542 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
544 template<input_range R1, random_access_range R2, class Comp = ranges::less,
545 class Proj1 = identity, class Proj2 = identity>
546 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
547 sortable<iterator_t<R2>, Comp, Proj2> &&
548 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
549 projected<iterator_t<R2>, Proj2>>
550 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
551 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
552 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
554 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
555 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
556 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
558 template<forward_range R, class Proj = identity,
559 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
560 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
562 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
563 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
564 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
566 template<forward_range R, class Proj = identity,
567 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
568 constexpr borrowed_iterator_t<R>
569 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
571 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
572 class Proj = identity>
573 requires sortable<I, Comp, Proj>
575 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
577 template<random_access_range R, class Comp = ranges::less, class Proj = identity>
578 requires sortable<iterator_t<R>, Comp, Proj>
579 constexpr borrowed_iterator_t<R>
580 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
582 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
583 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20
584 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
586 template<forward_range R, class T, class Proj = identity,
587 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
589 constexpr borrowed_iterator_t<R>
590 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
592 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
593 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
594 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
595 Proj proj = {}); // since C++20
596 template<forward_range R, class T, class Proj = identity,
597 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
599 constexpr borrowed_iterator_t<R>
600 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
602 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
603 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
604 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
605 Proj proj = {}); // since C++20
607 template<forward_range R, class T, class Proj = identity,
608 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
610 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
611 Proj proj = {}); // since C++20
613 template<permutable I, sentinel_for<I> S, class Proj = identity,
614 indirect_unary_predicate<projected<I, Proj>> Pred>
615 constexpr subrange<I>
616 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
618 template<forward_range R, class Proj = identity,
619 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
620 requires permutable<iterator_t<R>>
621 constexpr borrowed_subrange_t<R>
622 partition(R&& r, Pred pred, Proj proj = {}); // since C++20
624 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
625 indirect_unary_predicate<projected<I, Proj>> Pred>
626 requires permutable<I>
627 subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20
629 template<bidirectional_range R, class Proj = identity,
630 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
631 requires permutable<iterator_t<R>>
632 borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20
634 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
635 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
636 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
637 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
639 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
641 template<input_range R1, forward_range R2,
642 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
643 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
644 constexpr borrowed_iterator_t<R1>
645 ranges::find_first_of(R1&& r1, R2&& r2,
647 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
649 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
650 indirect_binary_predicate<projected<I, Proj>,
651 projected<I, Proj>> Pred = ranges::equal_to>
652 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20
654 template<forward_range R, class Proj = identity,
655 indirect_binary_predicate<projected<iterator_t<R>, Proj>,
656 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
657 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
659 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
660 requires indirectly_writable<I, const T2&> &&
661 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
663 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
665 template<input_range R, class T1, class T2, class Proj = identity>
666 requires indirectly_writable<iterator_t<R>, const T2&> &&
667 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
668 constexpr borrowed_iterator_t<R>
669 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
671 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
672 indirect_unary_predicate<projected<I, Proj>> Pred>
673 requires indirectly_writable<I, const T&>
674 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
676 template<input_range R, class T, class Proj = identity,
677 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
678 requires indirectly_writable<iterator_t<R>, const T&>
679 constexpr borrowed_iterator_t<R>
680 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
682 template<class T, class Proj = identity,
683 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
685 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
687 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
688 class Proj1 = identity, class Proj2 = identity,
689 indirect_strict_weak_order<projected<I1, Proj1>,
690 projected<I2, Proj2>> Comp = ranges::less>
692 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
693 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
695 template<input_range R1, input_range R2, class Proj1 = identity,
696 class Proj2 = identity,
697 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
698 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
700 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
701 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
703 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
704 requires indirectly_movable<I1, I2>
705 constexpr ranges::move_backward_result<I1, I2>
706 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
708 template<bidirectional_range R, bidirectional_iterator I>
709 requires indirectly_movable<iterator_t<R>, I>
710 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
711 ranges::move_backward(R&& r, I result); // since C++20
713 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
714 requires indirectly_movable<I, O>
715 constexpr ranges::move_result<I, O>
716 ranges::move(I first, S last, O result); // since C++20
718 template<input_range R, weakly_incrementable O>
719 requires indirectly_movable<iterator_t<R>, O>
720 constexpr ranges::move_result<borrowed_iterator_t<R>, O>
721 ranges::move(R&& r, O result); // since C++20
723 template<class I, class O1, class O2>
724 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
726 template<input_iterator I, sentinel_for<I> S,
727 weakly_incrementable O1, weakly_incrementable O2,
728 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
729 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
730 constexpr partition_copy_result<I, O1, O2>
731 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
732 Proj proj = {}); // since C++20
734 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
735 class Proj = identity,
736 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
737 requires indirectly_copyable<iterator_t<R>, O1> &&
738 indirectly_copyable<iterator_t<R>, O2>
739 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
740 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20
742 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
743 indirect_unary_predicate<projected<I, Proj>> Pred>
744 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20
746 template<forward_range R, class Proj = identity,
747 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
748 constexpr borrowed_iterator_t<R>
749 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20
751 template<class I1, class I2, class O>
752 using merge_result = in_in_out_result<I1, I2, 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, class Proj1 = identity,
756 class Proj2 = identity>
757 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
758 constexpr merge_result<I1, I2, O>
759 merge(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, class Comp = ranges::less,
763 class Proj1 = identity, class Proj2 = identity>
764 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
765 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
766 merge(R1&& r1, R2&& r2, O result,
767 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
769 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
770 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
771 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
773 template<forward_range R, class T, class Proj = identity>
774 requires permutable<iterator_t<R>> &&
775 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
776 constexpr borrowed_subrange_t<R>
777 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
779 template<permutable I, sentinel_for<I> S, class Proj = identity,
780 indirect_unary_predicate<projected<I, Proj>> Pred>
781 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
783 template<forward_range R, class Proj = identity,
784 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
785 requires permutable<iterator_t<R>>
786 constexpr borrowed_subrange_t<R>
787 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
789 template<class I, class O>
790 using set_difference_result = in_out_result<I, O>; // since C++20
792 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
793 weakly_incrementable O, class Comp = ranges::less,
794 class Proj1 = identity, class Proj2 = identity>
795 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
796 constexpr set_difference_result<I1, O>
797 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
798 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
800 template<input_range R1, input_range R2, weakly_incrementable O,
801 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
802 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
803 constexpr set_difference_result<borrowed_iterator_t<R1>, O>
804 set_difference(R1&& r1, R2&& r2, O result,
805 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
807 template<class I1, class I2, class O>
808 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
810 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
811 weakly_incrementable O, class Comp = ranges::less,
812 class Proj1 = identity, class Proj2 = identity>
813 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
814 constexpr set_intersection_result<I1, I2, O>
815 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
816 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
818 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
819 weakly_incrementable O, class Comp = ranges::less,
820 class Proj1 = identity, class Proj2 = identity>
821 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
822 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
823 set_intersection(R1&& r1, R2&& r2, O result,
824 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
826 template <class _InIter, class _OutIter>
827 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
829 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
830 requires indirectly_copyable<I, O>
831 constexpr ranges::reverse_copy_result<I, O>
832 ranges::reverse_copy(I first, S last, O result); // since C++20
834 template<bidirectional_range R, weakly_incrementable O>
835 requires indirectly_copyable<iterator_t<R>, O>
836 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
837 ranges::reverse_copy(R&& r, O result); // since C++20
839 template<permutable I, sentinel_for<I> S>
840 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
842 template<forward_range R>
843 requires permutable<iterator_t<R>>
844 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20
846 template <class _InIter, class _OutIter>
847 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
849 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
850 requires indirectly_copyable<I, O>
851 constexpr ranges::rotate_copy_result<I, O>
852 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
854 template<forward_range R, weakly_incrementable O>
855 requires indirectly_copyable<iterator_t<R>, O>
856 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
857 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
859 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
860 requires (forward_iterator<I> || random_access_iterator<O>) &&
861 indirectly_copyable<I, O> &&
862 uniform_random_bit_generator<remove_reference_t<Gen>>
863 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20
865 template<input_range R, weakly_incrementable O, class Gen>
866 requires (forward_range<R> || random_access_iterator<O>) &&
867 indirectly_copyable<iterator_t<R>, O> &&
868 uniform_random_bit_generator<remove_reference_t<Gen>>
869 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
871 template<random_access_iterator I, sentinel_for<I> S, class Gen>
872 requires permutable<I> &&
873 uniform_random_bit_generator<remove_reference_t<Gen>>
874 I shuffle(I first, S last, Gen&& g); // since C++20
876 template<random_access_range R, class Gen>
877 requires permutable<iterator_t<R>> &&
878 uniform_random_bit_generator<remove_reference_t<Gen>>
879 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20
881 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
882 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
883 indirect_equivalence_relation<projected<I1, Proj1>,
884 projected<I2, Proj2>> Pred = ranges::equal_to>
885 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
887 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
889 template<forward_range R1, forward_range R2,
890 class Proj1 = identity, class Proj2 = identity,
891 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
892 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
893 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
894 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
896 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
897 sentinel_for<I2> S2, class Pred = ranges::equal_to,
898 class Proj1 = identity, class Proj2 = identity>
899 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
900 constexpr subrange<I1>
901 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
902 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
904 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
905 class Proj1 = identity, class Proj2 = identity>
906 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
907 constexpr borrowed_subrange_t<R1>
908 ranges::search(R1&& r1, R2&& r2, Pred pred = {},
909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
911 template<forward_iterator I, sentinel_for<I> S, class T,
912 class Pred = ranges::equal_to, class Proj = identity>
913 requires indirectly_comparable<I, const T*, Pred, Proj>
914 constexpr subrange<I>
915 ranges::search_n(I first, S last, iter_difference_t<I> count,
916 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
918 template<forward_range R, class T, class Pred = ranges::equal_to,
919 class Proj = identity>
920 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
921 constexpr borrowed_subrange_t<R>
922 ranges::search_n(R&& r, range_difference_t<R> count,
923 const T& value, Pred pred = {}, Proj proj = {}); // since C++20
925 template<input_iterator I, sentinel_for<I> S, class T,
926 indirectly-binary-left-foldable<T, I> F>
927 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23
929 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
930 constexpr auto fold_left(R&& r, T init, F f); // since C++23
932 template<class I, class T>
933 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
935 template<input_iterator I, sentinel_for<I> S, class T,
936 indirectly-binary-left-foldable<T, I> F>
937 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23
939 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
940 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
942 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
943 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
944 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
945 constexpr subrange<I1>
946 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
947 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
949 template<forward_range R1, forward_range R2,
950 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
951 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
952 constexpr borrowed_subrange_t<R1>
953 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
954 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
956 template<class I1, class I2, class O>
957 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
959 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
960 weakly_incrementable O, class Comp = ranges::less,
961 class Proj1 = identity, class Proj2 = identity>
962 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
963 constexpr set_symmetric_difference_result<I1, I2, O>
964 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
965 Comp comp = {}, Proj1 proj1 = {},
966 Proj2 proj2 = {}); // since C++20
968 template<input_range R1, input_range R2, weakly_incrementable O,
969 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
970 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
971 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
972 borrowed_iterator_t<R2>, O>
973 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
974 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
976 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
977 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
978 constexpr subrange<I>
979 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
981 template<forward_range R, class T, class Proj = identity,
982 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
984 constexpr borrowed_subrange_t<R>
985 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
987 template<class I1, class I2, class O>
988 using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
990 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
991 weakly_incrementable O, class Comp = ranges::less,
992 class Proj1 = identity, class Proj2 = identity>
993 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
994 constexpr set_union_result<I1, I2, O>
995 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
996 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
998 template<input_range R1, input_range R2, weakly_incrementable O,
999 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
1000 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
1001 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
1002 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
1003 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1005 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
1006 class Proj1 = identity, class Proj2 = identity,
1007 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
1009 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
1010 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1012 template<input_range R1, input_range R2, class Proj1 = identity,
1013 class Proj2 = identity,
1014 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
1015 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
1016 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
1017 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
1019 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1020 class Proj = identity>
1021 requires sortable<I, Comp, Proj>
1022 I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
1024 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
1025 requires sortable<iterator_t<R>, Comp, Proj>
1026 borrowed_iterator_t<R>
1027 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
1028 Proj proj = {}); // since C++20
1030 template<permutable I, sentinel_for<I> S, class Proj = identity,
1031 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1032 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20
1034 template<forward_range R, class Proj = identity,
1035 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1036 requires permutable<iterator_t<R>>
1037 constexpr borrowed_subrange_t<R>
1038 unique(R&& r, C comp = {}, Proj proj = {}); // since C++20
1040 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
1041 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
1042 requires indirectly_copyable<I, O> &&
1043 (forward_iterator<I> ||
1044 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
1045 indirectly_copyable_storable<I, O>)
1046 constexpr unique_copy_result<I, O>
1047 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20
1049 template<input_range R, weakly_incrementable O, class Proj = identity,
1050 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
1051 requires indirectly_copyable<iterator_t<R>, O> &&
1052 (forward_iterator<iterator_t<R>> ||
1053 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
1054 indirectly_copyable_storable<iterator_t<R>, O>)
1055 constexpr unique_copy_result<borrowed_iterator_t<R>, O>
1056 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20
1058 template<class I, class O>
1059 using remove_copy_result = in_out_result<I, O>; // since C++20
1061 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
1062 class Proj = identity>
1063 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
1064 constexpr remove_copy_result<I, O>
1065 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20
1067 template<input_range R, weakly_incrementable O, class T, class Proj = identity>
1068 requires indirectly_copyable<iterator_t<R>, O> &&
1069 indirect_binary_predicate<ranges::equal_to,
1070 projected<iterator_t<R>, Proj>, const T*>
1071 constexpr remove_copy_result<borrowed_iterator_t<R>, O>
1072 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20
1074 template<class I, class O>
1075 using remove_copy_if_result = in_out_result<I, O>; // since C++20
1077 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
1078 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1079 requires indirectly_copyable<I, O>
1080 constexpr remove_copy_if_result<I, O>
1081 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
1083 template<input_range R, weakly_incrementable O, class Proj = identity,
1084 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1085 requires indirectly_copyable<iterator_t<R>, O>
1086 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
1087 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
1089 template<class I, class O>
1090 using replace_copy_result = in_out_result<I, O>; // since C++20
1092 template<input_iterator I, sentinel_for<I> S, class T1, class T2,
1093 output_iterator<const T2&> O, class Proj = identity>
1094 requires indirectly_copyable<I, O> &&
1095 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
1096 constexpr replace_copy_result<I, O>
1097 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
1098 Proj proj = {}); // since C++20
1100 template<input_range R, class T1, class T2, output_iterator<const T2&> O,
1101 class Proj = identity>
1102 requires indirectly_copyable<iterator_t<R>, O> &&
1103 indirect_binary_predicate<ranges::equal_to,
1104 projected<iterator_t<R>, Proj>, const T1*>
1105 constexpr replace_copy_result<borrowed_iterator_t<R>, O>
1106 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
1107 Proj proj = {}); // since C++20
1109 template<class I, class O>
1110 using replace_copy_if_result = in_out_result<I, O>; // since C++20
1112 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
1113 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
1114 requires indirectly_copyable<I, O>
1115 constexpr replace_copy_if_result<I, O>
1116 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
1117 Proj proj = {}); // since C++20
1119 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
1120 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
1121 requires indirectly_copyable<iterator_t<R>, O>
1122 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
1123 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
1124 Proj proj = {}); // since C++20
1127 using prev_permutation_result = in_found_result<I>; // since C++20
1129 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1130 class Proj = identity>
1131 requires sortable<I, Comp, Proj>
1132 constexpr ranges::prev_permutation_result<I>
1133 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1135 template<bidirectional_range R, class Comp = ranges::less,
1136 class Proj = identity>
1137 requires sortable<iterator_t<R>, Comp, Proj>
1138 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
1139 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1142 using next_permutation_result = in_found_result<I>; // since C++20
1144 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
1145 class Proj = identity>
1146 requires sortable<I, Comp, Proj>
1147 constexpr ranges::next_permutation_result<I>
1148 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
1150 template<bidirectional_range R, class Comp = ranges::less,
1151 class Proj = identity>
1152 requires sortable<iterator_t<R>, Comp, Proj>
1153 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
1154 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
1158 template <class InputIterator, class Predicate>
1159 constexpr bool // constexpr in C++20
1160 all_of(InputIterator first, InputIterator last, Predicate pred);
1162 template <class InputIterator, class Predicate>
1163 constexpr bool // constexpr in C++20
1164 any_of(InputIterator first, InputIterator last, Predicate pred);
1166 template <class InputIterator, class Predicate>
1167 constexpr bool // constexpr in C++20
1168 none_of(InputIterator first, InputIterator last, Predicate pred);
1170 template <class InputIterator, class Function>
1171 constexpr Function // constexpr in C++20
1172 for_each(InputIterator first, InputIterator last, Function f);
1174 template<class InputIterator, class Size, class Function>
1175 constexpr InputIterator // constexpr in C++20
1176 for_each_n(InputIterator first, Size n, Function f); // C++17
1178 template <class InputIterator, class T>
1179 constexpr InputIterator // constexpr in C++20
1180 find(InputIterator first, InputIterator last, const T& value);
1182 template <class InputIterator, class Predicate>
1183 constexpr InputIterator // constexpr in C++20
1184 find_if(InputIterator first, InputIterator last, Predicate pred);
1186 template<class InputIterator, class Predicate>
1187 constexpr InputIterator // constexpr in C++20
1188 find_if_not(InputIterator first, InputIterator last, Predicate pred);
1190 template <class ForwardIterator1, class ForwardIterator2>
1191 constexpr ForwardIterator1 // constexpr in C++20
1192 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1193 ForwardIterator2 first2, ForwardIterator2 last2);
1195 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1196 constexpr ForwardIterator1 // constexpr in C++20
1197 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
1198 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1200 template <class ForwardIterator1, class ForwardIterator2>
1201 constexpr ForwardIterator1 // constexpr in C++20
1202 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1203 ForwardIterator2 first2, ForwardIterator2 last2);
1205 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1206 constexpr ForwardIterator1 // constexpr in C++20
1207 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
1208 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1210 template <class ForwardIterator>
1211 constexpr ForwardIterator // constexpr in C++20
1212 adjacent_find(ForwardIterator first, ForwardIterator last);
1214 template <class ForwardIterator, class BinaryPredicate>
1215 constexpr ForwardIterator // constexpr in C++20
1216 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1218 template <class InputIterator, class T>
1219 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1220 count(InputIterator first, InputIterator last, const T& value);
1222 template <class InputIterator, class Predicate>
1223 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
1224 count_if(InputIterator first, InputIterator last, Predicate pred);
1226 template <class InputIterator1, class InputIterator2>
1227 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1228 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1230 template <class InputIterator1, class InputIterator2>
1231 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1232 mismatch(InputIterator1 first1, InputIterator1 last1,
1233 InputIterator2 first2, InputIterator2 last2); // **C++14**
1235 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1236 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1237 mismatch(InputIterator1 first1, InputIterator1 last1,
1238 InputIterator2 first2, BinaryPredicate pred);
1240 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1241 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
1242 mismatch(InputIterator1 first1, InputIterator1 last1,
1243 InputIterator2 first2, InputIterator2 last2,
1244 BinaryPredicate pred); // **C++14**
1246 template <class InputIterator1, class InputIterator2>
1247 constexpr bool // constexpr in C++20
1248 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
1250 template <class InputIterator1, class InputIterator2>
1251 constexpr bool // constexpr in C++20
1252 equal(InputIterator1 first1, InputIterator1 last1,
1253 InputIterator2 first2, InputIterator2 last2); // **C++14**
1255 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1256 constexpr bool // constexpr in C++20
1257 equal(InputIterator1 first1, InputIterator1 last1,
1258 InputIterator2 first2, BinaryPredicate pred);
1260 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
1261 constexpr bool // constexpr in C++20
1262 equal(InputIterator1 first1, InputIterator1 last1,
1263 InputIterator2 first2, InputIterator2 last2,
1264 BinaryPredicate pred); // **C++14**
1266 template<class ForwardIterator1, class ForwardIterator2>
1267 constexpr bool // constexpr in C++20
1268 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1269 ForwardIterator2 first2);
1271 template<class ForwardIterator1, class ForwardIterator2>
1272 constexpr bool // constexpr in C++20
1273 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1274 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
1276 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1277 constexpr bool // constexpr in C++20
1278 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1279 ForwardIterator2 first2, BinaryPredicate pred);
1281 template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1282 constexpr bool // constexpr in C++20
1283 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
1284 ForwardIterator2 first2, ForwardIterator2 last2,
1285 BinaryPredicate pred); // **C++14**
1287 template <class ForwardIterator1, class ForwardIterator2>
1288 constexpr ForwardIterator1 // constexpr in C++20
1289 search(ForwardIterator1 first1, ForwardIterator1 last1,
1290 ForwardIterator2 first2, ForwardIterator2 last2);
1292 template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
1293 constexpr ForwardIterator1 // constexpr in C++20
1294 search(ForwardIterator1 first1, ForwardIterator1 last1,
1295 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
1297 template <class ForwardIterator, class Size, class T>
1298 constexpr ForwardIterator // constexpr in C++20
1299 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
1301 template <class ForwardIterator, class Size, class T, class BinaryPredicate>
1302 constexpr ForwardIterator // constexpr in C++20
1303 search_n(ForwardIterator first, ForwardIterator last,
1304 Size count, const T& value, BinaryPredicate pred);
1306 template <class InputIterator, class OutputIterator>
1307 constexpr OutputIterator // constexpr in C++20
1308 copy(InputIterator first, InputIterator last, OutputIterator result);
1310 template<class InputIterator, class OutputIterator, class Predicate>
1311 constexpr OutputIterator // constexpr in C++20
1312 copy_if(InputIterator first, InputIterator last,
1313 OutputIterator result, Predicate pred);
1315 template<class InputIterator, class Size, class OutputIterator>
1316 constexpr OutputIterator // constexpr in C++20
1317 copy_n(InputIterator first, Size n, OutputIterator result);
1319 template <class BidirectionalIterator1, class BidirectionalIterator2>
1320 constexpr BidirectionalIterator2 // constexpr in C++20
1321 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1322 BidirectionalIterator2 result);
1325 template<class InputIterator, class OutputIterator>
1326 constexpr OutputIterator move(InputIterator first, InputIterator last,
1327 OutputIterator result);
1329 template<class BidirectionalIterator1, class BidirectionalIterator2>
1330 constexpr BidirectionalIterator2
1331 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
1332 BidirectionalIterator2 result);
1334 template <class ForwardIterator1, class ForwardIterator2>
1335 constexpr ForwardIterator2 // constexpr in C++20
1336 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
1339 template<class I1, class I2>
1340 using swap_ranges_result = in_in_result<I1, I2>;
1342 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
1343 requires indirectly_swappable<I1, I2>
1344 constexpr ranges::swap_ranges_result<I1, I2>
1345 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
1347 template<input_range R1, input_range R2>
1348 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
1349 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
1350 swap_ranges(R1&& r1, R2&& r2);
1353 template <class ForwardIterator1, class ForwardIterator2>
1354 constexpr void // constexpr in C++20
1355 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
1357 template <class InputIterator, class OutputIterator, class UnaryOperation>
1358 constexpr OutputIterator // constexpr in C++20
1359 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
1361 template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
1362 constexpr OutputIterator // constexpr in C++20
1363 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
1364 OutputIterator result, BinaryOperation binary_op);
1366 template <class ForwardIterator, class T>
1367 constexpr void // constexpr in C++20
1368 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
1370 template <class ForwardIterator, class Predicate, class T>
1371 constexpr void // constexpr in C++20
1372 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
1374 template <class InputIterator, class OutputIterator, class T>
1375 constexpr OutputIterator // constexpr in C++20
1376 replace_copy(InputIterator first, InputIterator last, OutputIterator result,
1377 const T& old_value, const T& new_value);
1379 template <class InputIterator, class OutputIterator, class Predicate, class T>
1380 constexpr OutputIterator // constexpr in C++20
1381 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
1383 template <class ForwardIterator, class T>
1384 constexpr void // constexpr in C++20
1385 fill(ForwardIterator first, ForwardIterator last, const T& value);
1387 template <class OutputIterator, class Size, class T>
1388 constexpr OutputIterator // constexpr in C++20
1389 fill_n(OutputIterator first, Size n, const T& value);
1391 template <class ForwardIterator, class Generator>
1392 constexpr void // constexpr in C++20
1393 generate(ForwardIterator first, ForwardIterator last, Generator gen);
1395 template <class OutputIterator, class Size, class Generator>
1396 constexpr OutputIterator // constexpr in C++20
1397 generate_n(OutputIterator first, Size n, Generator gen);
1399 template <class ForwardIterator, class T>
1400 constexpr ForwardIterator // constexpr in C++20
1401 remove(ForwardIterator first, ForwardIterator last, const T& value);
1403 template <class ForwardIterator, class Predicate>
1404 constexpr ForwardIterator // constexpr in C++20
1405 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
1407 template <class InputIterator, class OutputIterator, class T>
1408 constexpr OutputIterator // constexpr in C++20
1409 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
1411 template <class InputIterator, class OutputIterator, class Predicate>
1412 constexpr OutputIterator // constexpr in C++20
1413 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
1415 template <class ForwardIterator>
1416 constexpr ForwardIterator // constexpr in C++20
1417 unique(ForwardIterator first, ForwardIterator last);
1419 template <class ForwardIterator, class BinaryPredicate>
1420 constexpr ForwardIterator // constexpr in C++20
1421 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
1423 template <class InputIterator, class OutputIterator>
1424 constexpr OutputIterator // constexpr in C++20
1425 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
1427 template <class InputIterator, class OutputIterator, class BinaryPredicate>
1428 constexpr OutputIterator // constexpr in C++20
1429 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
1431 template <class BidirectionalIterator>
1432 constexpr void // constexpr in C++20
1433 reverse(BidirectionalIterator first, BidirectionalIterator last);
1435 template <class BidirectionalIterator, class OutputIterator>
1436 constexpr OutputIterator // constexpr in C++20
1437 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
1439 template <class ForwardIterator>
1440 constexpr ForwardIterator // constexpr in C++20
1441 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
1443 template <class ForwardIterator, class OutputIterator>
1444 constexpr OutputIterator // constexpr in C++20
1445 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
1447 template <class RandomAccessIterator>
1449 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
1451 template <class RandomAccessIterator, class RandomNumberGenerator>
1453 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
1454 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
1456 template<class PopulationIterator, class SampleIterator,
1457 class Distance, class UniformRandomBitGenerator>
1458 SampleIterator sample(PopulationIterator first, PopulationIterator last,
1459 SampleIterator out, Distance n,
1460 UniformRandomBitGenerator&& g); // C++17
1462 template<class RandomAccessIterator, class UniformRandomNumberGenerator>
1463 void shuffle(RandomAccessIterator first, RandomAccessIterator last,
1464 UniformRandomNumberGenerator&& g);
1466 template<class ForwardIterator>
1467 constexpr ForwardIterator
1468 shift_left(ForwardIterator first, ForwardIterator last,
1469 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1471 template<class ForwardIterator>
1472 constexpr ForwardIterator
1473 shift_right(ForwardIterator first, ForwardIterator last,
1474 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
1476 template <class InputIterator, class Predicate>
1477 constexpr bool // constexpr in C++20
1478 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
1480 template <class ForwardIterator, class Predicate>
1481 constexpr ForwardIterator // constexpr in C++20
1482 partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1484 template <class InputIterator, class OutputIterator1,
1485 class OutputIterator2, class Predicate>
1486 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
1487 partition_copy(InputIterator first, InputIterator last,
1488 OutputIterator1 out_true, OutputIterator2 out_false,
1491 template <class ForwardIterator, class Predicate>
1493 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
1495 template<class ForwardIterator, class Predicate>
1496 constexpr ForwardIterator // constexpr in C++20
1497 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
1499 template <class ForwardIterator>
1500 constexpr bool // constexpr in C++20
1501 is_sorted(ForwardIterator first, ForwardIterator last);
1503 template <class ForwardIterator, class Compare>
1504 constexpr bool // constexpr in C++20
1505 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
1507 template<class ForwardIterator>
1508 constexpr ForwardIterator // constexpr in C++20
1509 is_sorted_until(ForwardIterator first, ForwardIterator last);
1511 template <class ForwardIterator, class Compare>
1512 constexpr ForwardIterator // constexpr in C++20
1513 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
1515 template <class RandomAccessIterator>
1516 constexpr void // constexpr in C++20
1517 sort(RandomAccessIterator first, RandomAccessIterator last);
1519 template <class RandomAccessIterator, class Compare>
1520 constexpr void // constexpr in C++20
1521 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1523 template <class RandomAccessIterator>
1525 stable_sort(RandomAccessIterator first, RandomAccessIterator last);
1527 template <class RandomAccessIterator, class Compare>
1529 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1531 template <class RandomAccessIterator>
1532 constexpr void // constexpr in C++20
1533 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
1535 template <class RandomAccessIterator, class Compare>
1536 constexpr void // constexpr in C++20
1537 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
1539 template <class InputIterator, class RandomAccessIterator>
1540 constexpr RandomAccessIterator // constexpr in C++20
1541 partial_sort_copy(InputIterator first, InputIterator last,
1542 RandomAccessIterator result_first, RandomAccessIterator result_last);
1544 template <class InputIterator, class RandomAccessIterator, class Compare>
1545 constexpr RandomAccessIterator // constexpr in C++20
1546 partial_sort_copy(InputIterator first, InputIterator last,
1547 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
1549 template <class RandomAccessIterator>
1550 constexpr void // constexpr in C++20
1551 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
1553 template <class RandomAccessIterator, class Compare>
1554 constexpr void // constexpr in C++20
1555 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
1557 template <class ForwardIterator, class T>
1558 constexpr ForwardIterator // constexpr in C++20
1559 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
1561 template <class ForwardIterator, class T, class Compare>
1562 constexpr ForwardIterator // constexpr in C++20
1563 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1565 template <class ForwardIterator, class T>
1566 constexpr ForwardIterator // constexpr in C++20
1567 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
1569 template <class ForwardIterator, class T, class Compare>
1570 constexpr ForwardIterator // constexpr in C++20
1571 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1573 template <class ForwardIterator, class T>
1574 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1575 equal_range(ForwardIterator first, ForwardIterator last, const T& value);
1577 template <class ForwardIterator, class T, class Compare>
1578 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
1579 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1581 template <class ForwardIterator, class T>
1582 constexpr bool // constexpr in C++20
1583 binary_search(ForwardIterator first, ForwardIterator last, const T& value);
1585 template <class ForwardIterator, class T, class Compare>
1586 constexpr bool // constexpr in C++20
1587 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
1589 template <class InputIterator1, class InputIterator2, class OutputIterator>
1590 constexpr OutputIterator // constexpr in C++20
1591 merge(InputIterator1 first1, InputIterator1 last1,
1592 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1594 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1595 constexpr OutputIterator // constexpr in C++20
1596 merge(InputIterator1 first1, InputIterator1 last1,
1597 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1599 template <class BidirectionalIterator>
1601 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
1603 template <class BidirectionalIterator, class Compare>
1605 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
1607 template <class InputIterator1, class InputIterator2>
1608 constexpr bool // constexpr in C++20
1609 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1611 template <class InputIterator1, class InputIterator2, class Compare>
1612 constexpr bool // constexpr in C++20
1613 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
1615 template <class InputIterator1, class InputIterator2, class OutputIterator>
1616 constexpr OutputIterator // constexpr in C++20
1617 set_union(InputIterator1 first1, InputIterator1 last1,
1618 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1620 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1621 constexpr OutputIterator // constexpr in C++20
1622 set_union(InputIterator1 first1, InputIterator1 last1,
1623 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1625 template <class InputIterator1, class InputIterator2, class OutputIterator>
1626 constexpr OutputIterator // constexpr in C++20
1627 set_intersection(InputIterator1 first1, InputIterator1 last1,
1628 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1630 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1631 constexpr OutputIterator // constexpr in C++20
1632 set_intersection(InputIterator1 first1, InputIterator1 last1,
1633 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1635 template <class InputIterator1, class InputIterator2, class OutputIterator>
1636 constexpr OutputIterator // constexpr in C++20
1637 set_difference(InputIterator1 first1, InputIterator1 last1,
1638 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1640 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1641 constexpr OutputIterator // constexpr in C++20
1642 set_difference(InputIterator1 first1, InputIterator1 last1,
1643 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1645 template <class InputIterator1, class InputIterator2, class OutputIterator>
1646 constexpr OutputIterator // constexpr in C++20
1647 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1648 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
1650 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
1651 constexpr OutputIterator // constexpr in C++20
1652 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
1653 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
1655 template <class RandomAccessIterator>
1656 constexpr void // constexpr in C++20
1657 push_heap(RandomAccessIterator first, RandomAccessIterator last);
1659 template <class RandomAccessIterator, class Compare>
1660 constexpr void // constexpr in C++20
1661 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1663 template <class RandomAccessIterator>
1664 constexpr void // constexpr in C++20
1665 pop_heap(RandomAccessIterator first, RandomAccessIterator last);
1667 template <class RandomAccessIterator, class Compare>
1668 constexpr void // constexpr in C++20
1669 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1671 template <class RandomAccessIterator>
1672 constexpr void // constexpr in C++20
1673 make_heap(RandomAccessIterator first, RandomAccessIterator last);
1675 template <class RandomAccessIterator, class Compare>
1676 constexpr void // constexpr in C++20
1677 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1679 template <class RandomAccessIterator>
1680 constexpr void // constexpr in C++20
1681 sort_heap(RandomAccessIterator first, RandomAccessIterator last);
1683 template <class RandomAccessIterator, class Compare>
1684 constexpr void // constexpr in C++20
1685 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
1687 template <class RandomAccessIterator>
1688 constexpr bool // constexpr in C++20
1689 is_heap(RandomAccessIterator first, RandomAccessiterator last);
1691 template <class RandomAccessIterator, class Compare>
1692 constexpr bool // constexpr in C++20
1693 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1695 template <class RandomAccessIterator>
1696 constexpr RandomAccessIterator // constexpr in C++20
1697 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
1699 template <class RandomAccessIterator, class Compare>
1700 constexpr RandomAccessIterator // constexpr in C++20
1701 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
1703 template <class ForwardIterator>
1704 constexpr ForwardIterator // constexpr in C++14
1705 min_element(ForwardIterator first, ForwardIterator last);
1707 template <class ForwardIterator, class Compare>
1708 constexpr ForwardIterator // constexpr in C++14
1709 min_element(ForwardIterator first, ForwardIterator last, Compare comp);
1712 constexpr const T& // constexpr in C++14
1713 min(const T& a, const T& b);
1715 template <class T, class Compare>
1716 constexpr const T& // constexpr in C++14
1717 min(const T& a, const T& b, Compare comp);
1720 constexpr T // constexpr in C++14
1721 min(initializer_list<T> t);
1723 template<class T, class Compare>
1724 constexpr T // constexpr in C++14
1725 min(initializer_list<T> t, Compare comp);
1728 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
1730 template<class T, class Compare>
1731 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
1733 template <class ForwardIterator>
1734 constexpr ForwardIterator // constexpr in C++14
1735 max_element(ForwardIterator first, ForwardIterator last);
1737 template <class ForwardIterator, class Compare>
1738 constexpr ForwardIterator // constexpr in C++14
1739 max_element(ForwardIterator first, ForwardIterator last, Compare comp);
1742 constexpr const T& // constexpr in C++14
1743 max(const T& a, const T& b);
1745 template <class T, class Compare>
1746 constexpr const T& // constexpr in C++14
1747 max(const T& a, const T& b, Compare comp);
1750 constexpr T // constexpr in C++14
1751 max(initializer_list<T> t);
1753 template<class T, class Compare>
1754 constexpr T // constexpr in C++14
1755 max(initializer_list<T> t, Compare comp);
1757 template<class ForwardIterator>
1758 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1759 minmax_element(ForwardIterator first, ForwardIterator last);
1761 template<class ForwardIterator, class Compare>
1762 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
1763 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
1766 constexpr pair<const T&, const T&> // constexpr in C++14
1767 minmax(const T& a, const T& b);
1769 template<class T, class Compare>
1770 constexpr pair<const T&, const T&> // constexpr in C++14
1771 minmax(const T& a, const T& b, Compare comp);
1774 constexpr pair<T, T> // constexpr in C++14
1775 minmax(initializer_list<T> t);
1777 template<class T, class Compare>
1778 constexpr pair<T, T> // constexpr in C++14
1779 minmax(initializer_list<T> t, Compare comp);
1781 template <class InputIterator1, class InputIterator2>
1782 constexpr bool // constexpr in C++20
1783 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
1785 template <class InputIterator1, class InputIterator2, class Compare>
1786 constexpr bool // constexpr in C++20
1787 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
1788 InputIterator2 first2, InputIterator2 last2, Compare comp);
1790 template<class InputIterator1, class InputIterator2, class Cmp>
1792 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1793 InputIterator2 first2, InputIterator2 last2,
1795 -> decltype(comp(*b1, *b2)); // since C++20
1797 template<class InputIterator1, class InputIterator2>
1799 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,
1800 InputIterator2 first2, InputIterator2 last2); // since C++20
1802 template <class BidirectionalIterator>
1803 constexpr bool // constexpr in C++20
1804 next_permutation(BidirectionalIterator first, BidirectionalIterator last);
1806 template <class BidirectionalIterator, class Compare>
1807 constexpr bool // constexpr in C++20
1808 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1810 template <class BidirectionalIterator>
1811 constexpr bool // constexpr in C++20
1812 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
1814 template <class BidirectionalIterator, class Compare>
1815 constexpr bool // constexpr in C++20
1816 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
1821 #include <__cxx03/__config>
1823 #include <__cxx03/__algorithm/adjacent_find.h>
1824 #include <__cxx03/__algorithm/all_of.h>
1825 #include <__cxx03/__algorithm/any_of.h>
1826 #include <__cxx03/__algorithm/binary_search.h>
1827 #include <__cxx03/__algorithm/copy.h>
1828 #include <__cxx03/__algorithm/copy_backward.h>
1829 #include <__cxx03/__algorithm/copy_if.h>
1830 #include <__cxx03/__algorithm/copy_n.h>
1831 #include <__cxx03/__algorithm/count.h>
1832 #include <__cxx03/__algorithm/count_if.h>
1833 #include <__cxx03/__algorithm/equal.h>
1834 #include <__cxx03/__algorithm/equal_range.h>
1835 #include <__cxx03/__algorithm/fill.h>
1836 #include <__cxx03/__algorithm/fill_n.h>
1837 #include <__cxx03/__algorithm/find.h>
1838 #include <__cxx03/__algorithm/find_end.h>
1839 #include <__cxx03/__algorithm/find_first_of.h>
1840 #include <__cxx03/__algorithm/find_if.h>
1841 #include <__cxx03/__algorithm/find_if_not.h>
1842 #include <__cxx03/__algorithm/for_each.h>
1843 #include <__cxx03/__algorithm/generate.h>
1844 #include <__cxx03/__algorithm/generate_n.h>
1845 #include <__cxx03/__algorithm/includes.h>
1846 #include <__cxx03/__algorithm/inplace_merge.h>
1847 #include <__cxx03/__algorithm/is_heap.h>
1848 #include <__cxx03/__algorithm/is_heap_until.h>
1849 #include <__cxx03/__algorithm/is_partitioned.h>
1850 #include <__cxx03/__algorithm/is_permutation.h>
1851 #include <__cxx03/__algorithm/is_sorted.h>
1852 #include <__cxx03/__algorithm/is_sorted_until.h>
1853 #include <__cxx03/__algorithm/iter_swap.h>
1854 #include <__cxx03/__algorithm/lexicographical_compare.h>
1855 #include <__cxx03/__algorithm/lower_bound.h>
1856 #include <__cxx03/__algorithm/make_heap.h>
1857 #include <__cxx03/__algorithm/max.h>
1858 #include <__cxx03/__algorithm/max_element.h>
1859 #include <__cxx03/__algorithm/merge.h>
1860 #include <__cxx03/__algorithm/min.h>
1861 #include <__cxx03/__algorithm/min_element.h>
1862 #include <__cxx03/__algorithm/minmax.h>
1863 #include <__cxx03/__algorithm/minmax_element.h>
1864 #include <__cxx03/__algorithm/mismatch.h>
1865 #include <__cxx03/__algorithm/move.h>
1866 #include <__cxx03/__algorithm/move_backward.h>
1867 #include <__cxx03/__algorithm/next_permutation.h>
1868 #include <__cxx03/__algorithm/none_of.h>
1869 #include <__cxx03/__algorithm/nth_element.h>
1870 #include <__cxx03/__algorithm/partial_sort.h>
1871 #include <__cxx03/__algorithm/partial_sort_copy.h>
1872 #include <__cxx03/__algorithm/partition.h>
1873 #include <__cxx03/__algorithm/partition_copy.h>
1874 #include <__cxx03/__algorithm/partition_point.h>
1875 #include <__cxx03/__algorithm/pop_heap.h>
1876 #include <__cxx03/__algorithm/prev_permutation.h>
1877 #include <__cxx03/__algorithm/push_heap.h>
1878 #include <__cxx03/__algorithm/remove.h>
1879 #include <__cxx03/__algorithm/remove_copy.h>
1880 #include <__cxx03/__algorithm/remove_copy_if.h>
1881 #include <__cxx03/__algorithm/remove_if.h>
1882 #include <__cxx03/__algorithm/replace.h>
1883 #include <__cxx03/__algorithm/replace_copy.h>
1884 #include <__cxx03/__algorithm/replace_copy_if.h>
1885 #include <__cxx03/__algorithm/replace_if.h>
1886 #include <__cxx03/__algorithm/reverse.h>
1887 #include <__cxx03/__algorithm/reverse_copy.h>
1888 #include <__cxx03/__algorithm/rotate.h>
1889 #include <__cxx03/__algorithm/rotate_copy.h>
1890 #include <__cxx03/__algorithm/search.h>
1891 #include <__cxx03/__algorithm/search_n.h>
1892 #include <__cxx03/__algorithm/set_difference.h>
1893 #include <__cxx03/__algorithm/set_intersection.h>
1894 #include <__cxx03/__algorithm/set_symmetric_difference.h>
1895 #include <__cxx03/__algorithm/set_union.h>
1896 #include <__cxx03/__algorithm/shuffle.h>
1897 #include <__cxx03/__algorithm/sort.h>
1898 #include <__cxx03/__algorithm/sort_heap.h>
1899 #include <__cxx03/__algorithm/stable_partition.h>
1900 #include <__cxx03/__algorithm/stable_sort.h>
1901 #include <__cxx03/__algorithm/swap_ranges.h>
1902 #include <__cxx03/__algorithm/transform.h>
1903 #include <__cxx03/__algorithm/unique.h>
1904 #include <__cxx03/__algorithm/unique_copy.h>
1905 #include <__cxx03/__algorithm/upper_bound.h>
1907 #if _LIBCPP_STD_VER >= 17
1908 # include <__cxx03/__algorithm/clamp.h>
1909 # include <__cxx03/__algorithm/for_each_n.h>
1910 # include <__cxx03/__algorithm/pstl.h>
1911 # include <__cxx03/__algorithm/sample.h>
1912 #endif // _LIBCPP_STD_VER >= 17
1914 #if _LIBCPP_STD_VER >= 20
1915 # include <__cxx03/__algorithm/in_found_result.h>
1916 # include <__cxx03/__algorithm/in_fun_result.h>
1917 # include <__cxx03/__algorithm/in_in_out_result.h>
1918 # include <__cxx03/__algorithm/in_in_result.h>
1919 # include <__cxx03/__algorithm/in_out_out_result.h>
1920 # include <__cxx03/__algorithm/in_out_result.h>
1921 # include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
1922 # include <__cxx03/__algorithm/min_max_result.h>
1923 # include <__cxx03/__algorithm/ranges_adjacent_find.h>
1924 # include <__cxx03/__algorithm/ranges_all_of.h>
1925 # include <__cxx03/__algorithm/ranges_any_of.h>
1926 # include <__cxx03/__algorithm/ranges_binary_search.h>
1927 # include <__cxx03/__algorithm/ranges_clamp.h>
1928 # include <__cxx03/__algorithm/ranges_contains.h>
1929 # include <__cxx03/__algorithm/ranges_copy.h>
1930 # include <__cxx03/__algorithm/ranges_copy_backward.h>
1931 # include <__cxx03/__algorithm/ranges_copy_if.h>
1932 # include <__cxx03/__algorithm/ranges_copy_n.h>
1933 # include <__cxx03/__algorithm/ranges_count.h>
1934 # include <__cxx03/__algorithm/ranges_count_if.h>
1935 # include <__cxx03/__algorithm/ranges_equal.h>
1936 # include <__cxx03/__algorithm/ranges_equal_range.h>
1937 # include <__cxx03/__algorithm/ranges_fill.h>
1938 # include <__cxx03/__algorithm/ranges_fill_n.h>
1939 # include <__cxx03/__algorithm/ranges_find.h>
1940 # include <__cxx03/__algorithm/ranges_find_end.h>
1941 # include <__cxx03/__algorithm/ranges_find_first_of.h>
1942 # include <__cxx03/__algorithm/ranges_find_if.h>
1943 # include <__cxx03/__algorithm/ranges_find_if_not.h>
1944 # include <__cxx03/__algorithm/ranges_for_each.h>
1945 # include <__cxx03/__algorithm/ranges_for_each_n.h>
1946 # include <__cxx03/__algorithm/ranges_generate.h>
1947 # include <__cxx03/__algorithm/ranges_generate_n.h>
1948 # include <__cxx03/__algorithm/ranges_includes.h>
1949 # include <__cxx03/__algorithm/ranges_inplace_merge.h>
1950 # include <__cxx03/__algorithm/ranges_is_heap.h>
1951 # include <__cxx03/__algorithm/ranges_is_heap_until.h>
1952 # include <__cxx03/__algorithm/ranges_is_partitioned.h>
1953 # include <__cxx03/__algorithm/ranges_is_permutation.h>
1954 # include <__cxx03/__algorithm/ranges_is_sorted.h>
1955 # include <__cxx03/__algorithm/ranges_is_sorted_until.h>
1956 # include <__cxx03/__algorithm/ranges_lexicographical_compare.h>
1957 # include <__cxx03/__algorithm/ranges_lower_bound.h>
1958 # include <__cxx03/__algorithm/ranges_make_heap.h>
1959 # include <__cxx03/__algorithm/ranges_max.h>
1960 # include <__cxx03/__algorithm/ranges_max_element.h>
1961 # include <__cxx03/__algorithm/ranges_merge.h>
1962 # include <__cxx03/__algorithm/ranges_min.h>
1963 # include <__cxx03/__algorithm/ranges_min_element.h>
1964 # include <__cxx03/__algorithm/ranges_minmax.h>
1965 # include <__cxx03/__algorithm/ranges_minmax_element.h>
1966 # include <__cxx03/__algorithm/ranges_mismatch.h>
1967 # include <__cxx03/__algorithm/ranges_move.h>
1968 # include <__cxx03/__algorithm/ranges_move_backward.h>
1969 # include <__cxx03/__algorithm/ranges_next_permutation.h>
1970 # include <__cxx03/__algorithm/ranges_none_of.h>
1971 # include <__cxx03/__algorithm/ranges_nth_element.h>
1972 # include <__cxx03/__algorithm/ranges_partial_sort.h>
1973 # include <__cxx03/__algorithm/ranges_partial_sort_copy.h>
1974 # include <__cxx03/__algorithm/ranges_partition.h>
1975 # include <__cxx03/__algorithm/ranges_partition_copy.h>
1976 # include <__cxx03/__algorithm/ranges_partition_point.h>
1977 # include <__cxx03/__algorithm/ranges_pop_heap.h>
1978 # include <__cxx03/__algorithm/ranges_prev_permutation.h>
1979 # include <__cxx03/__algorithm/ranges_push_heap.h>
1980 # include <__cxx03/__algorithm/ranges_remove.h>
1981 # include <__cxx03/__algorithm/ranges_remove_copy.h>
1982 # include <__cxx03/__algorithm/ranges_remove_copy_if.h>
1983 # include <__cxx03/__algorithm/ranges_remove_if.h>
1984 # include <__cxx03/__algorithm/ranges_replace.h>
1985 # include <__cxx03/__algorithm/ranges_replace_copy.h>
1986 # include <__cxx03/__algorithm/ranges_replace_copy_if.h>
1987 # include <__cxx03/__algorithm/ranges_replace_if.h>
1988 # include <__cxx03/__algorithm/ranges_reverse.h>
1989 # include <__cxx03/__algorithm/ranges_reverse_copy.h>
1990 # include <__cxx03/__algorithm/ranges_rotate.h>
1991 # include <__cxx03/__algorithm/ranges_rotate_copy.h>
1992 # include <__cxx03/__algorithm/ranges_sample.h>
1993 # include <__cxx03/__algorithm/ranges_search.h>
1994 # include <__cxx03/__algorithm/ranges_search_n.h>
1995 # include <__cxx03/__algorithm/ranges_set_difference.h>
1996 # include <__cxx03/__algorithm/ranges_set_intersection.h>
1997 # include <__cxx03/__algorithm/ranges_set_symmetric_difference.h>
1998 # include <__cxx03/__algorithm/ranges_set_union.h>
1999 # include <__cxx03/__algorithm/ranges_shuffle.h>
2000 # include <__cxx03/__algorithm/ranges_sort.h>
2001 # include <__cxx03/__algorithm/ranges_sort_heap.h>
2002 # include <__cxx03/__algorithm/ranges_stable_partition.h>
2003 # include <__cxx03/__algorithm/ranges_stable_sort.h>
2004 # include <__cxx03/__algorithm/ranges_swap_ranges.h>
2005 # include <__cxx03/__algorithm/ranges_transform.h>
2006 # include <__cxx03/__algorithm/ranges_unique.h>
2007 # include <__cxx03/__algorithm/ranges_unique_copy.h>
2008 # include <__cxx03/__algorithm/ranges_upper_bound.h>
2009 # include <__cxx03/__algorithm/shift_left.h>
2010 # include <__cxx03/__algorithm/shift_right.h>
2013 #if _LIBCPP_STD_VER >= 23
2014 # include <__cxx03/__algorithm/fold.h>
2015 # include <__cxx03/__algorithm/ranges_contains_subrange.h>
2016 # include <__cxx03/__algorithm/ranges_ends_with.h>
2017 # include <__cxx03/__algorithm/ranges_find_last.h>
2018 # include <__cxx03/__algorithm/ranges_starts_with.h>
2019 #endif // _LIBCPP_STD_VER >= 23
2021 #include <__cxx03/version>
2023 // standard-mandated includes
2026 #include <__cxx03/initializer_list>
2028 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2029 # pragma GCC system_header
2032 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2033 # include <__cxx03/execution>
2036 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2037 # include <__cxx03/atomic>
2038 # include <__cxx03/bit>
2039 # include <__cxx03/concepts>
2040 # include <__cxx03/cstdlib>
2041 # include <__cxx03/cstring>
2042 # include <__cxx03/iterator>
2043 # include <__cxx03/memory>
2044 # include <__cxx03/stdexcept>
2045 # include <__cxx03/type_traits>
2046 # include <__cxx03/utility>
2049 #endif // _LIBCPP_ALGORITHM