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