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 template <class I, class F> 23 struct in_fun_result; // since C++20 24 25 template <class I1, class I2> 26 struct in_in_result; // since C++20 27 28 template <class I1, class I2, class O> 29 struct in_in_out_result; // since C++20 30 31 template <class I, class O1, class O2> 32 struct in_out_out_result; // since C++20 33 34 template <class I1, class I2> 35 struct min_max_result; // since C++20 36 37 template <class I> 38 struct in_found_result; // since C++20 39 40 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 41 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 42 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); 43 44 template<forward_range R, class Proj = identity, 45 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 46 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); 47 48 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 49 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 50 constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 51 52 template<forward_range R, class Proj = identity, 53 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 54 constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 55 56 57 template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, 58 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 59 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 60 constexpr mismatch_result<_I1, _I2> 61 mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 62 63 template <input_range R1, input_range R2, 64 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 65 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 66 constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 67 mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 68 69 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 70 constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 71 72 template<input_range R, class T, class Proj = identity> 73 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 74 constexpr borrowed_iterator_t<R> 75 find(R&& r, const T& value, Proj proj = {}); // since C++20 76 77 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 78 indirect_unary_predicate<projected<I, Proj>> Pred> 79 constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 80 81 template<input_range R, class Proj = identity, 82 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 83 constexpr borrowed_iterator_t<R> 84 find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 85 86 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 87 indirect_unary_predicate<projected<I, Proj>> Pred> 88 constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 89 90 template<input_range R, class Proj = identity, 91 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 92 constexpr borrowed_iterator_t<R> 93 find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 94 95 template<class T, class Proj = identity, 96 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 97 constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 98 99 template<copyable T, class Proj = identity, 100 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 101 constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 102 103 template<input_range R, class Proj = identity, 104 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 105 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 106 constexpr range_value_t<R> 107 min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 108 109 template<class T, class Proj = identity, 110 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 111 constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 112 113 template<copyable T, class Proj = identity, 114 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 115 constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 116 117 template<input_range R, class Proj = identity, 118 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 119 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 120 constexpr range_value_t<R> 121 max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 122 123 template<class I, class O> 124 using unary_transform_result = in_out_result<I, O>; // since C++20 125 126 template<class I1, class I2, class O> 127 using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 128 129 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, 130 copy_constructible F, class Proj = identity> 131 requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> 132 constexpr ranges::unary_transform_result<I, O> 133 transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 134 135 template<input_range R, weakly_incrementable O, copy_constructible F, 136 class Proj = identity> 137 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> 138 constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> 139 transform(R&& r, O result, F op, Proj proj = {}); // since C++20 140 141 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 142 weakly_incrementable O, copy_constructible F, class Proj1 = identity, 143 class Proj2 = identity> 144 requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, 145 projected<I2, Proj2>>> 146 constexpr ranges::binary_transform_result<I1, I2, O> 147 transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, 148 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 149 150 template<input_range R1, input_range R2, weakly_incrementable O, 151 copy_constructible F, class Proj1 = identity, class Proj2 = identity> 152 requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, 153 projected<iterator_t<R2>, Proj2>>> 154 constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> 155 transform(R1&& r1, R2&& r2, O result, 156 F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 157 158 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> 159 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> 160 constexpr iter_difference_t<I> 161 count(I first, S last, const T& value, Proj proj = {}); // since C++20 162 163 template<input_range R, class T, class Proj = identity> 164 requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> 165 constexpr range_difference_t<R> 166 count(R&& r, const T& value, Proj proj = {}); // since C++20 167 168 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 169 indirect_unary_predicate<projected<I, Proj>> Pred> 170 constexpr iter_difference_t<I> 171 count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 172 173 template<input_range R, class Proj = identity, 174 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 175 constexpr range_difference_t<R> 176 count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 177 178 template<class T, class Proj = identity, 179 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 180 constexpr ranges::minmax_result<const T&> 181 minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 182 183 template<copyable T, class Proj = identity, 184 indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> 185 constexpr ranges::minmax_result<T> 186 minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 187 188 template<input_range R, class Proj = identity, 189 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 190 requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> 191 constexpr ranges::minmax_result<range_value_t<R>> 192 minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 193 194 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, 195 indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> 196 constexpr ranges::minmax_element_result<I> 197 minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 198 199 template<forward_range R, class Proj = identity, 200 indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> 201 constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> 202 minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 203 204 template<class I, class O> 205 using copy_result = in_out_result<I, O>; // since C++20 206 207 template<class I, class O> 208 using copy_n_result = in_out_result<I, O>; // since C++20 209 210 template<class I, class O> 211 using copy_if_result = in_out_result<I, O>; // since C++20 212 213 template<class I1, class I2> 214 using copy_backward_result = in_out_result<I1, I2>; // since C++20 215 216 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> 217 requires indirectly_copyable<I, O> 218 constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 219 220 template<input_range R, weakly_incrementable O> 221 requires indirectly_copyable<iterator_t<R>, O> 222 constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20 223 224 template<input_iterator I, weakly_incrementable O> 225 requires indirectly_copyable<I, O> 226 constexpr ranges::copy_n_result<I, O> 227 ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20 228 229 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, 230 indirect_unary_predicate<projected<I, Proj>> Pred> 231 requires indirectly_copyable<I, O> 232 constexpr ranges::copy_if_result<I, O> 233 ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 234 235 template<input_range R, weakly_incrementable O, class Proj = identity, 236 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 237 requires indirectly_copyable<iterator_t<R>, O> 238 constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O> 239 ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 240 241 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> 242 requires indirectly_copyable<I1, I2> 243 constexpr ranges::copy_backward_result<I1, I2> 244 ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20 245 246 template<bidirectional_range R, bidirectional_iterator I> 247 requires indirectly_copyable<iterator_t<R>, I> 248 constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I> 249 ranges::copy_backward(R&& r, I result); // since C++20 250 251 template<class I, class F> 252 using for_each_result = in_fun_result<I, F>; // since C++20 253 254 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 255 indirectly_unary_invocable<projected<I, Proj>> Fun> 256 constexpr ranges::for_each_result<I, Fun> 257 ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20 258 259 template<input_range R, class Proj = identity, 260 indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun> 261 constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun> 262 ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20 263 264 template<input_iterator I, class Proj = identity, 265 indirectly_unary_invocable<projected<I, Proj>> Fun> 266 constexpr ranges::for_each_n_result<I, Fun> 267 ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20 268 269 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 270 indirect_unary_predicate<projected<I, Proj>> Pred> 271 constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20 272 273 template<input_range R, class Proj = identity, 274 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 275 constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 276 277 278 template<bidirectional_iterator I, sentinel_for<I> S> 279 requires permutable<I> 280 constexpr I ranges::reverse(I first, S last); // since C++20 281 282 template<bidirectional_range R> 283 requires permutable<iterator_t<R>> 284 constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 285 286 template<class T, output_iterator<const T&> O, sentinel_for<O> S> 287 constexpr O ranges::fill(O first, S last, const T& value); // since C++20 288 289 template<class T, output_range<const T&> R> 290 constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 291 292 template<class T, output_iterator<const T&> O> 293 constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20 294 295 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, 296 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> 297 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> 298 constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, 299 Pred pred = {}, 300 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 301 302 template<input_range R1, input_range R2, class Pred = ranges::equal_to, 303 class Proj1 = identity, class Proj2 = identity> 304 requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> 305 constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, 306 Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 307 308 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 309 indirect_unary_predicate<projected<I, Proj>> Pred> 310 constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 311 312 template<input_range R, class Proj = identity, 313 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 314 constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 315 316 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 317 indirect_unary_predicate<projected<I, Proj>> Pred> 318 constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 319 320 template<input_range R, class Proj = identity, 321 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 322 constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 323 324 template<input_iterator I, sentinel_for<I> S, class Proj = identity, 325 indirect_unary_predicate<projected<I, Proj>> Pred> 326 constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 327 328 template<input_range R, class Proj = identity, 329 indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> 330 constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 331 332} 333 334 constexpr bool // constexpr in C++20 335 all_of(InputIterator first, InputIterator last, Predicate pred); 336 337template <class InputIterator, class Predicate> 338 constexpr bool // constexpr in C++20 339 any_of(InputIterator first, InputIterator last, Predicate pred); 340 341template <class InputIterator, class Predicate> 342 constexpr bool // constexpr in C++20 343 none_of(InputIterator first, InputIterator last, Predicate pred); 344 345template <class InputIterator, class Function> 346 constexpr Function // constexpr in C++20 347 for_each(InputIterator first, InputIterator last, Function f); 348 349template<class InputIterator, class Size, class Function> 350 constexpr InputIterator // constexpr in C++20 351 for_each_n(InputIterator first, Size n, Function f); // C++17 352 353template <class InputIterator, class T> 354 constexpr InputIterator // constexpr in C++20 355 find(InputIterator first, InputIterator last, const T& value); 356 357template <class InputIterator, class Predicate> 358 constexpr InputIterator // constexpr in C++20 359 find_if(InputIterator first, InputIterator last, Predicate pred); 360 361template<class InputIterator, class Predicate> 362 constexpr InputIterator // constexpr in C++20 363 find_if_not(InputIterator first, InputIterator last, Predicate pred); 364 365template <class ForwardIterator1, class ForwardIterator2> 366 constexpr ForwardIterator1 // constexpr in C++20 367 find_end(ForwardIterator1 first1, ForwardIterator1 last1, 368 ForwardIterator2 first2, ForwardIterator2 last2); 369 370template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 371 constexpr ForwardIterator1 // constexpr in C++20 372 find_end(ForwardIterator1 first1, ForwardIterator1 last1, 373 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 374 375template <class ForwardIterator1, class ForwardIterator2> 376 constexpr ForwardIterator1 // constexpr in C++20 377 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 378 ForwardIterator2 first2, ForwardIterator2 last2); 379 380template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 381 constexpr ForwardIterator1 // constexpr in C++20 382 find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, 383 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 384 385template <class ForwardIterator> 386 constexpr ForwardIterator // constexpr in C++20 387 adjacent_find(ForwardIterator first, ForwardIterator last); 388 389template <class ForwardIterator, class BinaryPredicate> 390 constexpr ForwardIterator // constexpr in C++20 391 adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 392 393template <class InputIterator, class T> 394 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 395 count(InputIterator first, InputIterator last, const T& value); 396 397template <class InputIterator, class Predicate> 398 constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20 399 count_if(InputIterator first, InputIterator last, Predicate pred); 400 401template <class InputIterator1, class InputIterator2> 402 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 403 mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 404 405template <class InputIterator1, class InputIterator2> 406 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 407 mismatch(InputIterator1 first1, InputIterator1 last1, 408 InputIterator2 first2, InputIterator2 last2); // **C++14** 409 410template <class InputIterator1, class InputIterator2, class BinaryPredicate> 411 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 412 mismatch(InputIterator1 first1, InputIterator1 last1, 413 InputIterator2 first2, BinaryPredicate pred); 414 415template <class InputIterator1, class InputIterator2, class BinaryPredicate> 416 constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20 417 mismatch(InputIterator1 first1, InputIterator1 last1, 418 InputIterator2 first2, InputIterator2 last2, 419 BinaryPredicate pred); // **C++14** 420 421template <class InputIterator1, class InputIterator2> 422 constexpr bool // constexpr in C++20 423 equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); 424 425template <class InputIterator1, class InputIterator2> 426 constexpr bool // constexpr in C++20 427 equal(InputIterator1 first1, InputIterator1 last1, 428 InputIterator2 first2, InputIterator2 last2); // **C++14** 429 430template <class InputIterator1, class InputIterator2, class BinaryPredicate> 431 constexpr bool // constexpr in C++20 432 equal(InputIterator1 first1, InputIterator1 last1, 433 InputIterator2 first2, BinaryPredicate pred); 434 435template <class InputIterator1, class InputIterator2, class BinaryPredicate> 436 constexpr bool // constexpr in C++20 437 equal(InputIterator1 first1, InputIterator1 last1, 438 InputIterator2 first2, InputIterator2 last2, 439 BinaryPredicate pred); // **C++14** 440 441template<class ForwardIterator1, class ForwardIterator2> 442 constexpr bool // constexpr in C++20 443 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 444 ForwardIterator2 first2); 445 446template<class ForwardIterator1, class ForwardIterator2> 447 constexpr bool // constexpr in C++20 448 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 449 ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** 450 451template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 452 constexpr bool // constexpr in C++20 453 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 454 ForwardIterator2 first2, BinaryPredicate pred); 455 456template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 457 constexpr bool // constexpr in C++20 458 is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, 459 ForwardIterator2 first2, ForwardIterator2 last2, 460 BinaryPredicate pred); // **C++14** 461 462template <class ForwardIterator1, class ForwardIterator2> 463 constexpr ForwardIterator1 // constexpr in C++20 464 search(ForwardIterator1 first1, ForwardIterator1 last1, 465 ForwardIterator2 first2, ForwardIterator2 last2); 466 467template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> 468 constexpr ForwardIterator1 // constexpr in C++20 469 search(ForwardIterator1 first1, ForwardIterator1 last1, 470 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); 471 472template <class ForwardIterator, class Size, class T> 473 constexpr ForwardIterator // constexpr in C++20 474 search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); 475 476template <class ForwardIterator, class Size, class T, class BinaryPredicate> 477 constexpr ForwardIterator // constexpr in C++20 478 search_n(ForwardIterator first, ForwardIterator last, 479 Size count, const T& value, BinaryPredicate pred); 480 481template <class InputIterator, class OutputIterator> 482 constexpr OutputIterator // constexpr in C++20 483 copy(InputIterator first, InputIterator last, OutputIterator result); 484 485template<class InputIterator, class OutputIterator, class Predicate> 486 constexpr OutputIterator // constexpr in C++20 487 copy_if(InputIterator first, InputIterator last, 488 OutputIterator result, Predicate pred); 489 490template<class InputIterator, class Size, class OutputIterator> 491 constexpr OutputIterator // constexpr in C++20 492 copy_n(InputIterator first, Size n, OutputIterator result); 493 494template <class BidirectionalIterator1, class BidirectionalIterator2> 495 constexpr BidirectionalIterator2 // constexpr in C++20 496 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, 497 BidirectionalIterator2 result); 498 499template <class ForwardIterator1, class ForwardIterator2> 500 constexpr ForwardIterator2 // constexpr in C++20 501 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); 502 503template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> 504 requires indirectly_swappable<I1, I2> 505 constexpr ranges::swap_ranges_result<I1, I2> 506 ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); 507 508template<input_range R1, input_range R2> 509 requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> 510 constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> 511 ranges::swap_ranges(R1&& r1, R2&& r2); 512 513template <class ForwardIterator1, class ForwardIterator2> 514 constexpr void // constexpr in C++20 515 iter_swap(ForwardIterator1 a, ForwardIterator2 b); 516 517template <class InputIterator, class OutputIterator, class UnaryOperation> 518 constexpr OutputIterator // constexpr in C++20 519 transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); 520 521template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation> 522 constexpr OutputIterator // constexpr in C++20 523 transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, 524 OutputIterator result, BinaryOperation binary_op); 525 526template <class ForwardIterator, class T> 527 constexpr void // constexpr in C++20 528 replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); 529 530template <class ForwardIterator, class Predicate, class T> 531 constexpr void // constexpr in C++20 532 replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); 533 534template <class InputIterator, class OutputIterator, class T> 535 constexpr OutputIterator // constexpr in C++20 536 replace_copy(InputIterator first, InputIterator last, OutputIterator result, 537 const T& old_value, const T& new_value); 538 539template <class InputIterator, class OutputIterator, class Predicate, class T> 540 constexpr OutputIterator // constexpr in C++20 541 replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); 542 543template <class ForwardIterator, class T> 544 constexpr void // constexpr in C++20 545 fill(ForwardIterator first, ForwardIterator last, const T& value); 546 547template <class OutputIterator, class Size, class T> 548 constexpr OutputIterator // constexpr in C++20 549 fill_n(OutputIterator first, Size n, const T& value); 550 551template <class ForwardIterator, class Generator> 552 constexpr void // constexpr in C++20 553 generate(ForwardIterator first, ForwardIterator last, Generator gen); 554 555template <class OutputIterator, class Size, class Generator> 556 constexpr OutputIterator // constexpr in C++20 557 generate_n(OutputIterator first, Size n, Generator gen); 558 559template <class ForwardIterator, class T> 560 constexpr ForwardIterator // constexpr in C++20 561 remove(ForwardIterator first, ForwardIterator last, const T& value); 562 563template <class ForwardIterator, class Predicate> 564 constexpr ForwardIterator // constexpr in C++20 565 remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); 566 567template <class InputIterator, class OutputIterator, class T> 568 constexpr OutputIterator // constexpr in C++20 569 remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); 570 571template <class InputIterator, class OutputIterator, class Predicate> 572 constexpr OutputIterator // constexpr in C++20 573 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); 574 575template <class ForwardIterator> 576 constexpr ForwardIterator // constexpr in C++20 577 unique(ForwardIterator first, ForwardIterator last); 578 579template <class ForwardIterator, class BinaryPredicate> 580 constexpr ForwardIterator // constexpr in C++20 581 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); 582 583template <class InputIterator, class OutputIterator> 584 constexpr OutputIterator // constexpr in C++20 585 unique_copy(InputIterator first, InputIterator last, OutputIterator result); 586 587template <class InputIterator, class OutputIterator, class BinaryPredicate> 588 constexpr OutputIterator // constexpr in C++20 589 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); 590 591template <class BidirectionalIterator> 592 constexpr void // constexpr in C++20 593 reverse(BidirectionalIterator first, BidirectionalIterator last); 594 595template <class BidirectionalIterator, class OutputIterator> 596 constexpr OutputIterator // constexpr in C++20 597 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); 598 599template <class ForwardIterator> 600 constexpr ForwardIterator // constexpr in C++20 601 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); 602 603template <class ForwardIterator, class OutputIterator> 604 constexpr OutputIterator // constexpr in C++20 605 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); 606 607template <class RandomAccessIterator> 608 void 609 random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 610 611template <class RandomAccessIterator, class RandomNumberGenerator> 612 void 613 random_shuffle(RandomAccessIterator first, RandomAccessIterator last, 614 RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 615 616template<class PopulationIterator, class SampleIterator, 617 class Distance, class UniformRandomBitGenerator> 618 SampleIterator sample(PopulationIterator first, PopulationIterator last, 619 SampleIterator out, Distance n, 620 UniformRandomBitGenerator&& g); // C++17 621 622template<class RandomAccessIterator, class UniformRandomNumberGenerator> 623 void shuffle(RandomAccessIterator first, RandomAccessIterator last, 624 UniformRandomNumberGenerator&& g); 625 626template<class ForwardIterator> 627 constexpr ForwardIterator 628 shift_left(ForwardIterator first, ForwardIterator last, 629 typename iterator_traits<ForwardIterator>::difference_type n); // C++20 630 631template<class ForwardIterator> 632 constexpr ForwardIterator 633 shift_right(ForwardIterator first, ForwardIterator last, 634 typename iterator_traits<ForwardIterator>::difference_type n); // C++20 635 636template <class InputIterator, class Predicate> 637 constexpr bool // constexpr in C++20 638 is_partitioned(InputIterator first, InputIterator last, Predicate pred); 639 640template <class ForwardIterator, class Predicate> 641 constexpr ForwardIterator // constexpr in C++20 642 partition(ForwardIterator first, ForwardIterator last, Predicate pred); 643 644template <class InputIterator, class OutputIterator1, 645 class OutputIterator2, class Predicate> 646 constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20 647 partition_copy(InputIterator first, InputIterator last, 648 OutputIterator1 out_true, OutputIterator2 out_false, 649 Predicate pred); 650 651template <class ForwardIterator, class Predicate> 652 ForwardIterator 653 stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); 654 655template<class ForwardIterator, class Predicate> 656 constexpr ForwardIterator // constexpr in C++20 657 partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); 658 659template <class ForwardIterator> 660 constexpr bool // constexpr in C++20 661 is_sorted(ForwardIterator first, ForwardIterator last); 662 663template <class ForwardIterator, class Compare> 664 constexpr bool // constexpr in C++20 665 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); 666 667template<class ForwardIterator> 668 constexpr ForwardIterator // constexpr in C++20 669 is_sorted_until(ForwardIterator first, ForwardIterator last); 670 671template <class ForwardIterator, class Compare> 672 constexpr ForwardIterator // constexpr in C++20 673 is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); 674 675template <class RandomAccessIterator> 676 constexpr void // constexpr in C++20 677 sort(RandomAccessIterator first, RandomAccessIterator last); 678 679template <class RandomAccessIterator, class Compare> 680 constexpr void // constexpr in C++20 681 sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 682 683template <class RandomAccessIterator> 684 void 685 stable_sort(RandomAccessIterator first, RandomAccessIterator last); 686 687template <class RandomAccessIterator, class Compare> 688 void 689 stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 690 691template <class RandomAccessIterator> 692 constexpr void // constexpr in C++20 693 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); 694 695template <class RandomAccessIterator, class Compare> 696 constexpr void // constexpr in C++20 697 partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); 698 699template <class InputIterator, class RandomAccessIterator> 700 constexpr RandomAccessIterator // constexpr in C++20 701 partial_sort_copy(InputIterator first, InputIterator last, 702 RandomAccessIterator result_first, RandomAccessIterator result_last); 703 704template <class InputIterator, class RandomAccessIterator, class Compare> 705 constexpr RandomAccessIterator // constexpr in C++20 706 partial_sort_copy(InputIterator first, InputIterator last, 707 RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); 708 709template <class RandomAccessIterator> 710 constexpr void // constexpr in C++20 711 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); 712 713template <class RandomAccessIterator, class Compare> 714 constexpr void // constexpr in C++20 715 nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); 716 717template <class ForwardIterator, class T> 718 constexpr ForwardIterator // constexpr in C++20 719 lower_bound(ForwardIterator first, ForwardIterator last, const T& value); 720 721template <class ForwardIterator, class T, class Compare> 722 constexpr ForwardIterator // constexpr in C++20 723 lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 724 725template <class ForwardIterator, class T> 726 constexpr ForwardIterator // constexpr in C++20 727 upper_bound(ForwardIterator first, ForwardIterator last, const T& value); 728 729template <class ForwardIterator, class T, class Compare> 730 constexpr ForwardIterator // constexpr in C++20 731 upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 732 733template <class ForwardIterator, class T> 734 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 735 equal_range(ForwardIterator first, ForwardIterator last, const T& value); 736 737template <class ForwardIterator, class T, class Compare> 738 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20 739 equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 740 741template <class ForwardIterator, class T> 742 constexpr bool // constexpr in C++20 743 binary_search(ForwardIterator first, ForwardIterator last, const T& value); 744 745template <class ForwardIterator, class T, class Compare> 746 constexpr bool // constexpr in C++20 747 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); 748 749template <class InputIterator1, class InputIterator2, class OutputIterator> 750 constexpr OutputIterator // constexpr in C++20 751 merge(InputIterator1 first1, InputIterator1 last1, 752 InputIterator2 first2, InputIterator2 last2, OutputIterator result); 753 754template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 755 constexpr OutputIterator // constexpr in C++20 756 merge(InputIterator1 first1, InputIterator1 last1, 757 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 758 759template <class BidirectionalIterator> 760 void 761 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); 762 763template <class BidirectionalIterator, class Compare> 764 void 765 inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); 766 767template <class InputIterator1, class InputIterator2> 768 constexpr bool // constexpr in C++20 769 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 770 771template <class InputIterator1, class InputIterator2, class Compare> 772 constexpr bool // constexpr in C++20 773 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); 774 775template <class InputIterator1, class InputIterator2, class OutputIterator> 776 constexpr OutputIterator // constexpr in C++20 777 set_union(InputIterator1 first1, InputIterator1 last1, 778 InputIterator2 first2, InputIterator2 last2, OutputIterator result); 779 780template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 781 constexpr OutputIterator // constexpr in C++20 782 set_union(InputIterator1 first1, InputIterator1 last1, 783 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 784 785template <class InputIterator1, class InputIterator2, class OutputIterator> 786 constexpr OutputIterator // constexpr in C++20 787 set_intersection(InputIterator1 first1, InputIterator1 last1, 788 InputIterator2 first2, InputIterator2 last2, OutputIterator result); 789 790template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 791 constexpr OutputIterator // constexpr in C++20 792 set_intersection(InputIterator1 first1, InputIterator1 last1, 793 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 794 795template <class InputIterator1, class InputIterator2, class OutputIterator> 796 constexpr OutputIterator // constexpr in C++20 797 set_difference(InputIterator1 first1, InputIterator1 last1, 798 InputIterator2 first2, InputIterator2 last2, OutputIterator result); 799 800template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 801 constexpr OutputIterator // constexpr in C++20 802 set_difference(InputIterator1 first1, InputIterator1 last1, 803 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 804 805template <class InputIterator1, class InputIterator2, class OutputIterator> 806 constexpr OutputIterator // constexpr in C++20 807 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 808 InputIterator2 first2, InputIterator2 last2, OutputIterator result); 809 810template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> 811 constexpr OutputIterator // constexpr in C++20 812 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, 813 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); 814 815template <class RandomAccessIterator> 816 constexpr void // constexpr in C++20 817 push_heap(RandomAccessIterator first, RandomAccessIterator last); 818 819template <class RandomAccessIterator, class Compare> 820 constexpr void // constexpr in C++20 821 push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 822 823template <class RandomAccessIterator> 824 constexpr void // constexpr in C++20 825 pop_heap(RandomAccessIterator first, RandomAccessIterator last); 826 827template <class RandomAccessIterator, class Compare> 828 constexpr void // constexpr in C++20 829 pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 830 831template <class RandomAccessIterator> 832 constexpr void // constexpr in C++20 833 make_heap(RandomAccessIterator first, RandomAccessIterator last); 834 835template <class RandomAccessIterator, class Compare> 836 constexpr void // constexpr in C++20 837 make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 838 839template <class RandomAccessIterator> 840 constexpr void // constexpr in C++20 841 sort_heap(RandomAccessIterator first, RandomAccessIterator last); 842 843template <class RandomAccessIterator, class Compare> 844 constexpr void // constexpr in C++20 845 sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); 846 847template <class RandomAccessIterator> 848 constexpr bool // constexpr in C++20 849 is_heap(RandomAccessIterator first, RandomAccessiterator last); 850 851template <class RandomAccessIterator, class Compare> 852 constexpr bool // constexpr in C++20 853 is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 854 855template <class RandomAccessIterator> 856 constexpr RandomAccessIterator // constexpr in C++20 857 is_heap_until(RandomAccessIterator first, RandomAccessiterator last); 858 859template <class RandomAccessIterator, class Compare> 860 constexpr RandomAccessIterator // constexpr in C++20 861 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); 862 863template <class ForwardIterator> 864 constexpr ForwardIterator // constexpr in C++14 865 min_element(ForwardIterator first, ForwardIterator last); 866 867template <class ForwardIterator, class Compare> 868 constexpr ForwardIterator // constexpr in C++14 869 min_element(ForwardIterator first, ForwardIterator last, Compare comp); 870 871template <class T> 872 constexpr const T& // constexpr in C++14 873 min(const T& a, const T& b); 874 875template <class T, class Compare> 876 constexpr const T& // constexpr in C++14 877 min(const T& a, const T& b, Compare comp); 878 879template<class T> 880 constexpr T // constexpr in C++14 881 min(initializer_list<T> t); 882 883template<class T, class Compare> 884 constexpr T // constexpr in C++14 885 min(initializer_list<T> t, Compare comp); 886 887template<class T> 888 constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 889 890template<class T, class Compare> 891 constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 892 893template <class ForwardIterator> 894 constexpr ForwardIterator // constexpr in C++14 895 max_element(ForwardIterator first, ForwardIterator last); 896 897template <class ForwardIterator, class Compare> 898 constexpr ForwardIterator // constexpr in C++14 899 max_element(ForwardIterator first, ForwardIterator last, Compare comp); 900 901template <class T> 902 constexpr const T& // constexpr in C++14 903 max(const T& a, const T& b); 904 905template <class T, class Compare> 906 constexpr const T& // constexpr in C++14 907 max(const T& a, const T& b, Compare comp); 908 909template<class T> 910 constexpr T // constexpr in C++14 911 max(initializer_list<T> t); 912 913template<class T, class Compare> 914 constexpr T // constexpr in C++14 915 max(initializer_list<T> t, Compare comp); 916 917template<class ForwardIterator> 918 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 919 minmax_element(ForwardIterator first, ForwardIterator last); 920 921template<class ForwardIterator, class Compare> 922 constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 923 minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); 924 925template<class T> 926 constexpr pair<const T&, const T&> // constexpr in C++14 927 minmax(const T& a, const T& b); 928 929template<class T, class Compare> 930 constexpr pair<const T&, const T&> // constexpr in C++14 931 minmax(const T& a, const T& b, Compare comp); 932 933template<class T> 934 constexpr pair<T, T> // constexpr in C++14 935 minmax(initializer_list<T> t); 936 937template<class T, class Compare> 938 constexpr pair<T, T> // constexpr in C++14 939 minmax(initializer_list<T> t, Compare comp); 940 941template <class InputIterator1, class InputIterator2> 942 constexpr bool // constexpr in C++20 943 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); 944 945template <class InputIterator1, class InputIterator2, class Compare> 946 constexpr bool // constexpr in C++20 947 lexicographical_compare(InputIterator1 first1, InputIterator1 last1, 948 InputIterator2 first2, InputIterator2 last2, Compare comp); 949 950template <class BidirectionalIterator> 951 constexpr bool // constexpr in C++20 952 next_permutation(BidirectionalIterator first, BidirectionalIterator last); 953 954template <class BidirectionalIterator, class Compare> 955 constexpr bool // constexpr in C++20 956 next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 957 958template <class BidirectionalIterator> 959 constexpr bool // constexpr in C++20 960 prev_permutation(BidirectionalIterator first, BidirectionalIterator last); 961 962template <class BidirectionalIterator, class Compare> 963 constexpr bool // constexpr in C++20 964 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); 965} // std 966 967*/ 968 969#include <__assert> // all public C++ headers provide the assertion handler 970#include <__bits> 971#include <__config> 972#include <__debug> 973#include <cstddef> 974#include <cstring> 975#include <initializer_list> 976#include <iterator> 977#include <memory> 978#include <type_traits> 979#include <version> 980 981#include <__algorithm/adjacent_find.h> 982#include <__algorithm/all_of.h> 983#include <__algorithm/any_of.h> 984#include <__algorithm/binary_search.h> 985#include <__algorithm/clamp.h> 986#include <__algorithm/comp.h> 987#include <__algorithm/comp_ref_type.h> 988#include <__algorithm/copy.h> 989#include <__algorithm/copy_backward.h> 990#include <__algorithm/copy_if.h> 991#include <__algorithm/copy_n.h> 992#include <__algorithm/count.h> 993#include <__algorithm/count_if.h> 994#include <__algorithm/equal.h> 995#include <__algorithm/equal_range.h> 996#include <__algorithm/fill.h> 997#include <__algorithm/fill_n.h> 998#include <__algorithm/find.h> 999#include <__algorithm/find_end.h> 1000#include <__algorithm/find_first_of.h> 1001#include <__algorithm/find_if.h> 1002#include <__algorithm/find_if_not.h> 1003#include <__algorithm/for_each.h> 1004#include <__algorithm/for_each_n.h> 1005#include <__algorithm/generate.h> 1006#include <__algorithm/generate_n.h> 1007#include <__algorithm/half_positive.h> 1008#include <__algorithm/in_found_result.h> 1009#include <__algorithm/in_fun_result.h> 1010#include <__algorithm/in_in_out_result.h> 1011#include <__algorithm/in_in_result.h> 1012#include <__algorithm/in_out_out_result.h> 1013#include <__algorithm/in_out_result.h> 1014#include <__algorithm/includes.h> 1015#include <__algorithm/inplace_merge.h> 1016#include <__algorithm/is_heap.h> 1017#include <__algorithm/is_heap_until.h> 1018#include <__algorithm/is_partitioned.h> 1019#include <__algorithm/is_permutation.h> 1020#include <__algorithm/is_sorted.h> 1021#include <__algorithm/is_sorted_until.h> 1022#include <__algorithm/iter_swap.h> 1023#include <__algorithm/lexicographical_compare.h> 1024#include <__algorithm/lower_bound.h> 1025#include <__algorithm/make_heap.h> 1026#include <__algorithm/max.h> 1027#include <__algorithm/max_element.h> 1028#include <__algorithm/merge.h> 1029#include <__algorithm/min.h> 1030#include <__algorithm/min_element.h> 1031#include <__algorithm/min_max_result.h> 1032#include <__algorithm/minmax.h> 1033#include <__algorithm/minmax_element.h> 1034#include <__algorithm/mismatch.h> 1035#include <__algorithm/move.h> 1036#include <__algorithm/move_backward.h> 1037#include <__algorithm/next_permutation.h> 1038#include <__algorithm/none_of.h> 1039#include <__algorithm/nth_element.h> 1040#include <__algorithm/partial_sort.h> 1041#include <__algorithm/partial_sort_copy.h> 1042#include <__algorithm/partition.h> 1043#include <__algorithm/partition_copy.h> 1044#include <__algorithm/partition_point.h> 1045#include <__algorithm/pop_heap.h> 1046#include <__algorithm/prev_permutation.h> 1047#include <__algorithm/push_heap.h> 1048#include <__algorithm/ranges_all_of.h> 1049#include <__algorithm/ranges_any_of.h> 1050#include <__algorithm/ranges_copy.h> 1051#include <__algorithm/ranges_copy_backward.h> 1052#include <__algorithm/ranges_copy_if.h> 1053#include <__algorithm/ranges_copy_n.h> 1054#include <__algorithm/ranges_count.h> 1055#include <__algorithm/ranges_count_if.h> 1056#include <__algorithm/ranges_equal.h> 1057#include <__algorithm/ranges_fill.h> 1058#include <__algorithm/ranges_fill_n.h> 1059#include <__algorithm/ranges_find.h> 1060#include <__algorithm/ranges_find_if.h> 1061#include <__algorithm/ranges_find_if_not.h> 1062#include <__algorithm/ranges_for_each.h> 1063#include <__algorithm/ranges_for_each_n.h> 1064#include <__algorithm/ranges_is_partitioned.h> 1065#include <__algorithm/ranges_max.h> 1066#include <__algorithm/ranges_max_element.h> 1067#include <__algorithm/ranges_min.h> 1068#include <__algorithm/ranges_min_element.h> 1069#include <__algorithm/ranges_minmax.h> 1070#include <__algorithm/ranges_minmax_element.h> 1071#include <__algorithm/ranges_mismatch.h> 1072#include <__algorithm/ranges_none_of.h> 1073#include <__algorithm/ranges_reverse.h> 1074#include <__algorithm/ranges_swap_ranges.h> 1075#include <__algorithm/ranges_transform.h> 1076#include <__algorithm/remove.h> 1077#include <__algorithm/remove_copy.h> 1078#include <__algorithm/remove_copy_if.h> 1079#include <__algorithm/remove_if.h> 1080#include <__algorithm/replace.h> 1081#include <__algorithm/replace_copy.h> 1082#include <__algorithm/replace_copy_if.h> 1083#include <__algorithm/replace_if.h> 1084#include <__algorithm/reverse.h> 1085#include <__algorithm/reverse_copy.h> 1086#include <__algorithm/rotate.h> 1087#include <__algorithm/rotate_copy.h> 1088#include <__algorithm/sample.h> 1089#include <__algorithm/search.h> 1090#include <__algorithm/search_n.h> 1091#include <__algorithm/set_difference.h> 1092#include <__algorithm/set_intersection.h> 1093#include <__algorithm/set_symmetric_difference.h> 1094#include <__algorithm/set_union.h> 1095#include <__algorithm/shift_left.h> 1096#include <__algorithm/shift_right.h> 1097#include <__algorithm/shuffle.h> 1098#include <__algorithm/sift_down.h> 1099#include <__algorithm/sort.h> 1100#include <__algorithm/sort_heap.h> 1101#include <__algorithm/stable_partition.h> 1102#include <__algorithm/stable_sort.h> 1103#include <__algorithm/swap_ranges.h> 1104#include <__algorithm/transform.h> 1105#include <__algorithm/unique.h> 1106#include <__algorithm/unique_copy.h> 1107#include <__algorithm/unwrap_iter.h> 1108#include <__algorithm/upper_bound.h> 1109 1110#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1111# pragma GCC system_header 1112#endif 1113 1114#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 1115# include <__pstl_algorithm> 1116#endif 1117 1118#endif // _LIBCPP_ALGORITHM 1119