2072 lines · plain
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP_ALGORITHM11#define _LIBCPP_ALGORITHM12 13/*14 algorithm synopsis15 16#include <initializer_list>17 18namespace std19{20 21namespace ranges {22 23 // [algorithms.results], algorithm result types24 template <class I, class F>25 struct in_fun_result; // since C++2026 27 template <class I1, class I2>28 struct in_in_result; // since C++2029 30 template <class I, class O>31 struct in_out_result; // since C++2032 33 template <class I1, class I2, class O>34 struct in_in_out_result; // since C++2035 36 template <class I, class O1, class O2>37 struct in_out_out_result; // since C++2038 39 template <class I1, class I2>40 struct min_max_result; // since C++2041 42 template <class I>43 struct in_found_result; // since C++2044 45 template <class I, class T>46 struct in_value_result; // since C++2347 48 template <class O, class T>49 struct out_value_result; // since C++2350 51 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,52 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++2053 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});54 55 template<forward_range R, class Proj = identity,56 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++2057 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});58 59 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,60 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>61 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++2062 63 template<forward_range R, class Proj = identity,64 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>65 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++2066 67 template<class I1, class I2>68 using mismatch_result = in_in_result<I1, I2>;69 70 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,71 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>72 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>73 constexpr mismatch_result<_I1, _I2> // since C++2074 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {})75 76 template <input_range R1, input_range R2,77 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>78 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>79 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>80 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++2081 82 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>83 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++2084 85 template<input_range R, class T, class Proj = identity>86 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>87 constexpr borrowed_iterator_t<R>88 find(R&& r, const T& value, Proj proj = {}); // since C++2089 90 template<input_iterator I, sentinel_for<I> S, class Proj = identity,91 indirect_unary_predicate<projected<I, Proj>> Pred>92 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++2093 94 template<input_range R, class Proj = identity,95 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>96 constexpr borrowed_iterator_t<R>97 find_if(R&& r, Pred pred, Proj proj = {}); // since C++2098 99 template<input_iterator I, sentinel_for<I> S, class Proj = identity,100 indirect_unary_predicate<projected<I, Proj>> Pred>101 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20102 103 template<input_range R, class Proj = identity,104 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>105 constexpr borrowed_iterator_t<R>106 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20107 108 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity>109 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>110 constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23111 112 template<forward_range R, class T, class Proj = identity>113 requires114 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>115 constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23116 117 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,118 indirect_unary_predicate<projected<I, Proj>> Pred>119 constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23120 121 template<forward_range R, class Proj = identity,122 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>123 constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23124 125 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,126 indirect_unary_predicate<projected<I, Proj>> Pred>127 constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23128 129 template<forward_range R, class Proj = identity,130 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>131 constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23132 133 template<class T, class Proj = identity,134 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>135 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20136 137 template<copyable T, class Proj = identity,138 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>139 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20140 141 template<input_range R, class Proj = identity,142 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>143 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>144 constexpr range_value_t<R>145 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20146 147 template<class T, class Proj = identity,148 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>149 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20150 151 template<copyable T, class Proj = identity,152 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>153 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20154 155 template<input_range R, class Proj = identity,156 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>157 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>158 constexpr range_value_t<R>159 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20160 161 template<class I, class O>162 using unary_transform_result = in_out_result<I, O>; // since C++20163 164 template<class I1, class I2, class O>165 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20166 167 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,168 copy_constructible F, class Proj = identity>169 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>170 constexpr ranges::unary_transform_result<I, O>171 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20172 173 template<input_range R, weakly_incrementable O, copy_constructible F,174 class Proj = identity>175 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>176 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>177 transform(R&& r, O result, F op, Proj proj = {}); // since C++20178 179 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,180 weakly_incrementable O, copy_constructible F, class Proj1 = identity,181 class Proj2 = identity>182 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,183 projected<I2, Proj2>>>184 constexpr ranges::binary_transform_result<I1, I2, O>185 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,186 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20187 188 template<input_range R1, input_range R2, weakly_incrementable O,189 copy_constructible F, class Proj1 = identity, class Proj2 = identity>190 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,191 projected<iterator_t<R2>, Proj2>>>192 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>193 transform(R1&& r1, R2&& r2, O result,194 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20195 196 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>197 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>198 constexpr iter_difference_t<I>199 count(I first, S last, const T& value, Proj proj = {}); // since C++20200 201 template<input_range R, class T, class Proj = identity>202 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>203 constexpr range_difference_t<R>204 count(R&& r, const T& value, Proj proj = {}); // since C++20205 206 template<input_iterator I, sentinel_for<I> S, class Proj = identity,207 indirect_unary_predicate<projected<I, Proj>> Pred>208 constexpr iter_difference_t<I>209 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20210 211 template<input_range R, class Proj = identity,212 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>213 constexpr range_difference_t<R>214 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20215 216 template<class T>217 using minmax_result = min_max_result<T>;218 219 template<class T, class Proj = identity,220 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>221 constexpr ranges::minmax_result<const T&>222 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20223 224 template<copyable T, class Proj = identity,225 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>226 constexpr ranges::minmax_result<T>227 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20228 229 template<input_range R, class Proj = identity,230 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>231 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>232 constexpr ranges::minmax_result<range_value_t<R>>233 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20234 235 template<class I>236 using minmax_element_result = min_max_result<I>;237 238 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,239 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>240 constexpr ranges::minmax_element_result<I>241 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20242 243 template<forward_range R, class Proj = identity,244 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>245 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>246 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20247 248 template<forward_iterator I1, sentinel_for<I1> S1,249 forward_iterator I2, sentinel_for<I2> S2,250 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>251 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>252 constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,253 Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23254 255 template<forward_range R1, forward_range R2,256 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>257 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>258 constexpr bool contains_subrange(R1&& r1, R2&& r2, Pred pred = {},259 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23260 261 template<class I, class O>262 using copy_result = in_out_result<I, O>; // since C++20263 264 template<class I, class O>265 using copy_n_result = in_out_result<I, O>; // since C++20266 267 template<class I, class O>268 using copy_if_result = in_out_result<I, O>; // since C++20269 270 template<class I1, class I2>271 using copy_backward_result = in_out_result<I1, I2>; // since C++20272 273 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>274 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>275 constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {}); // since C++23276 277 template<input_range R, class T, class Proj = identity>278 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>279 constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {}); // since C++23280 281 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>282 requires indirectly_copyable<I, O>283 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20284 285 template<input_range R, weakly_incrementable O>286 requires indirectly_copyable<iterator_t<R>, O>287 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20288 289 template<input_iterator I, weakly_incrementable O>290 requires indirectly_copyable<I, O>291 constexpr ranges::copy_n_result<I, O>292 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20293 294 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,295 indirect_unary_predicate<projected<I, Proj>> Pred>296 requires indirectly_copyable<I, O>297 constexpr ranges::copy_if_result<I, O>298 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20299 300 template<input_range R, weakly_incrementable O, class Proj = identity,301 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>302 requires indirectly_copyable<iterator_t<R>, O>303 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>304 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20305 306 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>307 requires indirectly_copyable<I1, I2>308 constexpr ranges::copy_backward_result<I1, I2>309 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20310 311 template<bidirectional_range R, bidirectional_iterator I>312 requires indirectly_copyable<iterator_t<R>, I>313 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>314 ranges::copy_backward(R&& r, I result); // since C++20315 316 template<class I, class F>317 using for_each_result = in_fun_result<I, F>; // since C++20318 319 template<class I, class F>320 using for_each_n_result = in_fun_result<I, F>; // since C++20321 322 template<input_iterator I, sentinel_for<I> S, class Proj = identity,323 indirectly_unary_invocable<projected<I, Proj>> Fun>324 constexpr ranges::for_each_result<I, Fun>325 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20326 327 template<input_range R, class Proj = identity,328 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>329 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>330 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20331 332 template<input_iterator I, class Proj = identity,333 indirectly_unary_invocable<projected<I, Proj>> Fun>334 constexpr ranges::for_each_n_result<I, Fun>335 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20336 337 template<input_iterator I, sentinel_for<I> S, class Proj = identity,338 indirect_unary_predicate<projected<I, Proj>> Pred>339 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20340 341 template<input_range R, class Proj = identity,342 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>343 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20344 345 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,346 class Proj = identity>347 requires sortable<I, Comp, Proj>348 constexpr I349 ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20350 351 template<random_access_range R, class Comp = ranges::less, class Proj = identity>352 requires sortable<iterator_t<R>, Comp, Proj>353 constexpr borrowed_iterator_t<R>354 ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20355 356 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,357 class Proj = identity>358 requires sortable<I, Comp, Proj>359 constexpr I360 ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20361 362 template<random_access_range R, class Comp = ranges::less, class Proj = identity>363 requires sortable<iterator_t<R>, Comp, Proj>364 constexpr borrowed_iterator_t<R>365 ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20366 367 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,368 class Proj = identity>369 requires sortable<I, Comp, Proj>370 constexpr I371 ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20372 373 template<random_access_range R, class Comp = ranges::less, class Proj = identity>374 requires sortable<iterator_t<R>, Comp, Proj>375 constexpr borrowed_iterator_t<R>376 ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20377 378 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,379 class Proj = identity>380 requires sortable<I, Comp, Proj>381 constexpr I382 ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20383 384 template<random_access_range R, class Comp = ranges::less, class Proj = identity>385 requires sortable<iterator_t<R>, Comp, Proj>386 constexpr borrowed_iterator_t<R>387 ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20388 389 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,390 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>391 constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20392 393 template<random_access_range R, class Proj = identity,394 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>395 constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20396 397 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,398 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>399 constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20400 401 template<random_access_range R, class Proj = identity,402 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>403 constexpr borrowed_iterator_t<R>404 is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20405 406 template<bidirectional_iterator I, sentinel_for<I> S>407 requires permutable<I>408 constexpr I ranges::reverse(I first, S last); // since C++20409 410 template<bidirectional_range R>411 requires permutable<iterator_t<R>>412 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20413 414 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,415 class Proj = identity>416 requires sortable<I, Comp, Proj>417 constexpr I418 ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20419 420 template<random_access_range R, class Comp = ranges::less, class Proj = identity>421 requires sortable<iterator_t<R>, Comp, Proj>422 constexpr borrowed_iterator_t<R>423 ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20424 425 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,426 class Proj = identity>427 requires sortable<I, Comp, Proj>428 constexpr I // constexpr since C++26429 ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20430 431 template<random_access_range R, class Comp = ranges::less, class Proj = identity>432 requires sortable<iterator_t<R>, Comp, Proj>433 constexpr borrowed_iterator_t<R> // constexpr since C++26434 ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20435 436 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,437 class Proj = identity>438 requires sortable<I, Comp, Proj>439 constexpr I440 ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20441 442 template<random_access_range R, class Comp = ranges::less, class Proj = identity>443 requires sortable<iterator_t<R>, Comp, Proj>444 constexpr borrowed_iterator_t<R>445 ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20446 447 template<class T, output_iterator<const T&> O, sentinel_for<O> S>448 constexpr O ranges::fill(O first, S last, const T& value); // since C++20449 450 template<class T, output_range<const T&> R>451 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20452 453 template<class T, output_iterator<const T&> O>454 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20455 456 template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>457 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>458 constexpr O generate(O first, S last, F gen); // since C++20459 460 template<class ExecutionPolicy, class ForwardIterator, class Generator>461 void generate(ExecutionPolicy&& exec,462 ForwardIterator first, ForwardIterator last,463 Generator gen); // since C++17464 465 template<class R, copy_constructible F>466 requires invocable<F&> && output_range<R, invoke_result_t<F&>>467 constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20468 469 template<input_or_output_iterator O, copy_constructible F>470 requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>471 constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20472 473 template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>474 ForwardIterator generate_n(ExecutionPolicy&& exec,475 ForwardIterator first, Size n, Generator gen); // since C++17476 477 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,478 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>479 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>480 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,481 Pred pred = {},482 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20483 484 template<input_range R1, input_range R2, class Pred = ranges::equal_to,485 class Proj1 = identity, class Proj2 = identity>486 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>487 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},488 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20489 490 template<input_iterator I, sentinel_for<I> S, class Proj = identity,491 indirect_unary_predicate<projected<I, Proj>> Pred>492 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20493 494 template<input_range R, class Proj = identity,495 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>496 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20497 498 template<input_iterator I, sentinel_for<I> S, class Proj = identity,499 indirect_unary_predicate<projected<I, Proj>> Pred>500 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20501 502 template<input_range R, class Proj = identity,503 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>504 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20505 506 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,507 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>508 requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&509 (forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&510 indirectly_comparable<I1, I2, Pred, Proj1, Proj2>511 constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},512 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23513 514 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,515 class Proj2 = identity>516 requires (forward_range<R1> || sized_range<R1>) &&517 (forward_range<R2> || sized_range<R2>) &&518 indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>519 constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {},520 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23521 522 template<input_iterator I, sentinel_for<I> S, class Proj = identity,523 indirect_unary_predicate<projected<I, Proj>> Pred>524 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20525 526 template<input_range R, class Proj = identity,527 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>528 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20529 530 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,531 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>532 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>533 constexpr bool ranges::starts_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},534 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23535 536 template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,537 class Proj2 = identity>538 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>539 constexpr bool ranges::starts_with(R1&& r1, R2&& r2, Pred pred = {},540 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23541 542 template<input_iterator I1, sentinel_for<I1> S1,543 random_access_iterator I2, sentinel_for<I2> S2,544 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>545 requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&546 indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>547 constexpr partial_sort_copy_result<I1, I2>548 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,549 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20550 551 template<input_range R1, random_access_range R2, class Comp = ranges::less,552 class Proj1 = identity, class Proj2 = identity>553 requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&554 sortable<iterator_t<R2>, Comp, Proj2> &&555 indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,556 projected<iterator_t<R2>, Proj2>>557 constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>558 partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},559 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20560 561 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,562 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>563 constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20564 565 template<forward_range R, class Proj = identity,566 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>567 constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20568 569 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,570 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>571 constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20572 573 template<forward_range R, class Proj = identity,574 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>575 constexpr borrowed_iterator_t<R>576 ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20577 578 template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,579 class Proj = identity>580 requires sortable<I, Comp, Proj>581 constexpr I582 ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20583 584 template<random_access_range R, class Comp = ranges::less, class Proj = identity>585 requires sortable<iterator_t<R>, Comp, Proj>586 constexpr borrowed_iterator_t<R>587 ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20588 589 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,590 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20591 constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});592 593 template<forward_range R, class T, class Proj = identity,594 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =595 ranges::less>596 constexpr borrowed_iterator_t<R>597 upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20598 599 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,600 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>601 constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},602 Proj proj = {}); // since C++20603 template<forward_range R, class T, class Proj = identity,604 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =605 ranges::less>606 constexpr borrowed_iterator_t<R>607 lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20608 609 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,610 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>611 constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},612 Proj proj = {}); // since C++20613 614 template<forward_range R, class T, class Proj = identity,615 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =616 ranges::less>617 constexpr bool binary_search(R&& r, const T& value, Comp comp = {},618 Proj proj = {}); // since C++20619 620 template<permutable I, sentinel_for<I> S, class Proj = identity,621 indirect_unary_predicate<projected<I, Proj>> Pred>622 constexpr subrange<I>623 partition(I first, S last, Pred pred, Proj proj = {}); // since C++20624 625 template<forward_range R, class Proj = identity,626 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>627 requires permutable<iterator_t<R>>628 constexpr borrowed_subrange_t<R>629 partition(R&& r, Pred pred, Proj proj = {}); // since C++20630 631 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,632 indirect_unary_predicate<projected<I, Proj>> Pred>633 requires permutable<I>634 constexpr subrange<I> // constexpr since C++26635 stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20636 637 template<bidirectional_range R, class Proj = identity,638 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>639 requires permutable<iterator_t<R>>640 constexpr borrowed_subrange_t<R> // constexpr since C++26641 stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20642 643 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,644 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>645 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>646 constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,647 Pred pred = {},648 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20649 650 template<input_range R1, forward_range R2,651 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>652 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>653 constexpr borrowed_iterator_t<R1>654 ranges::find_first_of(R1&& r1, R2&& r2,655 Pred pred = {},656 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20657 658 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,659 indirect_binary_predicate<projected<I, Proj>,660 projected<I, Proj>> Pred = ranges::equal_to>661 constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20662 663 template<forward_range R, class Proj = identity,664 indirect_binary_predicate<projected<iterator_t<R>, Proj>,665 projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>666 constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20667 668 template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>669 requires indirectly_writable<I, const T2&> &&670 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>671 constexpr I672 ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20673 674 template<input_range R, class T1, class T2, class Proj = identity>675 requires indirectly_writable<iterator_t<R>, const T2&> &&676 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>677 constexpr borrowed_iterator_t<R>678 ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20679 680 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,681 indirect_unary_predicate<projected<I, Proj>> Pred>682 requires indirectly_writable<I, const T&>683 constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20684 685 template<input_range R, class T, class Proj = identity,686 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>687 requires indirectly_writable<iterator_t<R>, const T&>688 constexpr borrowed_iterator_t<R>689 ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20690 691 template<class T, class Proj = identity,692 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>693 constexpr const T&694 ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20695 696 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,697 class Proj1 = identity, class Proj2 = identity,698 indirect_strict_weak_order<projected<I1, Proj1>,699 projected<I2, Proj2>> Comp = ranges::less>700 constexpr bool701 ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,702 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20703 704 template<input_range R1, input_range R2, class Proj1 = identity,705 class Proj2 = identity,706 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,707 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>708 constexpr bool709 ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},710 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20711 712 template<class I, class O>713 using move_result = in_out_result<I, O>; // since C++20714 715 template<class I, class O>716 using move_backward_result = in_out_result<I, O>; // since C++20717 718 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>719 requires indirectly_movable<I1, I2>720 constexpr ranges::move_backward_result<I1, I2>721 ranges::move_backward(I1 first, S1 last, I2 result); // since C++20722 723 template<bidirectional_range R, bidirectional_iterator I>724 requires indirectly_movable<iterator_t<R>, I>725 constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>726 ranges::move_backward(R&& r, I result); // since C++20727 728 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>729 requires indirectly_movable<I, O>730 constexpr ranges::move_result<I, O>731 ranges::move(I first, S last, O result); // since C++20732 733 template<input_range R, weakly_incrementable O>734 requires indirectly_movable<iterator_t<R>, O>735 constexpr ranges::move_result<borrowed_iterator_t<R>, O>736 ranges::move(R&& r, O result); // since C++20737 738 template<class I, class O1, class O2>739 using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20740 741 template<input_iterator I, sentinel_for<I> S,742 weakly_incrementable O1, weakly_incrementable O2,743 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>744 requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>745 constexpr partition_copy_result<I, O1, O2>746 partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,747 Proj proj = {}); // since C++20748 749 template<input_range R, weakly_incrementable O1, weakly_incrementable O2,750 class Proj = identity,751 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>752 requires indirectly_copyable<iterator_t<R>, O1> &&753 indirectly_copyable<iterator_t<R>, O2>754 constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>755 partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20756 757 template<forward_iterator I, sentinel_for<I> S, class Proj = identity,758 indirect_unary_predicate<projected<I, Proj>> Pred>759 constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20760 761 template<forward_range R, class Proj = identity,762 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>763 constexpr borrowed_iterator_t<R>764 partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20765 766 template<class I1, class I2, class O>767 using merge_result = in_in_out_result<I1, I2, O>; // since C++20768 769 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,770 weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,771 class Proj2 = identity>772 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>773 constexpr merge_result<I1, I2, O>774 merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,775 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20776 777 template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,778 class Proj1 = identity, class Proj2 = identity>779 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>780 constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>781 merge(R1&& r1, R2&& r2, O result,782 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20783 784 template<permutable I, sentinel_for<I> S, class T, class Proj = identity>785 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>786 constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20787 788 template<forward_range R, class T, class Proj = identity>789 requires permutable<iterator_t<R>> &&790 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>791 constexpr borrowed_subrange_t<R>792 ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20793 794 template<permutable I, sentinel_for<I> S, class Proj = identity,795 indirect_unary_predicate<projected<I, Proj>> Pred>796 constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20797 798 template<forward_range R, class Proj = identity,799 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>800 requires permutable<iterator_t<R>>801 constexpr borrowed_subrange_t<R>802 ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20803 804 template<class I, class O>805 using set_difference_result = in_out_result<I, O>; // since C++20806 807 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,808 weakly_incrementable O, class Comp = ranges::less,809 class Proj1 = identity, class Proj2 = identity>810 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>811 constexpr set_difference_result<I1, O>812 set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,813 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20814 815 template<input_range R1, input_range R2, weakly_incrementable O,816 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>817 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>818 constexpr set_difference_result<borrowed_iterator_t<R1>, O>819 set_difference(R1&& r1, R2&& r2, O result,820 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20821 822 template<class I1, class I2, class O>823 using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20824 825 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,826 weakly_incrementable O, class Comp = ranges::less,827 class Proj1 = identity, class Proj2 = identity>828 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>829 constexpr set_intersection_result<I1, I2, O>830 set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,831 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20832 833 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,834 weakly_incrementable O, class Comp = ranges::less,835 class Proj1 = identity, class Proj2 = identity>836 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>837 constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>838 set_intersection(R1&& r1, R2&& r2, O result,839 Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20840 841 template <class _InIter, class _OutIter>842 using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20843 844 template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>845 requires indirectly_copyable<I, O>846 constexpr ranges::reverse_copy_result<I, O>847 ranges::reverse_copy(I first, S last, O result); // since C++20848 849 template<bidirectional_range R, weakly_incrementable O>850 requires indirectly_copyable<iterator_t<R>, O>851 constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>852 ranges::reverse_copy(R&& r, O result); // since C++20853 854 template<permutable I, sentinel_for<I> S>855 constexpr subrange<I> rotate(I first, I middle, S last); // since C++20856 857 template<forward_range R>858 requires permutable<iterator_t<R>>859 constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20860 861 template <class _InIter, class _OutIter>862 using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20863 864 template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>865 requires indirectly_copyable<I, O>866 constexpr ranges::rotate_copy_result<I, O>867 ranges::rotate_copy(I first, I middle, S last, O result); // since C++20868 869 template<forward_range R, weakly_incrementable O>870 requires indirectly_copyable<iterator_t<R>, O>871 constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>872 ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20873 874 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>875 requires (forward_iterator<I> || random_access_iterator<O>) &&876 indirectly_copyable<I, O> &&877 uniform_random_bit_generator<remove_reference_t<Gen>>878 O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20879 880 template<input_range R, weakly_incrementable O, class Gen>881 requires (forward_range<R> || random_access_iterator<O>) &&882 indirectly_copyable<iterator_t<R>, O> &&883 uniform_random_bit_generator<remove_reference_t<Gen>>884 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20885 886 template<random_access_iterator I, sentinel_for<I> S, class Gen>887 requires permutable<I> &&888 uniform_random_bit_generator<remove_reference_t<Gen>>889 I shuffle(I first, S last, Gen&& g); // since C++20890 891 template<random_access_range R, class Gen>892 requires permutable<iterator_t<R>> &&893 uniform_random_bit_generator<remove_reference_t<Gen>>894 borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20895 896 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,897 sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,898 indirect_equivalence_relation<projected<I1, Proj1>,899 projected<I2, Proj2>> Pred = ranges::equal_to>900 constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,901 Pred pred = {},902 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20903 904 template<forward_range R1, forward_range R2,905 class Proj1 = identity, class Proj2 = identity,906 indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,907 projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>908 constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},909 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20910 911 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,912 sentinel_for<I2> S2, class Pred = ranges::equal_to,913 class Proj1 = identity, class Proj2 = identity>914 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>915 constexpr subrange<I1>916 ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},917 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20918 919 template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,920 class Proj1 = identity, class Proj2 = identity>921 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>922 constexpr borrowed_subrange_t<R1>923 ranges::search(R1&& r1, R2&& r2, Pred pred = {},924 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20925 926 template<forward_iterator I, sentinel_for<I> S, class T,927 class Pred = ranges::equal_to, class Proj = identity>928 requires indirectly_comparable<I, const T*, Pred, Proj>929 constexpr subrange<I>930 ranges::search_n(I first, S last, iter_difference_t<I> count,931 const T& value, Pred pred = {}, Proj proj = {}); // since C++20932 933 template<forward_range R, class T, class Pred = ranges::equal_to,934 class Proj = identity>935 requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>936 constexpr borrowed_subrange_t<R>937 ranges::search_n(R&& r, range_difference_t<R> count,938 const T& value, Pred pred = {}, Proj proj = {}); // since C++20939 940 template<input_iterator I, sentinel_for<I> S, class T,941 indirectly-binary-left-foldable<T, I> F>942 constexpr auto ranges::fold_left(I first, S last, T init, F f); // since C++23943 944 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>945 constexpr auto fold_left(R&& r, T init, F f); // since C++23946 947 template<class I, class T>948 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23949 950 template<input_iterator I, sentinel_for<I> S, class T,951 indirectly-binary-left-foldable<T, I> F>952 constexpr see below fold_left_with_iter(I first, S last, T init, F f); // since C++23953 954 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>955 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23956 957 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,958 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>959 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>960 constexpr subrange<I1>961 ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},962 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20963 964 template<forward_range R1, forward_range R2,965 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>966 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>967 constexpr borrowed_subrange_t<R1>968 ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},969 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20970 971 template<class I1, class I2, class O>972 using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20973 974 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,975 weakly_incrementable O, class Comp = ranges::less,976 class Proj1 = identity, class Proj2 = identity>977 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>978 constexpr set_symmetric_difference_result<I1, I2, O>979 set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,980 Comp comp = {}, Proj1 proj1 = {},981 Proj2 proj2 = {}); // since C++20982 983 template<input_range R1, input_range R2, weakly_incrementable O,984 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>985 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>986 constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,987 borrowed_iterator_t<R2>, O>988 set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},989 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20990 991 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,992 indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>993 constexpr subrange<I>994 equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20995 996 template<forward_range R, class T, class Proj = identity,997 indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =998 ranges::less>999 constexpr borrowed_subrange_t<R>1000 equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++201001 1002 template<class I1, class I2, class O>1003 using set_union_result = in_in_out_result<I1, I2, O>; // since C++201004 1005 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,1006 weakly_incrementable O, class Comp = ranges::less,1007 class Proj1 = identity, class Proj2 = identity>1008 requires mergeable<I1, I2, O, Comp, Proj1, Proj2>1009 constexpr set_union_result<I1, I2, O>1010 set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},1011 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++201012 1013 template<input_range R1, input_range R2, weakly_incrementable O,1014 class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>1015 requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>1016 constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>1017 set_union(R1&& r1, R2&& r2, O result, Comp comp = {},1018 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++201019 1020 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,1021 class Proj1 = identity, class Proj2 = identity,1022 indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =1023 ranges::less>1024 constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},1025 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++201026 1027 template<input_range R1, input_range R2, class Proj1 = identity,1028 class Proj2 = identity,1029 indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,1030 projected<iterator_t<R2>, Proj2>> Comp = ranges::less>1031 constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},1032 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++201033 1034 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,1035 class Proj = identity>1036 requires sortable<I, Comp, Proj>1037 constexpr I // constexpr since C++261038 inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++201039 1040 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>1041 requires sortable<iterator_t<R>, Comp, Proj>1042 constexpr borrowed_iterator_t<R> // constexpr since C++261043 inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},1044 Proj proj = {}); // since C++201045 1046 template<permutable I, sentinel_for<I> S, class Proj = identity,1047 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>1048 constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++201049 1050 template<forward_range R, class Proj = identity,1051 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>1052 requires permutable<iterator_t<R>>1053 constexpr borrowed_subrange_t<R>1054 unique(R&& r, C comp = {}, Proj proj = {}); // since C++201055 1056 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,1057 indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>1058 requires indirectly_copyable<I, O> &&1059 (forward_iterator<I> ||1060 (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||1061 indirectly_copyable_storable<I, O>)1062 constexpr unique_copy_result<I, O>1063 unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++201064 1065 template<input_range R, weakly_incrementable O, class Proj = identity,1066 indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>1067 requires indirectly_copyable<iterator_t<R>, O> &&1068 (forward_iterator<iterator_t<R>> ||1069 (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||1070 indirectly_copyable_storable<iterator_t<R>, O>)1071 constexpr unique_copy_result<borrowed_iterator_t<R>, O>1072 unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++201073 1074 template<class I, class O>1075 using remove_copy_result = in_out_result<I, O>; // since C++201076 1077 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,1078 class Proj = identity>1079 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>1080 constexpr remove_copy_result<I, O>1081 remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++201082 1083 template<input_range R, weakly_incrementable O, class T, class Proj = identity>1084 requires indirectly_copyable<iterator_t<R>, O> &&1085 indirect_binary_predicate<ranges::equal_to,1086 projected<iterator_t<R>, Proj>, const T*>1087 constexpr remove_copy_result<borrowed_iterator_t<R>, O>1088 remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++201089 1090 template<class I, class O>1091 using remove_copy_if_result = in_out_result<I, O>; // since C++201092 1093 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,1094 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>1095 requires indirectly_copyable<I, O>1096 constexpr remove_copy_if_result<I, O>1097 remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++201098 1099 template<input_range R, weakly_incrementable O, class Proj = identity,1100 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>1101 requires indirectly_copyable<iterator_t<R>, O>1102 constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>1103 remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++201104 1105 template<class I, class O>1106 using replace_copy_result = in_out_result<I, O>; // since C++201107 1108 template<input_iterator I, sentinel_for<I> S, class T1, class T2,1109 output_iterator<const T2&> O, class Proj = identity>1110 requires indirectly_copyable<I, O> &&1111 indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>1112 constexpr replace_copy_result<I, O>1113 replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,1114 Proj proj = {}); // since C++201115 1116 template<input_range R, class T1, class T2, output_iterator<const T2&> O,1117 class Proj = identity>1118 requires indirectly_copyable<iterator_t<R>, O> &&1119 indirect_binary_predicate<ranges::equal_to,1120 projected<iterator_t<R>, Proj>, const T1*>1121 constexpr replace_copy_result<borrowed_iterator_t<R>, O>1122 replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,1123 Proj proj = {}); // since C++201124 1125 template<class I, class O>1126 using replace_copy_if_result = in_out_result<I, O>; // since C++201127 1128 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,1129 class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>1130 requires indirectly_copyable<I, O>1131 constexpr replace_copy_if_result<I, O>1132 replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,1133 Proj proj = {}); // since C++201134 1135 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,1136 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>1137 requires indirectly_copyable<iterator_t<R>, O>1138 constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>1139 replace_copy_if(R&& r, O result, Pred pred, const T& new_value,1140 Proj proj = {}); // since C++201141 1142 template<class I>1143 using prev_permutation_result = in_found_result<I>; // since C++201144 1145 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,1146 class Proj = identity>1147 requires sortable<I, Comp, Proj>1148 constexpr ranges::prev_permutation_result<I>1149 ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++201150 1151 template<bidirectional_range R, class Comp = ranges::less,1152 class Proj = identity>1153 requires sortable<iterator_t<R>, Comp, Proj>1154 constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>1155 ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++201156 1157 template<class I>1158 using next_permutation_result = in_found_result<I>; // since C++201159 1160 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,1161 class Proj = identity>1162 requires sortable<I, Comp, Proj>1163 constexpr ranges::next_permutation_result<I>1164 ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++201165 1166 template<bidirectional_range R, class Comp = ranges::less,1167 class Proj = identity>1168 requires sortable<iterator_t<R>, Comp, Proj>1169 constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>1170 ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++201171 1172}1173 1174template <class InputIterator, class Predicate>1175 constexpr bool // constexpr since C++201176 all_of(InputIterator first, InputIterator last, Predicate pred);1177 1178template <class InputIterator, class Predicate>1179 constexpr bool // constexpr since C++201180 any_of(InputIterator first, InputIterator last, Predicate pred);1181 1182template <class InputIterator, class Predicate>1183 constexpr bool // constexpr since C++201184 none_of(InputIterator first, InputIterator last, Predicate pred);1185 1186template <class InputIterator, class Function>1187 constexpr Function // constexpr since C++201188 for_each(InputIterator first, InputIterator last, Function f);1189 1190template<class InputIterator, class Size, class Function>1191 constexpr InputIterator // constexpr since C++201192 for_each_n(InputIterator first, Size n, Function f); // C++171193 1194template <class InputIterator, class T>1195 constexpr InputIterator // constexpr since C++201196 find(InputIterator first, InputIterator last, const T& value);1197 1198template <class InputIterator, class Predicate>1199 constexpr InputIterator // constexpr since C++201200 find_if(InputIterator first, InputIterator last, Predicate pred);1201 1202template<class InputIterator, class Predicate>1203 constexpr InputIterator // constexpr since C++201204 find_if_not(InputIterator first, InputIterator last, Predicate pred);1205 1206template <class ForwardIterator1, class ForwardIterator2>1207 constexpr ForwardIterator1 // constexpr since C++201208 find_end(ForwardIterator1 first1, ForwardIterator1 last1,1209 ForwardIterator2 first2, ForwardIterator2 last2);1210 1211template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>1212 constexpr ForwardIterator1 // constexpr since C++201213 find_end(ForwardIterator1 first1, ForwardIterator1 last1,1214 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);1215 1216template <class ForwardIterator1, class ForwardIterator2>1217 constexpr ForwardIterator1 // constexpr since C++201218 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,1219 ForwardIterator2 first2, ForwardIterator2 last2);1220 1221template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>1222 constexpr ForwardIterator1 // constexpr since C++201223 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,1224 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);1225 1226template <class ForwardIterator>1227 constexpr ForwardIterator // constexpr since C++201228 adjacent_find(ForwardIterator first, ForwardIterator last);1229 1230template <class ForwardIterator, class BinaryPredicate>1231 constexpr ForwardIterator // constexpr since C++201232 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);1233 1234template <class InputIterator, class T>1235 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++201236 count(InputIterator first, InputIterator last, const T& value);1237 1238template <class InputIterator, class Predicate>1239 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr since C++201240 count_if(InputIterator first, InputIterator last, Predicate pred);1241 1242template <class InputIterator1, class InputIterator2>1243 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++201244 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);1245 1246template <class InputIterator1, class InputIterator2>1247 constexpr pair<InputIterator1, InputIterator2>1248 mismatch(InputIterator1 first1, InputIterator1 last1,1249 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++201250 1251template <class InputIterator1, class InputIterator2, class BinaryPredicate>1252 constexpr pair<InputIterator1, InputIterator2> // constexpr since C++201253 mismatch(InputIterator1 first1, InputIterator1 last1,1254 InputIterator2 first2, BinaryPredicate pred);1255 1256template <class InputIterator1, class InputIterator2, class BinaryPredicate>1257 constexpr pair<InputIterator1, InputIterator2>1258 mismatch(InputIterator1 first1, InputIterator1 last1,1259 InputIterator2 first2, InputIterator2 last2,1260 BinaryPredicate pred); // since C++14, constexpr since C++201261 1262template <class InputIterator1, class InputIterator2>1263 constexpr bool // constexpr since C++201264 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);1265 1266template <class InputIterator1, class InputIterator2>1267 constexpr bool1268 equal(InputIterator1 first1, InputIterator1 last1,1269 InputIterator2 first2, InputIterator2 last2); // since C++14, constexpr since C++201270 1271template <class InputIterator1, class InputIterator2, class BinaryPredicate>1272 constexpr bool // constexpr since C++201273 equal(InputIterator1 first1, InputIterator1 last1,1274 InputIterator2 first2, BinaryPredicate pred);1275 1276template <class InputIterator1, class InputIterator2, class BinaryPredicate>1277 constexpr bool1278 equal(InputIterator1 first1, InputIterator1 last1,1279 InputIterator2 first2, InputIterator2 last2,1280 BinaryPredicate pred); // since C++14, constexpr since C++201281 1282template<class ForwardIterator1, class ForwardIterator2>1283 constexpr bool // constexpr since C++201284 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,1285 ForwardIterator2 first2);1286 1287template<class ForwardIterator1, class ForwardIterator2>1288 constexpr bool1289 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,1290 ForwardIterator2 first2, ForwardIterator2 last2); // since C++14, constexpr since C++201291 1292template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>1293 constexpr bool // constexpr since C++201294 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,1295 ForwardIterator2 first2, BinaryPredicate pred);1296 1297template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>1298 constexpr bool1299 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,1300 ForwardIterator2 first2, ForwardIterator2 last2,1301 BinaryPredicate pred); // since C++14, constexpr since C++201302 1303template <class ForwardIterator1, class ForwardIterator2>1304 constexpr ForwardIterator1 // constexpr since C++201305 search(ForwardIterator1 first1, ForwardIterator1 last1,1306 ForwardIterator2 first2, ForwardIterator2 last2);1307 1308template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>1309 constexpr ForwardIterator1 // constexpr since C++201310 search(ForwardIterator1 first1, ForwardIterator1 last1,1311 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);1312 1313template <class ForwardIterator, class Size, class T>1314 constexpr ForwardIterator // constexpr since C++201315 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);1316 1317template <class ForwardIterator, class Size, class T, class BinaryPredicate>1318 constexpr ForwardIterator // constexpr since C++201319 search_n(ForwardIterator first, ForwardIterator last,1320 Size count, const T& value, BinaryPredicate pred);1321 1322template <class InputIterator, class OutputIterator>1323 constexpr OutputIterator // constexpr since C++201324 copy(InputIterator first, InputIterator last, OutputIterator result);1325 1326template<class InputIterator, class OutputIterator, class Predicate>1327 constexpr OutputIterator // constexpr since C++201328 copy_if(InputIterator first, InputIterator last,1329 OutputIterator result, Predicate pred);1330 1331template<class InputIterator, class Size, class OutputIterator>1332 constexpr OutputIterator // constexpr since C++201333 copy_n(InputIterator first, Size n, OutputIterator result);1334 1335template <class BidirectionalIterator1, class BidirectionalIterator2>1336 constexpr BidirectionalIterator2 // constexpr since C++201337 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,1338 BidirectionalIterator2 result);1339 1340// [alg.move], move1341template<class InputIterator, class OutputIterator>1342 constexpr OutputIterator move(InputIterator first, InputIterator last,1343 OutputIterator result);1344 1345template<class BidirectionalIterator1, class BidirectionalIterator2>1346 constexpr BidirectionalIterator21347 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,1348 BidirectionalIterator2 result);1349 1350template <class ForwardIterator1, class ForwardIterator2>1351 constexpr ForwardIterator2 // constexpr since C++201352 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);1353 1354namespace ranges {1355 template<class I1, class I2>1356 using swap_ranges_result = in_in_result<I1, I2>;1357 1358template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>1359 requires indirectly_swappable<I1, I2>1360 constexpr ranges::swap_ranges_result<I1, I2>1361 swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);1362 1363template<input_range R1, input_range R2>1364 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>1365 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>1366 swap_ranges(R1&& r1, R2&& r2);1367}1368 1369template <class ForwardIterator1, class ForwardIterator2>1370 constexpr void // constexpr since C++201371 iter_swap(ForwardIterator1 a, ForwardIterator2 b);1372 1373template <class InputIterator, class OutputIterator, class UnaryOperation>1374 constexpr OutputIterator // constexpr since C++201375 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);1376 1377template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>1378 constexpr OutputIterator // constexpr since C++201379 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,1380 OutputIterator result, BinaryOperation binary_op);1381 1382template <class ForwardIterator, class T>1383 constexpr void // constexpr since C++201384 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);1385 1386template <class ForwardIterator, class Predicate, class T>1387 constexpr void // constexpr since C++201388 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);1389 1390template <class InputIterator, class OutputIterator, class T>1391 constexpr OutputIterator // constexpr since C++201392 replace_copy(InputIterator first, InputIterator last, OutputIterator result,1393 const T& old_value, const T& new_value);1394 1395template <class InputIterator, class OutputIterator, class Predicate, class T>1396 constexpr OutputIterator // constexpr since C++201397 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);1398 1399template <class ForwardIterator, class T>1400 constexpr void // constexpr since C++201401 fill(ForwardIterator first, ForwardIterator last, const T& value);1402 1403template <class OutputIterator, class Size, class T>1404 constexpr OutputIterator // constexpr since C++201405 fill_n(OutputIterator first, Size n, const T& value);1406 1407template <class ForwardIterator, class Generator>1408 constexpr void // constexpr since C++201409 generate(ForwardIterator first, ForwardIterator last, Generator gen);1410 1411template <class OutputIterator, class Size, class Generator>1412 constexpr OutputIterator // constexpr since C++201413 generate_n(OutputIterator first, Size n, Generator gen);1414 1415template <class ForwardIterator, class T>1416 constexpr ForwardIterator // constexpr since C++201417 remove(ForwardIterator first, ForwardIterator last, const T& value);1418 1419template <class ForwardIterator, class Predicate>1420 constexpr ForwardIterator // constexpr since C++201421 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);1422 1423template <class InputIterator, class OutputIterator, class T>1424 constexpr OutputIterator // constexpr since C++201425 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);1426 1427template <class InputIterator, class OutputIterator, class Predicate>1428 constexpr OutputIterator // constexpr since C++201429 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);1430 1431template <class ForwardIterator>1432 constexpr ForwardIterator // constexpr since C++201433 unique(ForwardIterator first, ForwardIterator last);1434 1435template <class ForwardIterator, class BinaryPredicate>1436 constexpr ForwardIterator // constexpr since C++201437 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);1438 1439template <class InputIterator, class OutputIterator>1440 constexpr OutputIterator // constexpr since C++201441 unique_copy(InputIterator first, InputIterator last, OutputIterator result);1442 1443template <class InputIterator, class OutputIterator, class BinaryPredicate>1444 constexpr OutputIterator // constexpr since C++201445 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);1446 1447template <class BidirectionalIterator>1448 constexpr void // constexpr since C++201449 reverse(BidirectionalIterator first, BidirectionalIterator last);1450 1451template <class BidirectionalIterator, class OutputIterator>1452 constexpr OutputIterator // constexpr since C++201453 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);1454 1455template <class ForwardIterator>1456 constexpr ForwardIterator // constexpr since C++201457 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);1458 1459template <class ForwardIterator, class OutputIterator>1460 constexpr OutputIterator // constexpr since C++201461 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);1462 1463template <class RandomAccessIterator>1464 void1465 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++171466 1467template <class RandomAccessIterator, class RandomNumberGenerator>1468 void1469 random_shuffle(RandomAccessIterator first, RandomAccessIterator last,1470 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++171471 1472template<class PopulationIterator, class SampleIterator,1473 class Distance, class UniformRandomBitGenerator>1474 SampleIterator sample(PopulationIterator first, PopulationIterator last,1475 SampleIterator out, Distance n,1476 UniformRandomBitGenerator&& g); // C++171477 1478template<class RandomAccessIterator, class UniformRandomNumberGenerator>1479 void shuffle(RandomAccessIterator first, RandomAccessIterator last,1480 UniformRandomNumberGenerator&& g);1481 1482template<class ForwardIterator>1483 constexpr ForwardIterator1484 shift_left(ForwardIterator first, ForwardIterator last,1485 typename iterator_traits<ForwardIterator>::difference_type n); // C++201486 1487template<class ForwardIterator>1488 constexpr ForwardIterator1489 shift_right(ForwardIterator first, ForwardIterator last,1490 typename iterator_traits<ForwardIterator>::difference_type n); // C++201491 1492template <class InputIterator, class Predicate>1493 constexpr bool // constexpr since C++201494 is_partitioned(InputIterator first, InputIterator last, Predicate pred);1495 1496template <class ForwardIterator, class Predicate>1497 constexpr ForwardIterator // constexpr since C++201498 partition(ForwardIterator first, ForwardIterator last, Predicate pred);1499 1500template <class InputIterator, class OutputIterator1,1501 class OutputIterator2, class Predicate>1502 constexpr pair<OutputIterator1, OutputIterator2> // constexpr since C++201503 partition_copy(InputIterator first, InputIterator last,1504 OutputIterator1 out_true, OutputIterator2 out_false,1505 Predicate pred);1506 1507template <class ForwardIterator, class Predicate>1508 constexpr ForwardIterator // constexpr since C++261509 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);1510 1511template<class ForwardIterator, class Predicate>1512 constexpr ForwardIterator // constexpr since C++201513 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);1514 1515template <class ForwardIterator>1516 constexpr bool // constexpr since C++201517 is_sorted(ForwardIterator first, ForwardIterator last);1518 1519template <class ForwardIterator, class Compare>1520 constexpr bool // constexpr since C++201521 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);1522 1523template<class ForwardIterator>1524 constexpr ForwardIterator // constexpr since C++201525 is_sorted_until(ForwardIterator first, ForwardIterator last);1526 1527template <class ForwardIterator, class Compare>1528 constexpr ForwardIterator // constexpr since C++201529 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);1530 1531template <class RandomAccessIterator>1532 constexpr void // constexpr since C++201533 sort(RandomAccessIterator first, RandomAccessIterator last);1534 1535template <class RandomAccessIterator, class Compare>1536 constexpr void // constexpr since C++201537 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1538 1539template <class RandomAccessIterator>1540 constexpr void // constexpr since C++261541 stable_sort(RandomAccessIterator first, RandomAccessIterator last);1542 1543template <class RandomAccessIterator, class Compare>1544 constexpr void // constexpr since C++261545 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1546 1547template <class RandomAccessIterator>1548 constexpr void // constexpr since C++201549 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);1550 1551template <class RandomAccessIterator, class Compare>1552 constexpr void // constexpr since C++201553 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);1554 1555template <class InputIterator, class RandomAccessIterator>1556 constexpr RandomAccessIterator // constexpr since C++201557 partial_sort_copy(InputIterator first, InputIterator last,1558 RandomAccessIterator result_first, RandomAccessIterator result_last);1559 1560template <class InputIterator, class RandomAccessIterator, class Compare>1561 constexpr RandomAccessIterator // constexpr since C++201562 partial_sort_copy(InputIterator first, InputIterator last,1563 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);1564 1565template <class RandomAccessIterator>1566 constexpr void // constexpr since C++201567 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);1568 1569template <class RandomAccessIterator, class Compare>1570 constexpr void // constexpr since C++201571 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);1572 1573template <class ForwardIterator, class T>1574 constexpr ForwardIterator // constexpr since C++201575 lower_bound(ForwardIterator first, ForwardIterator last, const T& value);1576 1577template <class ForwardIterator, class T, class Compare>1578 constexpr ForwardIterator // constexpr since C++201579 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);1580 1581template <class ForwardIterator, class T>1582 constexpr ForwardIterator // constexpr since C++201583 upper_bound(ForwardIterator first, ForwardIterator last, const T& value);1584 1585template <class ForwardIterator, class T, class Compare>1586 constexpr ForwardIterator // constexpr since C++201587 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);1588 1589template <class ForwardIterator, class T>1590 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++201591 equal_range(ForwardIterator first, ForwardIterator last, const T& value);1592 1593template <class ForwardIterator, class T, class Compare>1594 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++201595 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);1596 1597template <class ForwardIterator, class T>1598 constexpr bool // constexpr since C++201599 binary_search(ForwardIterator first, ForwardIterator last, const T& value);1600 1601template <class ForwardIterator, class T, class Compare>1602 constexpr bool // constexpr since C++201603 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);1604 1605template <class InputIterator1, class InputIterator2, class OutputIterator>1606 constexpr OutputIterator // constexpr since C++201607 merge(InputIterator1 first1, InputIterator1 last1,1608 InputIterator2 first2, InputIterator2 last2, OutputIterator result);1609 1610template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>1611 constexpr OutputIterator // constexpr since C++201612 merge(InputIterator1 first1, InputIterator1 last1,1613 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);1614 1615template <class BidirectionalIterator>1616 constexpr void // constexpr since C++261617 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);1618 1619template <class BidirectionalIterator, class Compare>1620 constexpr void // constexpr since C++261621 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);1622 1623template <class InputIterator1, class InputIterator2>1624 constexpr bool // constexpr since C++201625 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);1626 1627template <class InputIterator1, class InputIterator2, class Compare>1628 constexpr bool // constexpr since C++201629 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);1630 1631template <class InputIterator1, class InputIterator2, class OutputIterator>1632 constexpr OutputIterator // constexpr since C++201633 set_union(InputIterator1 first1, InputIterator1 last1,1634 InputIterator2 first2, InputIterator2 last2, OutputIterator result);1635 1636template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>1637 constexpr OutputIterator // constexpr since C++201638 set_union(InputIterator1 first1, InputIterator1 last1,1639 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);1640 1641template <class InputIterator1, class InputIterator2, class OutputIterator>1642 constexpr OutputIterator // constexpr since C++201643 set_intersection(InputIterator1 first1, InputIterator1 last1,1644 InputIterator2 first2, InputIterator2 last2, OutputIterator result);1645 1646template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>1647 constexpr OutputIterator // constexpr since C++201648 set_intersection(InputIterator1 first1, InputIterator1 last1,1649 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);1650 1651template <class InputIterator1, class InputIterator2, class OutputIterator>1652 constexpr OutputIterator // constexpr since C++201653 set_difference(InputIterator1 first1, InputIterator1 last1,1654 InputIterator2 first2, InputIterator2 last2, OutputIterator result);1655 1656template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>1657 constexpr OutputIterator // constexpr since C++201658 set_difference(InputIterator1 first1, InputIterator1 last1,1659 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);1660 1661template <class InputIterator1, class InputIterator2, class OutputIterator>1662 constexpr OutputIterator // constexpr since C++201663 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,1664 InputIterator2 first2, InputIterator2 last2, OutputIterator result);1665 1666template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>1667 constexpr OutputIterator // constexpr since C++201668 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,1669 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);1670 1671template <class RandomAccessIterator>1672 constexpr void // constexpr since C++201673 push_heap(RandomAccessIterator first, RandomAccessIterator last);1674 1675template <class RandomAccessIterator, class Compare>1676 constexpr void // constexpr since C++201677 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1678 1679template <class RandomAccessIterator>1680 constexpr void // constexpr since C++201681 pop_heap(RandomAccessIterator first, RandomAccessIterator last);1682 1683template <class RandomAccessIterator, class Compare>1684 constexpr void // constexpr since C++201685 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1686 1687template <class RandomAccessIterator>1688 constexpr void // constexpr since C++201689 make_heap(RandomAccessIterator first, RandomAccessIterator last);1690 1691template <class RandomAccessIterator, class Compare>1692 constexpr void // constexpr since C++201693 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1694 1695template <class RandomAccessIterator>1696 constexpr void // constexpr since C++201697 sort_heap(RandomAccessIterator first, RandomAccessIterator last);1698 1699template <class RandomAccessIterator, class Compare>1700 constexpr void // constexpr since C++201701 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);1702 1703template <class RandomAccessIterator>1704 constexpr bool // constexpr since C++201705 is_heap(RandomAccessIterator first, RandomAccessiterator last);1706 1707template <class RandomAccessIterator, class Compare>1708 constexpr bool // constexpr since C++201709 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);1710 1711template <class RandomAccessIterator>1712 constexpr RandomAccessIterator // constexpr since C++201713 is_heap_until(RandomAccessIterator first, RandomAccessiterator last);1714 1715template <class RandomAccessIterator, class Compare>1716 constexpr RandomAccessIterator // constexpr since C++201717 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);1718 1719template <class ForwardIterator>1720 constexpr ForwardIterator // constexpr since C++141721 min_element(ForwardIterator first, ForwardIterator last);1722 1723template <class ForwardIterator, class Compare>1724 constexpr ForwardIterator // constexpr since C++141725 min_element(ForwardIterator first, ForwardIterator last, Compare comp);1726 1727template <class T>1728 constexpr const T& // constexpr since C++141729 min(const T& a, const T& b);1730 1731template <class T, class Compare>1732 constexpr const T& // constexpr since C++141733 min(const T& a, const T& b, Compare comp);1734 1735template<class T>1736 constexpr T // constexpr since C++141737 min(initializer_list<T> t);1738 1739template<class T, class Compare>1740 constexpr T // constexpr since C++141741 min(initializer_list<T> t, Compare comp);1742 1743template<class T>1744 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++171745 1746template<class T, class Compare>1747 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++171748 1749template <class ForwardIterator>1750 constexpr ForwardIterator // constexpr since C++141751 max_element(ForwardIterator first, ForwardIterator last);1752 1753template <class ForwardIterator, class Compare>1754 constexpr ForwardIterator // constexpr since C++141755 max_element(ForwardIterator first, ForwardIterator last, Compare comp);1756 1757template <class T>1758 constexpr const T& // constexpr since C++141759 max(const T& a, const T& b);1760 1761template <class T, class Compare>1762 constexpr const T& // constexpr since C++141763 max(const T& a, const T& b, Compare comp);1764 1765template<class T>1766 constexpr T // constexpr since C++141767 max(initializer_list<T> t);1768 1769template<class T, class Compare>1770 constexpr T // constexpr since C++141771 max(initializer_list<T> t, Compare comp);1772 1773template<class ForwardIterator>1774 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++141775 minmax_element(ForwardIterator first, ForwardIterator last);1776 1777template<class ForwardIterator, class Compare>1778 constexpr pair<ForwardIterator, ForwardIterator> // constexpr since C++141779 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);1780 1781template<class T>1782 constexpr pair<const T&, const T&> // constexpr since C++141783 minmax(const T& a, const T& b);1784 1785template<class T, class Compare>1786 constexpr pair<const T&, const T&> // constexpr since C++141787 minmax(const T& a, const T& b, Compare comp);1788 1789template<class T>1790 constexpr pair<T, T> // constexpr since C++141791 minmax(initializer_list<T> t);1792 1793template<class T, class Compare>1794 constexpr pair<T, T> // constexpr since C++141795 minmax(initializer_list<T> t, Compare comp);1796 1797template <class InputIterator1, class InputIterator2>1798 constexpr bool // constexpr since C++201799 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);1800 1801template <class InputIterator1, class InputIterator2, class Compare>1802 constexpr bool // constexpr since C++201803 lexicographical_compare(InputIterator1 first1, InputIterator1 last1,1804 InputIterator2 first2, InputIterator2 last2, Compare comp);1805 1806template<class InputIterator1, class InputIterator2, class Cmp>1807 constexpr auto1808 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,1809 InputIterator2 first2, InputIterator2 last2,1810 Cmp comp)1811 -> decltype(comp(*b1, *b2)); // since C++201812 1813template<class InputIterator1, class InputIterator2>1814 constexpr auto1815 lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1,1816 InputIterator2 first2, InputIterator2 last2); // since C++201817 1818template <class BidirectionalIterator>1819 constexpr bool // constexpr since C++201820 next_permutation(BidirectionalIterator first, BidirectionalIterator last);1821 1822template <class BidirectionalIterator, class Compare>1823 constexpr bool // constexpr since C++201824 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);1825 1826template <class BidirectionalIterator>1827 constexpr bool // constexpr since C++201828 prev_permutation(BidirectionalIterator first, BidirectionalIterator last);1829 1830template <class BidirectionalIterator, class Compare>1831 constexpr bool // constexpr since C++201832 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);1833} // std1834 1835*/1836 1837#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)1838# include <__cxx03/algorithm>1839#else1840# include <__config>1841 1842# include <__algorithm/adjacent_find.h>1843# include <__algorithm/all_of.h>1844# include <__algorithm/any_of.h>1845# include <__algorithm/binary_search.h>1846# include <__algorithm/copy.h>1847# include <__algorithm/copy_backward.h>1848# include <__algorithm/copy_if.h>1849# include <__algorithm/copy_n.h>1850# include <__algorithm/count.h>1851# include <__algorithm/count_if.h>1852# include <__algorithm/equal.h>1853# include <__algorithm/equal_range.h>1854# include <__algorithm/fill.h>1855# include <__algorithm/fill_n.h>1856# include <__algorithm/find.h>1857# include <__algorithm/find_end.h>1858# include <__algorithm/find_first_of.h>1859# include <__algorithm/find_if.h>1860# include <__algorithm/find_if_not.h>1861# include <__algorithm/for_each.h>1862# include <__algorithm/generate.h>1863# include <__algorithm/generate_n.h>1864# include <__algorithm/includes.h>1865# include <__algorithm/inplace_merge.h>1866# include <__algorithm/is_heap.h>1867# include <__algorithm/is_heap_until.h>1868# include <__algorithm/is_partitioned.h>1869# include <__algorithm/is_permutation.h>1870# include <__algorithm/is_sorted.h>1871# include <__algorithm/is_sorted_until.h>1872# include <__algorithm/iter_swap.h>1873# include <__algorithm/lexicographical_compare.h>1874# include <__algorithm/lower_bound.h>1875# include <__algorithm/make_heap.h>1876# include <__algorithm/max.h>1877# include <__algorithm/max_element.h>1878# include <__algorithm/merge.h>1879# include <__algorithm/min.h>1880# include <__algorithm/min_element.h>1881# include <__algorithm/minmax.h>1882# include <__algorithm/minmax_element.h>1883# include <__algorithm/mismatch.h>1884# include <__algorithm/move.h>1885# include <__algorithm/move_backward.h>1886# include <__algorithm/next_permutation.h>1887# include <__algorithm/none_of.h>1888# include <__algorithm/nth_element.h>1889# include <__algorithm/partial_sort.h>1890# include <__algorithm/partial_sort_copy.h>1891# include <__algorithm/partition.h>1892# include <__algorithm/partition_copy.h>1893# include <__algorithm/partition_point.h>1894# include <__algorithm/pop_heap.h>1895# include <__algorithm/prev_permutation.h>1896# include <__algorithm/push_heap.h>1897# include <__algorithm/remove.h>1898# include <__algorithm/remove_copy.h>1899# include <__algorithm/remove_copy_if.h>1900# include <__algorithm/remove_if.h>1901# include <__algorithm/replace.h>1902# include <__algorithm/replace_copy.h>1903# include <__algorithm/replace_copy_if.h>1904# include <__algorithm/replace_if.h>1905# include <__algorithm/reverse.h>1906# include <__algorithm/reverse_copy.h>1907# include <__algorithm/rotate.h>1908# include <__algorithm/rotate_copy.h>1909# include <__algorithm/search.h>1910# include <__algorithm/search_n.h>1911# include <__algorithm/set_difference.h>1912# include <__algorithm/set_intersection.h>1913# include <__algorithm/set_symmetric_difference.h>1914# include <__algorithm/set_union.h>1915# include <__algorithm/shuffle.h>1916# include <__algorithm/sort.h>1917# include <__algorithm/sort_heap.h>1918# include <__algorithm/stable_partition.h>1919# include <__algorithm/stable_sort.h>1920# include <__algorithm/swap_ranges.h>1921# include <__algorithm/transform.h>1922# include <__algorithm/unique.h>1923# include <__algorithm/unique_copy.h>1924# include <__algorithm/upper_bound.h>1925 1926# if _LIBCPP_STD_VER >= 171927# include <__algorithm/clamp.h>1928# include <__algorithm/for_each_n.h>1929# include <__algorithm/pstl.h>1930# include <__algorithm/sample.h>1931# endif // _LIBCPP_STD_VER >= 171932 1933# if _LIBCPP_STD_VER >= 201934# include <__algorithm/in_found_result.h>1935# include <__algorithm/in_fun_result.h>1936# include <__algorithm/in_in_out_result.h>1937# include <__algorithm/in_in_result.h>1938# include <__algorithm/in_out_out_result.h>1939# include <__algorithm/in_out_result.h>1940# include <__algorithm/lexicographical_compare_three_way.h>1941# include <__algorithm/min_max_result.h>1942# include <__algorithm/out_value_result.h>1943# include <__algorithm/ranges_adjacent_find.h>1944# include <__algorithm/ranges_all_of.h>1945# include <__algorithm/ranges_any_of.h>1946# include <__algorithm/ranges_binary_search.h>1947# include <__algorithm/ranges_clamp.h>1948# include <__algorithm/ranges_contains.h>1949# include <__algorithm/ranges_copy.h>1950# include <__algorithm/ranges_copy_backward.h>1951# include <__algorithm/ranges_copy_if.h>1952# include <__algorithm/ranges_copy_n.h>1953# include <__algorithm/ranges_count.h>1954# include <__algorithm/ranges_count_if.h>1955# include <__algorithm/ranges_equal.h>1956# include <__algorithm/ranges_equal_range.h>1957# include <__algorithm/ranges_fill.h>1958# include <__algorithm/ranges_fill_n.h>1959# include <__algorithm/ranges_find.h>1960# include <__algorithm/ranges_find_end.h>1961# include <__algorithm/ranges_find_first_of.h>1962# include <__algorithm/ranges_find_if.h>1963# include <__algorithm/ranges_find_if_not.h>1964# include <__algorithm/ranges_for_each.h>1965# include <__algorithm/ranges_for_each_n.h>1966# include <__algorithm/ranges_generate.h>1967# include <__algorithm/ranges_generate_n.h>1968# include <__algorithm/ranges_includes.h>1969# include <__algorithm/ranges_inplace_merge.h>1970# include <__algorithm/ranges_is_heap.h>1971# include <__algorithm/ranges_is_heap_until.h>1972# include <__algorithm/ranges_is_partitioned.h>1973# include <__algorithm/ranges_is_permutation.h>1974# include <__algorithm/ranges_is_sorted.h>1975# include <__algorithm/ranges_is_sorted_until.h>1976# include <__algorithm/ranges_lexicographical_compare.h>1977# include <__algorithm/ranges_lower_bound.h>1978# include <__algorithm/ranges_make_heap.h>1979# include <__algorithm/ranges_max.h>1980# include <__algorithm/ranges_max_element.h>1981# include <__algorithm/ranges_merge.h>1982# include <__algorithm/ranges_min.h>1983# include <__algorithm/ranges_min_element.h>1984# include <__algorithm/ranges_minmax.h>1985# include <__algorithm/ranges_minmax_element.h>1986# include <__algorithm/ranges_mismatch.h>1987# include <__algorithm/ranges_move.h>1988# include <__algorithm/ranges_move_backward.h>1989# include <__algorithm/ranges_next_permutation.h>1990# include <__algorithm/ranges_none_of.h>1991# include <__algorithm/ranges_nth_element.h>1992# include <__algorithm/ranges_partial_sort.h>1993# include <__algorithm/ranges_partial_sort_copy.h>1994# include <__algorithm/ranges_partition.h>1995# include <__algorithm/ranges_partition_copy.h>1996# include <__algorithm/ranges_partition_point.h>1997# include <__algorithm/ranges_pop_heap.h>1998# include <__algorithm/ranges_prev_permutation.h>1999# include <__algorithm/ranges_push_heap.h>2000# include <__algorithm/ranges_remove.h>2001# include <__algorithm/ranges_remove_copy.h>2002# include <__algorithm/ranges_remove_copy_if.h>2003# include <__algorithm/ranges_remove_if.h>2004# include <__algorithm/ranges_replace.h>2005# include <__algorithm/ranges_replace_copy.h>2006# include <__algorithm/ranges_replace_copy_if.h>2007# include <__algorithm/ranges_replace_if.h>2008# include <__algorithm/ranges_reverse.h>2009# include <__algorithm/ranges_reverse_copy.h>2010# include <__algorithm/ranges_rotate.h>2011# include <__algorithm/ranges_rotate_copy.h>2012# include <__algorithm/ranges_sample.h>2013# include <__algorithm/ranges_search.h>2014# include <__algorithm/ranges_search_n.h>2015# include <__algorithm/ranges_set_difference.h>2016# include <__algorithm/ranges_set_intersection.h>2017# include <__algorithm/ranges_set_symmetric_difference.h>2018# include <__algorithm/ranges_set_union.h>2019# include <__algorithm/ranges_shuffle.h>2020# include <__algorithm/ranges_sort.h>2021# include <__algorithm/ranges_sort_heap.h>2022# include <__algorithm/ranges_stable_partition.h>2023# include <__algorithm/ranges_stable_sort.h>2024# include <__algorithm/ranges_swap_ranges.h>2025# include <__algorithm/ranges_transform.h>2026# include <__algorithm/ranges_unique.h>2027# include <__algorithm/ranges_unique_copy.h>2028# include <__algorithm/ranges_upper_bound.h>2029# include <__algorithm/shift_left.h>2030# include <__algorithm/shift_right.h>2031# endif2032 2033# if _LIBCPP_STD_VER >= 232034# include <__algorithm/ranges_contains_subrange.h>2035# include <__algorithm/ranges_ends_with.h>2036# include <__algorithm/ranges_find_last.h>2037# include <__algorithm/ranges_fold.h>2038# include <__algorithm/ranges_starts_with.h>2039# endif // _LIBCPP_STD_VER >= 232040 2041# include <version>2042 2043// standard-mandated includes2044 2045// [algorithm.syn]2046# include <initializer_list>2047 2048# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)2049# pragma GCC system_header2050# endif2051 2052# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 142053# include <execution>2054# endif2055 2056# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 202057# include <atomic>2058# include <bit>2059# include <concepts>2060# include <cstdlib>2061# include <cstring>2062# include <iterator>2063# include <memory>2064# include <optional>2065# include <stdexcept>2066# include <type_traits>2067# include <utility>2068# endif2069#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)2070 2071#endif // _LIBCPP_ALGORITHM2072