| 1 | // <algorithm> Forward declarations -*- C++ -*- |
| 2 | |
| 3 | // Copyright (C) 2007-2024 Free Software Foundation, Inc. |
| 4 | // |
| 5 | // This file is part of the GNU ISO C++ Library. This library is free |
| 6 | // software; you can redistribute it and/or modify it under the |
| 7 | // terms of the GNU General Public License as published by the |
| 8 | // Free Software Foundation; either version 3, or (at your option) |
| 9 | // any later version. |
| 10 | |
| 11 | // This library is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | // GNU General Public License for more details. |
| 15 | |
| 16 | // Under Section 7 of GPL version 3, you are granted additional |
| 17 | // permissions described in the GCC Runtime Library Exception, version |
| 18 | // 3.1, as published by the Free Software Foundation. |
| 19 | |
| 20 | // You should have received a copy of the GNU General Public License and |
| 21 | // a copy of the GCC Runtime Library Exception along with this program; |
| 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 | // <http://www.gnu.org/licenses/>. |
| 24 | |
| 25 | /** @file bits/algorithmfwd.h |
| 26 | * This is an internal header file, included by other library headers. |
| 27 | * Do not attempt to use it directly. @headername{algorithm} |
| 28 | */ |
| 29 | |
| 30 | #ifndef _GLIBCXX_ALGORITHMFWD_H |
| 31 | #define _GLIBCXX_ALGORITHMFWD_H 1 |
| 32 | |
| 33 | #pragma GCC system_header |
| 34 | |
| 35 | #include <bits/c++config.h> |
| 36 | #include <bits/stl_pair.h> |
| 37 | #include <bits/stl_iterator_base_types.h> |
| 38 | #if __cplusplus >= 201103L |
| 39 | #include <initializer_list> |
| 40 | #endif |
| 41 | |
| 42 | namespace std _GLIBCXX_VISIBILITY(default) |
| 43 | { |
| 44 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 45 | |
| 46 | /* |
| 47 | adjacent_find |
| 48 | all_of (C++11) |
| 49 | any_of (C++11) |
| 50 | binary_search |
| 51 | clamp (C++17) |
| 52 | copy |
| 53 | copy_backward |
| 54 | copy_if (C++11) |
| 55 | copy_n (C++11) |
| 56 | count |
| 57 | count_if |
| 58 | equal |
| 59 | equal_range |
| 60 | fill |
| 61 | fill_n |
| 62 | find |
| 63 | find_end |
| 64 | find_first_of |
| 65 | find_if |
| 66 | find_if_not (C++11) |
| 67 | for_each |
| 68 | generate |
| 69 | generate_n |
| 70 | includes |
| 71 | inplace_merge |
| 72 | is_heap (C++11) |
| 73 | is_heap_until (C++11) |
| 74 | is_partitioned (C++11) |
| 75 | is_sorted (C++11) |
| 76 | is_sorted_until (C++11) |
| 77 | iter_swap |
| 78 | lexicographical_compare |
| 79 | lower_bound |
| 80 | make_heap |
| 81 | max |
| 82 | max_element |
| 83 | merge |
| 84 | min |
| 85 | min_element |
| 86 | minmax (C++11) |
| 87 | minmax_element (C++11) |
| 88 | mismatch |
| 89 | next_permutation |
| 90 | none_of (C++11) |
| 91 | nth_element |
| 92 | partial_sort |
| 93 | partial_sort_copy |
| 94 | partition |
| 95 | partition_copy (C++11) |
| 96 | partition_point (C++11) |
| 97 | pop_heap |
| 98 | prev_permutation |
| 99 | push_heap |
| 100 | random_shuffle |
| 101 | remove |
| 102 | remove_copy |
| 103 | remove_copy_if |
| 104 | remove_if |
| 105 | replace |
| 106 | replace_copy |
| 107 | replace_copy_if |
| 108 | replace_if |
| 109 | reverse |
| 110 | reverse_copy |
| 111 | rotate |
| 112 | rotate_copy |
| 113 | search |
| 114 | search_n |
| 115 | set_difference |
| 116 | set_intersection |
| 117 | set_symmetric_difference |
| 118 | set_union |
| 119 | shuffle (C++11) |
| 120 | sort |
| 121 | sort_heap |
| 122 | stable_partition |
| 123 | stable_sort |
| 124 | swap |
| 125 | swap_ranges |
| 126 | transform |
| 127 | unique |
| 128 | unique_copy |
| 129 | upper_bound |
| 130 | */ |
| 131 | |
| 132 | /** |
| 133 | * @defgroup algorithms Algorithms |
| 134 | * |
| 135 | * Components for performing algorithmic operations. Includes |
| 136 | * non-modifying sequence, modifying (mutating) sequence, sorting, |
| 137 | * searching, merge, partition, heap, set, minima, maxima, and |
| 138 | * permutation operations. |
| 139 | */ |
| 140 | |
| 141 | /** |
| 142 | * @defgroup mutating_algorithms Mutating |
| 143 | * @ingroup algorithms |
| 144 | */ |
| 145 | |
| 146 | /** |
| 147 | * @defgroup non_mutating_algorithms Non-Mutating |
| 148 | * @ingroup algorithms |
| 149 | */ |
| 150 | |
| 151 | /** |
| 152 | * @defgroup sorting_algorithms Sorting |
| 153 | * @ingroup algorithms |
| 154 | */ |
| 155 | |
| 156 | /** |
| 157 | * @defgroup set_algorithms Set Operations |
| 158 | * @ingroup sorting_algorithms |
| 159 | * |
| 160 | * These algorithms are common set operations performed on sequences |
| 161 | * that are already sorted. The number of comparisons will be |
| 162 | * linear. |
| 163 | */ |
| 164 | |
| 165 | /** |
| 166 | * @defgroup binary_search_algorithms Binary Search |
| 167 | * @ingroup sorting_algorithms |
| 168 | * |
| 169 | * These algorithms are variations of a classic binary search, and |
| 170 | * all assume that the sequence being searched is already sorted. |
| 171 | * |
| 172 | * The number of comparisons will be logarithmic (and as few as |
| 173 | * possible). The number of steps through the sequence will be |
| 174 | * logarithmic for random-access iterators (e.g., pointers), and |
| 175 | * linear otherwise. |
| 176 | * |
| 177 | * The LWG has passed Defect Report 270, which notes: <em>The |
| 178 | * proposed resolution reinterprets binary search. Instead of |
| 179 | * thinking about searching for a value in a sorted range, we view |
| 180 | * that as an important special case of a more general algorithm: |
| 181 | * searching for the partition point in a partitioned range. We |
| 182 | * also add a guarantee that the old wording did not: we ensure that |
| 183 | * the upper bound is no earlier than the lower bound, that the pair |
| 184 | * returned by equal_range is a valid range, and that the first part |
| 185 | * of that pair is the lower bound.</em> |
| 186 | * |
| 187 | * The actual effect of the first sentence is that a comparison |
| 188 | * functor passed by the user doesn't necessarily need to induce a |
| 189 | * strict weak ordering relation. Rather, it partitions the range. |
| 190 | */ |
| 191 | |
| 192 | // adjacent_find |
| 193 | |
| 194 | #if __cplusplus >= 201103L |
| 195 | template<typename _IIter, typename _Predicate> |
| 196 | _GLIBCXX20_CONSTEXPR |
| 197 | bool |
| 198 | all_of(_IIter, _IIter, _Predicate); |
| 199 | |
| 200 | template<typename _IIter, typename _Predicate> |
| 201 | _GLIBCXX20_CONSTEXPR |
| 202 | bool |
| 203 | any_of(_IIter, _IIter, _Predicate); |
| 204 | #endif |
| 205 | |
| 206 | template<typename _FIter, typename _Tp> |
| 207 | _GLIBCXX20_CONSTEXPR |
| 208 | bool |
| 209 | binary_search(_FIter, _FIter, const _Tp&); |
| 210 | |
| 211 | template<typename _FIter, typename _Tp, typename _Compare> |
| 212 | _GLIBCXX20_CONSTEXPR |
| 213 | bool |
| 214 | binary_search(_FIter, _FIter, const _Tp&, _Compare); |
| 215 | |
| 216 | #if __cplusplus > 201402L |
| 217 | template<typename _Tp> |
| 218 | _GLIBCXX14_CONSTEXPR |
| 219 | const _Tp& |
| 220 | clamp(const _Tp&, const _Tp&, const _Tp&); |
| 221 | |
| 222 | template<typename _Tp, typename _Compare> |
| 223 | _GLIBCXX14_CONSTEXPR |
| 224 | const _Tp& |
| 225 | clamp(const _Tp&, const _Tp&, const _Tp&, _Compare); |
| 226 | #endif |
| 227 | |
| 228 | template<typename _IIter, typename _OIter> |
| 229 | _GLIBCXX20_CONSTEXPR |
| 230 | _OIter |
| 231 | copy(_IIter, _IIter, _OIter); |
| 232 | |
| 233 | template<typename _BIter1, typename _BIter2> |
| 234 | _GLIBCXX20_CONSTEXPR |
| 235 | _BIter2 |
| 236 | copy_backward(_BIter1, _BIter1, _BIter2); |
| 237 | |
| 238 | #if __cplusplus >= 201103L |
| 239 | template<typename _IIter, typename _OIter, typename _Predicate> |
| 240 | _GLIBCXX20_CONSTEXPR |
| 241 | _OIter |
| 242 | copy_if(_IIter, _IIter, _OIter, _Predicate); |
| 243 | |
| 244 | template<typename _IIter, typename _Size, typename _OIter> |
| 245 | _GLIBCXX20_CONSTEXPR |
| 246 | _OIter |
| 247 | copy_n(_IIter, _Size, _OIter); |
| 248 | #endif |
| 249 | |
| 250 | // count |
| 251 | // count_if |
| 252 | |
| 253 | template<typename _FIter, typename _Tp> |
| 254 | _GLIBCXX20_CONSTEXPR |
| 255 | pair<_FIter, _FIter> |
| 256 | equal_range(_FIter, _FIter, const _Tp&); |
| 257 | |
| 258 | template<typename _FIter, typename _Tp, typename _Compare> |
| 259 | _GLIBCXX20_CONSTEXPR |
| 260 | pair<_FIter, _FIter> |
| 261 | equal_range(_FIter, _FIter, const _Tp&, _Compare); |
| 262 | |
| 263 | template<typename _FIter, typename _Tp> |
| 264 | _GLIBCXX20_CONSTEXPR |
| 265 | void |
| 266 | fill(_FIter, _FIter, const _Tp&); |
| 267 | |
| 268 | template<typename _OIter, typename _Size, typename _Tp> |
| 269 | _GLIBCXX20_CONSTEXPR |
| 270 | _OIter |
| 271 | fill_n(_OIter, _Size, const _Tp&); |
| 272 | |
| 273 | // find |
| 274 | |
| 275 | template<typename _FIter1, typename _FIter2> |
| 276 | _GLIBCXX20_CONSTEXPR |
| 277 | _FIter1 |
| 278 | find_end(_FIter1, _FIter1, _FIter2, _FIter2); |
| 279 | |
| 280 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 281 | _GLIBCXX20_CONSTEXPR |
| 282 | _FIter1 |
| 283 | find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 284 | |
| 285 | // find_first_of |
| 286 | // find_if |
| 287 | |
| 288 | #if __cplusplus >= 201103L |
| 289 | template<typename _IIter, typename _Predicate> |
| 290 | _GLIBCXX20_CONSTEXPR |
| 291 | _IIter |
| 292 | find_if_not(_IIter, _IIter, _Predicate); |
| 293 | #endif |
| 294 | |
| 295 | // for_each |
| 296 | // generate |
| 297 | // generate_n |
| 298 | |
| 299 | template<typename _IIter1, typename _IIter2> |
| 300 | _GLIBCXX20_CONSTEXPR |
| 301 | bool |
| 302 | includes(_IIter1, _IIter1, _IIter2, _IIter2); |
| 303 | |
| 304 | template<typename _IIter1, typename _IIter2, typename _Compare> |
| 305 | _GLIBCXX20_CONSTEXPR |
| 306 | bool |
| 307 | includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); |
| 308 | |
| 309 | template<typename _BIter> |
| 310 | void |
| 311 | inplace_merge(_BIter, _BIter, _BIter); |
| 312 | |
| 313 | template<typename _BIter, typename _Compare> |
| 314 | void |
| 315 | inplace_merge(_BIter, _BIter, _BIter, _Compare); |
| 316 | |
| 317 | #if __cplusplus >= 201103L |
| 318 | template<typename _RAIter> |
| 319 | _GLIBCXX20_CONSTEXPR |
| 320 | bool |
| 321 | is_heap(_RAIter, _RAIter); |
| 322 | |
| 323 | template<typename _RAIter, typename _Compare> |
| 324 | _GLIBCXX20_CONSTEXPR |
| 325 | bool |
| 326 | is_heap(_RAIter, _RAIter, _Compare); |
| 327 | |
| 328 | template<typename _RAIter> |
| 329 | _GLIBCXX20_CONSTEXPR |
| 330 | _RAIter |
| 331 | is_heap_until(_RAIter, _RAIter); |
| 332 | |
| 333 | template<typename _RAIter, typename _Compare> |
| 334 | _GLIBCXX20_CONSTEXPR |
| 335 | _RAIter |
| 336 | is_heap_until(_RAIter, _RAIter, _Compare); |
| 337 | |
| 338 | template<typename _IIter, typename _Predicate> |
| 339 | _GLIBCXX20_CONSTEXPR |
| 340 | bool |
| 341 | is_partitioned(_IIter, _IIter, _Predicate); |
| 342 | |
| 343 | template<typename _FIter1, typename _FIter2> |
| 344 | _GLIBCXX20_CONSTEXPR |
| 345 | bool |
| 346 | is_permutation(_FIter1, _FIter1, _FIter2); |
| 347 | |
| 348 | template<typename _FIter1, typename _FIter2, |
| 349 | typename _BinaryPredicate> |
| 350 | _GLIBCXX20_CONSTEXPR |
| 351 | bool |
| 352 | is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); |
| 353 | |
| 354 | template<typename _FIter> |
| 355 | _GLIBCXX20_CONSTEXPR |
| 356 | bool |
| 357 | is_sorted(_FIter, _FIter); |
| 358 | |
| 359 | template<typename _FIter, typename _Compare> |
| 360 | _GLIBCXX20_CONSTEXPR |
| 361 | bool |
| 362 | is_sorted(_FIter, _FIter, _Compare); |
| 363 | |
| 364 | template<typename _FIter> |
| 365 | _GLIBCXX20_CONSTEXPR |
| 366 | _FIter |
| 367 | is_sorted_until(_FIter, _FIter); |
| 368 | |
| 369 | template<typename _FIter, typename _Compare> |
| 370 | _GLIBCXX20_CONSTEXPR |
| 371 | _FIter |
| 372 | is_sorted_until(_FIter, _FIter, _Compare); |
| 373 | #endif |
| 374 | |
| 375 | template<typename _FIter1, typename _FIter2> |
| 376 | _GLIBCXX20_CONSTEXPR |
| 377 | void |
| 378 | iter_swap(_FIter1, _FIter2); |
| 379 | |
| 380 | template<typename _FIter, typename _Tp> |
| 381 | _GLIBCXX20_CONSTEXPR |
| 382 | _FIter |
| 383 | lower_bound(_FIter, _FIter, const _Tp&); |
| 384 | |
| 385 | template<typename _FIter, typename _Tp, typename _Compare> |
| 386 | _GLIBCXX20_CONSTEXPR |
| 387 | _FIter |
| 388 | lower_bound(_FIter, _FIter, const _Tp&, _Compare); |
| 389 | |
| 390 | template<typename _RAIter> |
| 391 | _GLIBCXX20_CONSTEXPR |
| 392 | void |
| 393 | make_heap(_RAIter, _RAIter); |
| 394 | |
| 395 | template<typename _RAIter, typename _Compare> |
| 396 | _GLIBCXX20_CONSTEXPR |
| 397 | void |
| 398 | make_heap(_RAIter, _RAIter, _Compare); |
| 399 | |
| 400 | template<typename _Tp> |
| 401 | _GLIBCXX14_CONSTEXPR |
| 402 | const _Tp& |
| 403 | max(const _Tp&, const _Tp&); |
| 404 | |
| 405 | template<typename _Tp, typename _Compare> |
| 406 | _GLIBCXX14_CONSTEXPR |
| 407 | const _Tp& |
| 408 | max(const _Tp&, const _Tp&, _Compare); |
| 409 | |
| 410 | // max_element |
| 411 | // merge |
| 412 | |
| 413 | template<typename _Tp> |
| 414 | _GLIBCXX14_CONSTEXPR |
| 415 | const _Tp& |
| 416 | min(const _Tp&, const _Tp&); |
| 417 | |
| 418 | template<typename _Tp, typename _Compare> |
| 419 | _GLIBCXX14_CONSTEXPR |
| 420 | const _Tp& |
| 421 | min(const _Tp&, const _Tp&, _Compare); |
| 422 | |
| 423 | // min_element |
| 424 | |
| 425 | #if __cplusplus >= 201103L |
| 426 | template<typename _Tp> |
| 427 | _GLIBCXX14_CONSTEXPR |
| 428 | pair<const _Tp&, const _Tp&> |
| 429 | minmax(const _Tp&, const _Tp&); |
| 430 | |
| 431 | template<typename _Tp, typename _Compare> |
| 432 | _GLIBCXX14_CONSTEXPR |
| 433 | pair<const _Tp&, const _Tp&> |
| 434 | minmax(const _Tp&, const _Tp&, _Compare); |
| 435 | |
| 436 | template<typename _FIter> |
| 437 | _GLIBCXX14_CONSTEXPR |
| 438 | pair<_FIter, _FIter> |
| 439 | minmax_element(_FIter, _FIter); |
| 440 | |
| 441 | template<typename _FIter, typename _Compare> |
| 442 | _GLIBCXX14_CONSTEXPR |
| 443 | pair<_FIter, _FIter> |
| 444 | minmax_element(_FIter, _FIter, _Compare); |
| 445 | |
| 446 | template<typename _Tp> |
| 447 | _GLIBCXX14_CONSTEXPR |
| 448 | _Tp |
| 449 | min(initializer_list<_Tp>); |
| 450 | |
| 451 | template<typename _Tp, typename _Compare> |
| 452 | _GLIBCXX14_CONSTEXPR |
| 453 | _Tp |
| 454 | min(initializer_list<_Tp>, _Compare); |
| 455 | |
| 456 | template<typename _Tp> |
| 457 | _GLIBCXX14_CONSTEXPR |
| 458 | _Tp |
| 459 | max(initializer_list<_Tp>); |
| 460 | |
| 461 | template<typename _Tp, typename _Compare> |
| 462 | _GLIBCXX14_CONSTEXPR |
| 463 | _Tp |
| 464 | max(initializer_list<_Tp>, _Compare); |
| 465 | |
| 466 | template<typename _Tp> |
| 467 | _GLIBCXX14_CONSTEXPR |
| 468 | pair<_Tp, _Tp> |
| 469 | minmax(initializer_list<_Tp>); |
| 470 | |
| 471 | template<typename _Tp, typename _Compare> |
| 472 | _GLIBCXX14_CONSTEXPR |
| 473 | pair<_Tp, _Tp> |
| 474 | minmax(initializer_list<_Tp>, _Compare); |
| 475 | #endif |
| 476 | |
| 477 | // mismatch |
| 478 | |
| 479 | template<typename _BIter> |
| 480 | _GLIBCXX20_CONSTEXPR |
| 481 | bool |
| 482 | next_permutation(_BIter, _BIter); |
| 483 | |
| 484 | template<typename _BIter, typename _Compare> |
| 485 | _GLIBCXX20_CONSTEXPR |
| 486 | bool |
| 487 | next_permutation(_BIter, _BIter, _Compare); |
| 488 | |
| 489 | #if __cplusplus >= 201103L |
| 490 | template<typename _IIter, typename _Predicate> |
| 491 | _GLIBCXX20_CONSTEXPR |
| 492 | bool |
| 493 | none_of(_IIter, _IIter, _Predicate); |
| 494 | #endif |
| 495 | |
| 496 | // nth_element |
| 497 | // partial_sort |
| 498 | |
| 499 | template<typename _IIter, typename _RAIter> |
| 500 | _GLIBCXX20_CONSTEXPR |
| 501 | _RAIter |
| 502 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); |
| 503 | |
| 504 | template<typename _IIter, typename _RAIter, typename _Compare> |
| 505 | _GLIBCXX20_CONSTEXPR |
| 506 | _RAIter |
| 507 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); |
| 508 | |
| 509 | // partition |
| 510 | |
| 511 | #if __cplusplus >= 201103L |
| 512 | template<typename _IIter, typename _OIter1, |
| 513 | typename _OIter2, typename _Predicate> |
| 514 | _GLIBCXX20_CONSTEXPR |
| 515 | pair<_OIter1, _OIter2> |
| 516 | partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); |
| 517 | |
| 518 | template<typename _FIter, typename _Predicate> |
| 519 | _GLIBCXX20_CONSTEXPR |
| 520 | _FIter |
| 521 | partition_point(_FIter, _FIter, _Predicate); |
| 522 | #endif |
| 523 | |
| 524 | template<typename _RAIter> |
| 525 | _GLIBCXX20_CONSTEXPR |
| 526 | void |
| 527 | pop_heap(_RAIter, _RAIter); |
| 528 | |
| 529 | template<typename _RAIter, typename _Compare> |
| 530 | _GLIBCXX20_CONSTEXPR |
| 531 | void |
| 532 | pop_heap(_RAIter, _RAIter, _Compare); |
| 533 | |
| 534 | template<typename _BIter> |
| 535 | _GLIBCXX20_CONSTEXPR |
| 536 | bool |
| 537 | prev_permutation(_BIter, _BIter); |
| 538 | |
| 539 | template<typename _BIter, typename _Compare> |
| 540 | _GLIBCXX20_CONSTEXPR |
| 541 | bool |
| 542 | prev_permutation(_BIter, _BIter, _Compare); |
| 543 | |
| 544 | template<typename _RAIter> |
| 545 | _GLIBCXX20_CONSTEXPR |
| 546 | void |
| 547 | push_heap(_RAIter, _RAIter); |
| 548 | |
| 549 | template<typename _RAIter, typename _Compare> |
| 550 | _GLIBCXX20_CONSTEXPR |
| 551 | void |
| 552 | push_heap(_RAIter, _RAIter, _Compare); |
| 553 | |
| 554 | // random_shuffle |
| 555 | |
| 556 | template<typename _FIter, typename _Tp> |
| 557 | _GLIBCXX20_CONSTEXPR |
| 558 | _FIter |
| 559 | remove(_FIter, _FIter, const _Tp&); |
| 560 | |
| 561 | template<typename _FIter, typename _Predicate> |
| 562 | _GLIBCXX20_CONSTEXPR |
| 563 | _FIter |
| 564 | remove_if(_FIter, _FIter, _Predicate); |
| 565 | |
| 566 | template<typename _IIter, typename _OIter, typename _Tp> |
| 567 | _GLIBCXX20_CONSTEXPR |
| 568 | _OIter |
| 569 | remove_copy(_IIter, _IIter, _OIter, const _Tp&); |
| 570 | |
| 571 | template<typename _IIter, typename _OIter, typename _Predicate> |
| 572 | _GLIBCXX20_CONSTEXPR |
| 573 | _OIter |
| 574 | remove_copy_if(_IIter, _IIter, _OIter, _Predicate); |
| 575 | |
| 576 | // replace |
| 577 | |
| 578 | template<typename _IIter, typename _OIter, typename _Tp> |
| 579 | _GLIBCXX20_CONSTEXPR |
| 580 | _OIter |
| 581 | replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); |
| 582 | |
| 583 | template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> |
| 584 | _GLIBCXX20_CONSTEXPR |
| 585 | _OIter |
| 586 | replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); |
| 587 | |
| 588 | // replace_if |
| 589 | |
| 590 | template<typename _BIter> |
| 591 | _GLIBCXX20_CONSTEXPR |
| 592 | void |
| 593 | reverse(_BIter, _BIter); |
| 594 | |
| 595 | template<typename _BIter, typename _OIter> |
| 596 | _GLIBCXX20_CONSTEXPR |
| 597 | _OIter |
| 598 | reverse_copy(_BIter, _BIter, _OIter); |
| 599 | |
| 600 | _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) |
| 601 | |
| 602 | template<typename _FIter> |
| 603 | _GLIBCXX20_CONSTEXPR |
| 604 | _FIter |
| 605 | rotate(_FIter, _FIter, _FIter); |
| 606 | |
| 607 | _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) |
| 608 | |
| 609 | template<typename _FIter, typename _OIter> |
| 610 | _GLIBCXX20_CONSTEXPR |
| 611 | _OIter |
| 612 | rotate_copy(_FIter, _FIter, _FIter, _OIter); |
| 613 | |
| 614 | // search |
| 615 | // search_n |
| 616 | // set_difference |
| 617 | // set_intersection |
| 618 | // set_symmetric_difference |
| 619 | // set_union |
| 620 | |
| 621 | #if __cplusplus >= 201103L |
| 622 | template<typename _RAIter, typename _UGenerator> |
| 623 | void |
| 624 | shuffle(_RAIter, _RAIter, _UGenerator&&); |
| 625 | #endif |
| 626 | |
| 627 | template<typename _RAIter> |
| 628 | _GLIBCXX20_CONSTEXPR |
| 629 | void |
| 630 | sort_heap(_RAIter, _RAIter); |
| 631 | |
| 632 | template<typename _RAIter, typename _Compare> |
| 633 | _GLIBCXX20_CONSTEXPR |
| 634 | void |
| 635 | sort_heap(_RAIter, _RAIter, _Compare); |
| 636 | |
| 637 | #if _GLIBCXX_HOSTED |
| 638 | template<typename _BIter, typename _Predicate> |
| 639 | _BIter |
| 640 | stable_partition(_BIter, _BIter, _Predicate); |
| 641 | #endif |
| 642 | |
| 643 | #if __cplusplus < 201103L |
| 644 | // For C++11 swap() is declared in <type_traits>. |
| 645 | |
| 646 | template<typename _Tp, size_t _Nm> |
| 647 | _GLIBCXX20_CONSTEXPR |
| 648 | inline void |
| 649 | swap(_Tp& __a, _Tp& __b); |
| 650 | |
| 651 | template<typename _Tp, size_t _Nm> |
| 652 | _GLIBCXX20_CONSTEXPR |
| 653 | inline void |
| 654 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]); |
| 655 | #endif |
| 656 | |
| 657 | template<typename _FIter1, typename _FIter2> |
| 658 | _GLIBCXX20_CONSTEXPR |
| 659 | _FIter2 |
| 660 | swap_ranges(_FIter1, _FIter1, _FIter2); |
| 661 | |
| 662 | // transform |
| 663 | |
| 664 | template<typename _FIter> |
| 665 | _GLIBCXX20_CONSTEXPR |
| 666 | _FIter |
| 667 | unique(_FIter, _FIter); |
| 668 | |
| 669 | template<typename _FIter, typename _BinaryPredicate> |
| 670 | _GLIBCXX20_CONSTEXPR |
| 671 | _FIter |
| 672 | unique(_FIter, _FIter, _BinaryPredicate); |
| 673 | |
| 674 | // unique_copy |
| 675 | |
| 676 | template<typename _FIter, typename _Tp> |
| 677 | _GLIBCXX20_CONSTEXPR |
| 678 | _FIter |
| 679 | upper_bound(_FIter, _FIter, const _Tp&); |
| 680 | |
| 681 | template<typename _FIter, typename _Tp, typename _Compare> |
| 682 | _GLIBCXX20_CONSTEXPR |
| 683 | _FIter |
| 684 | upper_bound(_FIter, _FIter, const _Tp&, _Compare); |
| 685 | |
| 686 | _GLIBCXX_BEGIN_NAMESPACE_ALGO |
| 687 | |
| 688 | template<typename _FIter> |
| 689 | _GLIBCXX20_CONSTEXPR |
| 690 | _FIter |
| 691 | adjacent_find(_FIter, _FIter); |
| 692 | |
| 693 | template<typename _FIter, typename _BinaryPredicate> |
| 694 | _GLIBCXX20_CONSTEXPR |
| 695 | _FIter |
| 696 | adjacent_find(_FIter, _FIter, _BinaryPredicate); |
| 697 | |
| 698 | template<typename _IIter, typename _Tp> |
| 699 | _GLIBCXX20_CONSTEXPR |
| 700 | typename iterator_traits<_IIter>::difference_type |
| 701 | count(_IIter, _IIter, const _Tp&); |
| 702 | |
| 703 | template<typename _IIter, typename _Predicate> |
| 704 | _GLIBCXX20_CONSTEXPR |
| 705 | typename iterator_traits<_IIter>::difference_type |
| 706 | count_if(_IIter, _IIter, _Predicate); |
| 707 | |
| 708 | template<typename _IIter1, typename _IIter2> |
| 709 | _GLIBCXX20_CONSTEXPR |
| 710 | bool |
| 711 | equal(_IIter1, _IIter1, _IIter2); |
| 712 | |
| 713 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> |
| 714 | _GLIBCXX20_CONSTEXPR |
| 715 | bool |
| 716 | equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); |
| 717 | |
| 718 | template<typename _IIter, typename _Tp> |
| 719 | _GLIBCXX20_CONSTEXPR |
| 720 | _IIter |
| 721 | find(_IIter, _IIter, const _Tp&); |
| 722 | |
| 723 | template<typename _FIter1, typename _FIter2> |
| 724 | _GLIBCXX20_CONSTEXPR |
| 725 | _FIter1 |
| 726 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); |
| 727 | |
| 728 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 729 | _GLIBCXX20_CONSTEXPR |
| 730 | _FIter1 |
| 731 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 732 | |
| 733 | template<typename _IIter, typename _Predicate> |
| 734 | _GLIBCXX20_CONSTEXPR |
| 735 | _IIter |
| 736 | find_if(_IIter, _IIter, _Predicate); |
| 737 | |
| 738 | template<typename _IIter, typename _Funct> |
| 739 | _GLIBCXX20_CONSTEXPR |
| 740 | _Funct |
| 741 | for_each(_IIter, _IIter, _Funct); |
| 742 | |
| 743 | template<typename _FIter, typename _Generator> |
| 744 | _GLIBCXX20_CONSTEXPR |
| 745 | void |
| 746 | generate(_FIter, _FIter, _Generator); |
| 747 | |
| 748 | template<typename _OIter, typename _Size, typename _Generator> |
| 749 | _GLIBCXX20_CONSTEXPR |
| 750 | _OIter |
| 751 | generate_n(_OIter, _Size, _Generator); |
| 752 | |
| 753 | template<typename _IIter1, typename _IIter2> |
| 754 | _GLIBCXX20_CONSTEXPR |
| 755 | bool |
| 756 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); |
| 757 | |
| 758 | template<typename _IIter1, typename _IIter2, typename _Compare> |
| 759 | _GLIBCXX20_CONSTEXPR |
| 760 | bool |
| 761 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); |
| 762 | |
| 763 | template<typename _FIter> |
| 764 | _GLIBCXX14_CONSTEXPR |
| 765 | _FIter |
| 766 | max_element(_FIter, _FIter); |
| 767 | |
| 768 | template<typename _FIter, typename _Compare> |
| 769 | _GLIBCXX14_CONSTEXPR |
| 770 | _FIter |
| 771 | max_element(_FIter, _FIter, _Compare); |
| 772 | |
| 773 | template<typename _IIter1, typename _IIter2, typename _OIter> |
| 774 | _GLIBCXX20_CONSTEXPR |
| 775 | _OIter |
| 776 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 777 | |
| 778 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 779 | typename _Compare> |
| 780 | _GLIBCXX20_CONSTEXPR |
| 781 | _OIter |
| 782 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 783 | |
| 784 | template<typename _FIter> |
| 785 | _GLIBCXX14_CONSTEXPR |
| 786 | _FIter |
| 787 | min_element(_FIter, _FIter); |
| 788 | |
| 789 | template<typename _FIter, typename _Compare> |
| 790 | _GLIBCXX14_CONSTEXPR |
| 791 | _FIter |
| 792 | min_element(_FIter, _FIter, _Compare); |
| 793 | |
| 794 | template<typename _IIter1, typename _IIter2> |
| 795 | _GLIBCXX20_CONSTEXPR |
| 796 | pair<_IIter1, _IIter2> |
| 797 | mismatch(_IIter1, _IIter1, _IIter2); |
| 798 | |
| 799 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> |
| 800 | _GLIBCXX20_CONSTEXPR |
| 801 | pair<_IIter1, _IIter2> |
| 802 | mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); |
| 803 | |
| 804 | template<typename _RAIter> |
| 805 | _GLIBCXX20_CONSTEXPR |
| 806 | void |
| 807 | nth_element(_RAIter, _RAIter, _RAIter); |
| 808 | |
| 809 | template<typename _RAIter, typename _Compare> |
| 810 | _GLIBCXX20_CONSTEXPR |
| 811 | void |
| 812 | nth_element(_RAIter, _RAIter, _RAIter, _Compare); |
| 813 | |
| 814 | template<typename _RAIter> |
| 815 | _GLIBCXX20_CONSTEXPR |
| 816 | void |
| 817 | partial_sort(_RAIter, _RAIter, _RAIter); |
| 818 | |
| 819 | template<typename _RAIter, typename _Compare> |
| 820 | _GLIBCXX20_CONSTEXPR |
| 821 | void |
| 822 | partial_sort(_RAIter, _RAIter, _RAIter, _Compare); |
| 823 | |
| 824 | template<typename _BIter, typename _Predicate> |
| 825 | _GLIBCXX20_CONSTEXPR |
| 826 | _BIter |
| 827 | partition(_BIter, _BIter, _Predicate); |
| 828 | |
| 829 | #if _GLIBCXX_HOSTED |
| 830 | template<typename _RAIter> |
| 831 | _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle" ) |
| 832 | void |
| 833 | random_shuffle(_RAIter, _RAIter); |
| 834 | |
| 835 | template<typename _RAIter, typename _Generator> |
| 836 | _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle" ) |
| 837 | void |
| 838 | random_shuffle(_RAIter, _RAIter, |
| 839 | #if __cplusplus >= 201103L |
| 840 | _Generator&&); |
| 841 | #else |
| 842 | _Generator&); |
| 843 | #endif |
| 844 | #endif // HOSTED |
| 845 | |
| 846 | template<typename _FIter, typename _Tp> |
| 847 | _GLIBCXX20_CONSTEXPR |
| 848 | void |
| 849 | replace(_FIter, _FIter, const _Tp&, const _Tp&); |
| 850 | |
| 851 | template<typename _FIter, typename _Predicate, typename _Tp> |
| 852 | _GLIBCXX20_CONSTEXPR |
| 853 | void |
| 854 | replace_if(_FIter, _FIter, _Predicate, const _Tp&); |
| 855 | |
| 856 | template<typename _FIter1, typename _FIter2> |
| 857 | _GLIBCXX20_CONSTEXPR |
| 858 | _FIter1 |
| 859 | search(_FIter1, _FIter1, _FIter2, _FIter2); |
| 860 | |
| 861 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 862 | _GLIBCXX20_CONSTEXPR |
| 863 | _FIter1 |
| 864 | search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 865 | |
| 866 | template<typename _FIter, typename _Size, typename _Tp> |
| 867 | _GLIBCXX20_CONSTEXPR |
| 868 | _FIter |
| 869 | search_n(_FIter, _FIter, _Size, const _Tp&); |
| 870 | |
| 871 | template<typename _FIter, typename _Size, typename _Tp, |
| 872 | typename _BinaryPredicate> |
| 873 | _GLIBCXX20_CONSTEXPR |
| 874 | _FIter |
| 875 | search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); |
| 876 | |
| 877 | template<typename _IIter1, typename _IIter2, typename _OIter> |
| 878 | _GLIBCXX20_CONSTEXPR |
| 879 | _OIter |
| 880 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 881 | |
| 882 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 883 | typename _Compare> |
| 884 | _GLIBCXX20_CONSTEXPR |
| 885 | _OIter |
| 886 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 887 | |
| 888 | template<typename _IIter1, typename _IIter2, typename _OIter> |
| 889 | _GLIBCXX20_CONSTEXPR |
| 890 | _OIter |
| 891 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 892 | |
| 893 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 894 | typename _Compare> |
| 895 | _GLIBCXX20_CONSTEXPR |
| 896 | _OIter |
| 897 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 898 | |
| 899 | template<typename _IIter1, typename _IIter2, typename _OIter> |
| 900 | _GLIBCXX20_CONSTEXPR |
| 901 | _OIter |
| 902 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 903 | |
| 904 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 905 | typename _Compare> |
| 906 | _GLIBCXX20_CONSTEXPR |
| 907 | _OIter |
| 908 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, |
| 909 | _OIter, _Compare); |
| 910 | |
| 911 | template<typename _IIter1, typename _IIter2, typename _OIter> |
| 912 | _GLIBCXX20_CONSTEXPR |
| 913 | _OIter |
| 914 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 915 | |
| 916 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 917 | typename _Compare> |
| 918 | _GLIBCXX20_CONSTEXPR |
| 919 | _OIter |
| 920 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 921 | |
| 922 | template<typename _RAIter> |
| 923 | _GLIBCXX20_CONSTEXPR |
| 924 | void |
| 925 | sort(_RAIter, _RAIter); |
| 926 | |
| 927 | template<typename _RAIter, typename _Compare> |
| 928 | _GLIBCXX20_CONSTEXPR |
| 929 | void |
| 930 | sort(_RAIter, _RAIter, _Compare); |
| 931 | |
| 932 | template<typename _RAIter> |
| 933 | void |
| 934 | stable_sort(_RAIter, _RAIter); |
| 935 | |
| 936 | template<typename _RAIter, typename _Compare> |
| 937 | void |
| 938 | stable_sort(_RAIter, _RAIter, _Compare); |
| 939 | |
| 940 | template<typename _IIter, typename _OIter, typename _UnaryOperation> |
| 941 | _GLIBCXX20_CONSTEXPR |
| 942 | _OIter |
| 943 | transform(_IIter, _IIter, _OIter, _UnaryOperation); |
| 944 | |
| 945 | template<typename _IIter1, typename _IIter2, typename _OIter, |
| 946 | typename _BinaryOperation> |
| 947 | _GLIBCXX20_CONSTEXPR |
| 948 | _OIter |
| 949 | transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); |
| 950 | |
| 951 | template<typename _IIter, typename _OIter> |
| 952 | _GLIBCXX20_CONSTEXPR |
| 953 | _OIter |
| 954 | unique_copy(_IIter, _IIter, _OIter); |
| 955 | |
| 956 | template<typename _IIter, typename _OIter, typename _BinaryPredicate> |
| 957 | _GLIBCXX20_CONSTEXPR |
| 958 | _OIter |
| 959 | unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); |
| 960 | |
| 961 | _GLIBCXX_END_NAMESPACE_ALGO |
| 962 | _GLIBCXX_END_NAMESPACE_VERSION |
| 963 | } // namespace std |
| 964 | |
| 965 | #ifdef _GLIBCXX_PARALLEL |
| 966 | # include <parallel/algorithmfwd.h> |
| 967 | #endif |
| 968 | |
| 969 | #endif |
| 970 | |
| 971 | |