| 1 | // <algorithm> Forward declarations -*- C++ -*-  |
| 2 |   |
| 3 | // Copyright (C) 2007-2021 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 > 201703L  |
| 195 | # define __cpp_lib_constexpr_algorithms 201806L  |
| 196 | #endif  |
| 197 |   |
| 198 | #if __cplusplus >= 201103L  |
| 199 | template<typename _IIter, typename _Predicate>  |
| 200 | _GLIBCXX20_CONSTEXPR  |
| 201 | bool  |
| 202 | all_of(_IIter, _IIter, _Predicate);  |
| 203 |   |
| 204 | template<typename _IIter, typename _Predicate>  |
| 205 | _GLIBCXX20_CONSTEXPR  |
| 206 | bool  |
| 207 | any_of(_IIter, _IIter, _Predicate);  |
| 208 | #endif  |
| 209 |   |
| 210 | template<typename _FIter, typename _Tp>  |
| 211 | _GLIBCXX20_CONSTEXPR  |
| 212 | bool  |
| 213 | binary_search(_FIter, _FIter, const _Tp&);  |
| 214 |   |
| 215 | template<typename _FIter, typename _Tp, typename _Compare>  |
| 216 | _GLIBCXX20_CONSTEXPR  |
| 217 | bool  |
| 218 | binary_search(_FIter, _FIter, const _Tp&, _Compare);  |
| 219 |   |
| 220 | #if __cplusplus > 201402L  |
| 221 | template<typename _Tp>  |
| 222 | _GLIBCXX14_CONSTEXPR  |
| 223 | const _Tp&  |
| 224 | clamp(const _Tp&, const _Tp&, const _Tp&);  |
| 225 |   |
| 226 | template<typename _Tp, typename _Compare>  |
| 227 | _GLIBCXX14_CONSTEXPR  |
| 228 | const _Tp&  |
| 229 | clamp(const _Tp&, const _Tp&, const _Tp&, _Compare);  |
| 230 | #endif  |
| 231 |   |
| 232 | template<typename _IIter, typename _OIter>  |
| 233 | _GLIBCXX20_CONSTEXPR  |
| 234 | _OIter  |
| 235 | copy(_IIter, _IIter, _OIter);  |
| 236 |   |
| 237 | template<typename _BIter1, typename _BIter2>  |
| 238 | _GLIBCXX20_CONSTEXPR  |
| 239 | _BIter2  |
| 240 | copy_backward(_BIter1, _BIter1, _BIter2);  |
| 241 |   |
| 242 | #if __cplusplus >= 201103L  |
| 243 | template<typename _IIter, typename _OIter, typename _Predicate>  |
| 244 | _GLIBCXX20_CONSTEXPR  |
| 245 | _OIter  |
| 246 | copy_if(_IIter, _IIter, _OIter, _Predicate);  |
| 247 |   |
| 248 | template<typename _IIter, typename _Size, typename _OIter>  |
| 249 | _GLIBCXX20_CONSTEXPR  |
| 250 | _OIter  |
| 251 | copy_n(_IIter, _Size, _OIter);  |
| 252 | #endif  |
| 253 |   |
| 254 | // count  |
| 255 | // count_if  |
| 256 |   |
| 257 | template<typename _FIter, typename _Tp>  |
| 258 | _GLIBCXX20_CONSTEXPR  |
| 259 | pair<_FIter, _FIter>  |
| 260 | equal_range(_FIter, _FIter, const _Tp&);  |
| 261 |   |
| 262 | template<typename _FIter, typename _Tp, typename _Compare>  |
| 263 | _GLIBCXX20_CONSTEXPR  |
| 264 | pair<_FIter, _FIter>  |
| 265 | equal_range(_FIter, _FIter, const _Tp&, _Compare);  |
| 266 |   |
| 267 | template<typename _FIter, typename _Tp>  |
| 268 | _GLIBCXX20_CONSTEXPR  |
| 269 | void  |
| 270 | fill(_FIter, _FIter, const _Tp&);  |
| 271 |   |
| 272 | template<typename _OIter, typename _Size, typename _Tp>  |
| 273 | _GLIBCXX20_CONSTEXPR  |
| 274 | _OIter  |
| 275 | fill_n(_OIter, _Size, const _Tp&);  |
| 276 |   |
| 277 | // find  |
| 278 |   |
| 279 | template<typename _FIter1, typename _FIter2>  |
| 280 | _GLIBCXX20_CONSTEXPR  |
| 281 | _FIter1  |
| 282 | find_end(_FIter1, _FIter1, _FIter2, _FIter2);  |
| 283 |   |
| 284 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>  |
| 285 | _GLIBCXX20_CONSTEXPR  |
| 286 | _FIter1  |
| 287 | find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);  |
| 288 |   |
| 289 | // find_first_of  |
| 290 | // find_if  |
| 291 |   |
| 292 | #if __cplusplus >= 201103L  |
| 293 | template<typename _IIter, typename _Predicate>  |
| 294 | _GLIBCXX20_CONSTEXPR  |
| 295 | _IIter  |
| 296 | find_if_not(_IIter, _IIter, _Predicate);  |
| 297 | #endif  |
| 298 |   |
| 299 | // for_each  |
| 300 | // generate  |
| 301 | // generate_n  |
| 302 |   |
| 303 | template<typename _IIter1, typename _IIter2>  |
| 304 | _GLIBCXX20_CONSTEXPR  |
| 305 | bool  |
| 306 | includes(_IIter1, _IIter1, _IIter2, _IIter2);  |
| 307 |   |
| 308 | template<typename _IIter1, typename _IIter2, typename _Compare>  |
| 309 | _GLIBCXX20_CONSTEXPR  |
| 310 | bool  |
| 311 | includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);  |
| 312 |   |
| 313 | template<typename _BIter>  |
| 314 | void  |
| 315 | inplace_merge(_BIter, _BIter, _BIter);  |
| 316 |   |
| 317 | template<typename _BIter, typename _Compare>  |
| 318 | void  |
| 319 | inplace_merge(_BIter, _BIter, _BIter, _Compare);  |
| 320 |   |
| 321 | #if __cplusplus >= 201103L  |
| 322 | template<typename _RAIter>  |
| 323 | _GLIBCXX20_CONSTEXPR  |
| 324 | bool  |
| 325 | is_heap(_RAIter, _RAIter);  |
| 326 |   |
| 327 | template<typename _RAIter, typename _Compare>  |
| 328 | _GLIBCXX20_CONSTEXPR  |
| 329 | bool  |
| 330 | is_heap(_RAIter, _RAIter, _Compare);  |
| 331 |   |
| 332 | template<typename _RAIter>  |
| 333 | _GLIBCXX20_CONSTEXPR  |
| 334 | _RAIter  |
| 335 | is_heap_until(_RAIter, _RAIter);  |
| 336 |   |
| 337 | template<typename _RAIter, typename _Compare>  |
| 338 | _GLIBCXX20_CONSTEXPR  |
| 339 | _RAIter  |
| 340 | is_heap_until(_RAIter, _RAIter, _Compare);  |
| 341 |   |
| 342 | template<typename _IIter, typename _Predicate>  |
| 343 | _GLIBCXX20_CONSTEXPR  |
| 344 | bool  |
| 345 | is_partitioned(_IIter, _IIter, _Predicate);  |
| 346 |   |
| 347 | template<typename _FIter1, typename _FIter2>  |
| 348 | _GLIBCXX20_CONSTEXPR  |
| 349 | bool  |
| 350 | is_permutation(_FIter1, _FIter1, _FIter2);  |
| 351 |   |
| 352 | template<typename _FIter1, typename _FIter2,  |
| 353 | typename _BinaryPredicate>  |
| 354 | _GLIBCXX20_CONSTEXPR  |
| 355 | bool  |
| 356 | is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate);  |
| 357 |   |
| 358 | template<typename _FIter>  |
| 359 | _GLIBCXX20_CONSTEXPR  |
| 360 | bool  |
| 361 | is_sorted(_FIter, _FIter);  |
| 362 |   |
| 363 | template<typename _FIter, typename _Compare>  |
| 364 | _GLIBCXX20_CONSTEXPR  |
| 365 | bool  |
| 366 | is_sorted(_FIter, _FIter, _Compare);  |
| 367 |   |
| 368 | template<typename _FIter>  |
| 369 | _GLIBCXX20_CONSTEXPR  |
| 370 | _FIter  |
| 371 | is_sorted_until(_FIter, _FIter);  |
| 372 |   |
| 373 | template<typename _FIter, typename _Compare>  |
| 374 | _GLIBCXX20_CONSTEXPR  |
| 375 | _FIter  |
| 376 | is_sorted_until(_FIter, _FIter, _Compare);  |
| 377 | #endif  |
| 378 |   |
| 379 | template<typename _FIter1, typename _FIter2>  |
| 380 | _GLIBCXX20_CONSTEXPR  |
| 381 | void  |
| 382 | iter_swap(_FIter1, _FIter2);  |
| 383 |   |
| 384 | template<typename _FIter, typename _Tp>  |
| 385 | _GLIBCXX20_CONSTEXPR  |
| 386 | _FIter  |
| 387 | lower_bound(_FIter, _FIter, const _Tp&);  |
| 388 |   |
| 389 | template<typename _FIter, typename _Tp, typename _Compare>  |
| 390 | _GLIBCXX20_CONSTEXPR  |
| 391 | _FIter  |
| 392 | lower_bound(_FIter, _FIter, const _Tp&, _Compare);  |
| 393 |   |
| 394 | template<typename _RAIter>  |
| 395 | _GLIBCXX20_CONSTEXPR  |
| 396 | void  |
| 397 | make_heap(_RAIter, _RAIter);  |
| 398 |   |
| 399 | template<typename _RAIter, typename _Compare>  |
| 400 | _GLIBCXX20_CONSTEXPR  |
| 401 | void  |
| 402 | make_heap(_RAIter, _RAIter, _Compare);  |
| 403 |   |
| 404 | template<typename _Tp>  |
| 405 | _GLIBCXX14_CONSTEXPR  |
| 406 | const _Tp&  |
| 407 | max(const _Tp&, const _Tp&);  |
| 408 |   |
| 409 | template<typename _Tp, typename _Compare>  |
| 410 | _GLIBCXX14_CONSTEXPR  |
| 411 | const _Tp&  |
| 412 | max(const _Tp&, const _Tp&, _Compare);  |
| 413 |   |
| 414 | // max_element  |
| 415 | // merge  |
| 416 |   |
| 417 | template<typename _Tp>  |
| 418 | _GLIBCXX14_CONSTEXPR  |
| 419 | const _Tp&  |
| 420 | min(const _Tp&, const _Tp&);  |
| 421 |   |
| 422 | template<typename _Tp, typename _Compare>  |
| 423 | _GLIBCXX14_CONSTEXPR  |
| 424 | const _Tp&  |
| 425 | min(const _Tp&, const _Tp&, _Compare);  |
| 426 |   |
| 427 | // min_element  |
| 428 |   |
| 429 | #if __cplusplus >= 201103L  |
| 430 | template<typename _Tp>  |
| 431 | _GLIBCXX14_CONSTEXPR  |
| 432 | pair<const _Tp&, const _Tp&>  |
| 433 | minmax(const _Tp&, const _Tp&);  |
| 434 |   |
| 435 | template<typename _Tp, typename _Compare>  |
| 436 | _GLIBCXX14_CONSTEXPR  |
| 437 | pair<const _Tp&, const _Tp&>  |
| 438 | minmax(const _Tp&, const _Tp&, _Compare);  |
| 439 |   |
| 440 | template<typename _FIter>  |
| 441 | _GLIBCXX14_CONSTEXPR  |
| 442 | pair<_FIter, _FIter>  |
| 443 | minmax_element(_FIter, _FIter);  |
| 444 |   |
| 445 | template<typename _FIter, typename _Compare>  |
| 446 | _GLIBCXX14_CONSTEXPR  |
| 447 | pair<_FIter, _FIter>  |
| 448 | minmax_element(_FIter, _FIter, _Compare);  |
| 449 |   |
| 450 | template<typename _Tp>  |
| 451 | _GLIBCXX14_CONSTEXPR  |
| 452 | _Tp  |
| 453 | min(initializer_list<_Tp>);  |
| 454 |   |
| 455 | template<typename _Tp, typename _Compare>  |
| 456 | _GLIBCXX14_CONSTEXPR  |
| 457 | _Tp  |
| 458 | min(initializer_list<_Tp>, _Compare);  |
| 459 |   |
| 460 | template<typename _Tp>  |
| 461 | _GLIBCXX14_CONSTEXPR  |
| 462 | _Tp  |
| 463 | max(initializer_list<_Tp>);  |
| 464 |   |
| 465 | template<typename _Tp, typename _Compare>  |
| 466 | _GLIBCXX14_CONSTEXPR  |
| 467 | _Tp  |
| 468 | max(initializer_list<_Tp>, _Compare);  |
| 469 |   |
| 470 | template<typename _Tp>  |
| 471 | _GLIBCXX14_CONSTEXPR  |
| 472 | pair<_Tp, _Tp>  |
| 473 | minmax(initializer_list<_Tp>);  |
| 474 |   |
| 475 | template<typename _Tp, typename _Compare>  |
| 476 | _GLIBCXX14_CONSTEXPR  |
| 477 | pair<_Tp, _Tp>  |
| 478 | minmax(initializer_list<_Tp>, _Compare);  |
| 479 | #endif  |
| 480 |   |
| 481 | // mismatch  |
| 482 |   |
| 483 | template<typename _BIter>  |
| 484 | _GLIBCXX20_CONSTEXPR  |
| 485 | bool  |
| 486 | next_permutation(_BIter, _BIter);  |
| 487 |   |
| 488 | template<typename _BIter, typename _Compare>  |
| 489 | _GLIBCXX20_CONSTEXPR  |
| 490 | bool  |
| 491 | next_permutation(_BIter, _BIter, _Compare);  |
| 492 |   |
| 493 | #if __cplusplus >= 201103L  |
| 494 | template<typename _IIter, typename _Predicate>  |
| 495 | _GLIBCXX20_CONSTEXPR  |
| 496 | bool  |
| 497 | none_of(_IIter, _IIter, _Predicate);  |
| 498 | #endif  |
| 499 |   |
| 500 | // nth_element  |
| 501 | // partial_sort  |
| 502 |   |
| 503 | template<typename _IIter, typename _RAIter>  |
| 504 | _GLIBCXX20_CONSTEXPR  |
| 505 | _RAIter  |
| 506 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter);  |
| 507 |   |
| 508 | template<typename _IIter, typename _RAIter, typename _Compare>  |
| 509 | _GLIBCXX20_CONSTEXPR  |
| 510 | _RAIter  |
| 511 | partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare);  |
| 512 |   |
| 513 | // partition  |
| 514 |   |
| 515 | #if __cplusplus >= 201103L  |
| 516 | template<typename _IIter, typename _OIter1,  |
| 517 | typename _OIter2, typename _Predicate>  |
| 518 | _GLIBCXX20_CONSTEXPR  |
| 519 | pair<_OIter1, _OIter2>  |
| 520 | partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);  |
| 521 |   |
| 522 | template<typename _FIter, typename _Predicate>  |
| 523 | _GLIBCXX20_CONSTEXPR  |
| 524 | _FIter  |
| 525 | partition_point(_FIter, _FIter, _Predicate);  |
| 526 | #endif  |
| 527 |   |
| 528 | template<typename _RAIter>  |
| 529 | _GLIBCXX20_CONSTEXPR  |
| 530 | void  |
| 531 | pop_heap(_RAIter, _RAIter);  |
| 532 |   |
| 533 | template<typename _RAIter, typename _Compare>  |
| 534 | _GLIBCXX20_CONSTEXPR  |
| 535 | void  |
| 536 | pop_heap(_RAIter, _RAIter, _Compare);  |
| 537 |   |
| 538 | template<typename _BIter>  |
| 539 | _GLIBCXX20_CONSTEXPR  |
| 540 | bool  |
| 541 | prev_permutation(_BIter, _BIter);  |
| 542 |   |
| 543 | template<typename _BIter, typename _Compare>  |
| 544 | _GLIBCXX20_CONSTEXPR  |
| 545 | bool  |
| 546 | prev_permutation(_BIter, _BIter, _Compare);  |
| 547 |   |
| 548 | template<typename _RAIter>  |
| 549 | _GLIBCXX20_CONSTEXPR  |
| 550 | void  |
| 551 | push_heap(_RAIter, _RAIter);  |
| 552 |   |
| 553 | template<typename _RAIter, typename _Compare>  |
| 554 | _GLIBCXX20_CONSTEXPR  |
| 555 | void  |
| 556 | push_heap(_RAIter, _RAIter, _Compare);  |
| 557 |   |
| 558 | // random_shuffle  |
| 559 |   |
| 560 | template<typename _FIter, typename _Tp>  |
| 561 | _GLIBCXX20_CONSTEXPR  |
| 562 | _FIter  |
| 563 | remove(_FIter, _FIter, const _Tp&);  |
| 564 |   |
| 565 | template<typename _FIter, typename _Predicate>  |
| 566 | _GLIBCXX20_CONSTEXPR  |
| 567 | _FIter  |
| 568 | remove_if(_FIter, _FIter, _Predicate);  |
| 569 |   |
| 570 | template<typename _IIter, typename _OIter, typename _Tp>  |
| 571 | _GLIBCXX20_CONSTEXPR  |
| 572 | _OIter  |
| 573 | remove_copy(_IIter, _IIter, _OIter, const _Tp&);  |
| 574 |   |
| 575 | template<typename _IIter, typename _OIter, typename _Predicate>  |
| 576 | _GLIBCXX20_CONSTEXPR  |
| 577 | _OIter  |
| 578 | remove_copy_if(_IIter, _IIter, _OIter, _Predicate);  |
| 579 |   |
| 580 | // replace  |
| 581 |   |
| 582 | template<typename _IIter, typename _OIter, typename _Tp>  |
| 583 | _GLIBCXX20_CONSTEXPR  |
| 584 | _OIter  |
| 585 | replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);  |
| 586 |   |
| 587 | template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>  |
| 588 | _GLIBCXX20_CONSTEXPR  |
| 589 | _OIter  |
| 590 | replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);  |
| 591 |   |
| 592 | // replace_if  |
| 593 |   |
| 594 | template<typename _BIter>  |
| 595 | _GLIBCXX20_CONSTEXPR  |
| 596 | void  |
| 597 | reverse(_BIter, _BIter);  |
| 598 |   |
| 599 | template<typename _BIter, typename _OIter>  |
| 600 | _GLIBCXX20_CONSTEXPR  |
| 601 | _OIter  |
| 602 | reverse_copy(_BIter, _BIter, _OIter);  |
| 603 |   |
| 604 | inline namespace _V2  |
| 605 | {  |
| 606 | template<typename _FIter>  |
| 607 | _GLIBCXX20_CONSTEXPR  |
| 608 | _FIter  |
| 609 | rotate(_FIter, _FIter, _FIter);  |
| 610 | }  |
| 611 |   |
| 612 | template<typename _FIter, typename _OIter>  |
| 613 | _GLIBCXX20_CONSTEXPR  |
| 614 | _OIter  |
| 615 | rotate_copy(_FIter, _FIter, _FIter, _OIter);  |
| 616 |   |
| 617 | // search  |
| 618 | // search_n  |
| 619 | // set_difference  |
| 620 | // set_intersection  |
| 621 | // set_symmetric_difference  |
| 622 | // set_union  |
| 623 |   |
| 624 | #if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1)  |
| 625 | template<typename _RAIter, typename _UGenerator>  |
| 626 | void  |
| 627 | shuffle(_RAIter, _RAIter, _UGenerator&&);  |
| 628 | #endif  |
| 629 |   |
| 630 | template<typename _RAIter>  |
| 631 | _GLIBCXX20_CONSTEXPR  |
| 632 | void  |
| 633 | sort_heap(_RAIter, _RAIter);  |
| 634 |   |
| 635 | template<typename _RAIter, typename _Compare>  |
| 636 | _GLIBCXX20_CONSTEXPR  |
| 637 | void  |
| 638 | sort_heap(_RAIter, _RAIter, _Compare);  |
| 639 |   |
| 640 | template<typename _BIter, typename _Predicate>  |
| 641 | _BIter  |
| 642 | stable_partition(_BIter, _BIter, _Predicate);  |
| 643 |   |
| 644 | #if __cplusplus < 201103L  |
| 645 | // For C++11 swap() is declared in <type_traits>.  |
| 646 |   |
| 647 | template<typename _Tp, size_t _Nm>  |
| 648 | _GLIBCXX20_CONSTEXPR  |
| 649 | inline void  |
| 650 | swap(_Tp& __a, _Tp& __b);  |
| 651 |   |
| 652 | template<typename _Tp, size_t _Nm>  |
| 653 | _GLIBCXX20_CONSTEXPR  |
| 654 | inline void  |
| 655 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]);  |
| 656 | #endif  |
| 657 |   |
| 658 | template<typename _FIter1, typename _FIter2>  |
| 659 | _GLIBCXX20_CONSTEXPR  |
| 660 | _FIter2  |
| 661 | swap_ranges(_FIter1, _FIter1, _FIter2);  |
| 662 |   |
| 663 | // transform  |
| 664 |   |
| 665 | template<typename _FIter>  |
| 666 | _GLIBCXX20_CONSTEXPR  |
| 667 | _FIter  |
| 668 | unique(_FIter, _FIter);  |
| 669 |   |
| 670 | template<typename _FIter, typename _BinaryPredicate>  |
| 671 | _GLIBCXX20_CONSTEXPR  |
| 672 | _FIter  |
| 673 | unique(_FIter, _FIter, _BinaryPredicate);  |
| 674 |   |
| 675 | // unique_copy  |
| 676 |   |
| 677 | template<typename _FIter, typename _Tp>  |
| 678 | _GLIBCXX20_CONSTEXPR  |
| 679 | _FIter  |
| 680 | upper_bound(_FIter, _FIter, const _Tp&);  |
| 681 |   |
| 682 | template<typename _FIter, typename _Tp, typename _Compare>  |
| 683 | _GLIBCXX20_CONSTEXPR  |
| 684 | _FIter  |
| 685 | upper_bound(_FIter, _FIter, const _Tp&, _Compare);  |
| 686 |   |
| 687 | _GLIBCXX_BEGIN_NAMESPACE_ALGO  |
| 688 |   |
| 689 | template<typename _FIter>  |
| 690 | _GLIBCXX20_CONSTEXPR  |
| 691 | _FIter  |
| 692 | adjacent_find(_FIter, _FIter);  |
| 693 |   |
| 694 | template<typename _FIter, typename _BinaryPredicate>  |
| 695 | _GLIBCXX20_CONSTEXPR  |
| 696 | _FIter  |
| 697 | adjacent_find(_FIter, _FIter, _BinaryPredicate);  |
| 698 |   |
| 699 | template<typename _IIter, typename _Tp>  |
| 700 | _GLIBCXX20_CONSTEXPR  |
| 701 | typename iterator_traits<_IIter>::difference_type  |
| 702 | count(_IIter, _IIter, const _Tp&);  |
| 703 |   |
| 704 | template<typename _IIter, typename _Predicate>  |
| 705 | _GLIBCXX20_CONSTEXPR  |
| 706 | typename iterator_traits<_IIter>::difference_type  |
| 707 | count_if(_IIter, _IIter, _Predicate);  |
| 708 |   |
| 709 | template<typename _IIter1, typename _IIter2>  |
| 710 | _GLIBCXX20_CONSTEXPR  |
| 711 | bool  |
| 712 | equal(_IIter1, _IIter1, _IIter2);  |
| 713 |   |
| 714 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>  |
| 715 | _GLIBCXX20_CONSTEXPR  |
| 716 | bool  |
| 717 | equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);  |
| 718 |   |
| 719 | template<typename _IIter, typename _Tp>  |
| 720 | _GLIBCXX20_CONSTEXPR  |
| 721 | _IIter  |
| 722 | find(_IIter, _IIter, const _Tp&);  |
| 723 |   |
| 724 | template<typename _FIter1, typename _FIter2>  |
| 725 | _GLIBCXX20_CONSTEXPR  |
| 726 | _FIter1  |
| 727 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);  |
| 728 |   |
| 729 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>  |
| 730 | _GLIBCXX20_CONSTEXPR  |
| 731 | _FIter1  |
| 732 | find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);  |
| 733 |   |
| 734 | template<typename _IIter, typename _Predicate>  |
| 735 | _GLIBCXX20_CONSTEXPR  |
| 736 | _IIter  |
| 737 | find_if(_IIter, _IIter, _Predicate);  |
| 738 |   |
| 739 | template<typename _IIter, typename _Funct>  |
| 740 | _GLIBCXX20_CONSTEXPR  |
| 741 | _Funct  |
| 742 | for_each(_IIter, _IIter, _Funct);  |
| 743 |   |
| 744 | template<typename _FIter, typename _Generator>  |
| 745 | _GLIBCXX20_CONSTEXPR  |
| 746 | void  |
| 747 | generate(_FIter, _FIter, _Generator);  |
| 748 |   |
| 749 | template<typename _OIter, typename _Size, typename _Generator>  |
| 750 | _GLIBCXX20_CONSTEXPR  |
| 751 | _OIter  |
| 752 | generate_n(_OIter, _Size, _Generator);  |
| 753 |   |
| 754 | template<typename _IIter1, typename _IIter2>  |
| 755 | _GLIBCXX20_CONSTEXPR  |
| 756 | bool  |
| 757 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);  |
| 758 |   |
| 759 | template<typename _IIter1, typename _IIter2, typename _Compare>  |
| 760 | _GLIBCXX20_CONSTEXPR  |
| 761 | bool  |
| 762 | lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);  |
| 763 |   |
| 764 | template<typename _FIter>  |
| 765 | _GLIBCXX14_CONSTEXPR  |
| 766 | _FIter  |
| 767 | max_element(_FIter, _FIter);  |
| 768 |   |
| 769 | template<typename _FIter, typename _Compare>  |
| 770 | _GLIBCXX14_CONSTEXPR  |
| 771 | _FIter  |
| 772 | max_element(_FIter, _FIter, _Compare);  |
| 773 |   |
| 774 | template<typename _IIter1, typename _IIter2, typename _OIter>  |
| 775 | _GLIBCXX20_CONSTEXPR  |
| 776 | _OIter  |
| 777 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);  |
| 778 |   |
| 779 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 780 | typename _Compare>  |
| 781 | _GLIBCXX20_CONSTEXPR  |
| 782 | _OIter  |
| 783 | merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);  |
| 784 |   |
| 785 | template<typename _FIter>  |
| 786 | _GLIBCXX14_CONSTEXPR  |
| 787 | _FIter  |
| 788 | min_element(_FIter, _FIter);  |
| 789 |   |
| 790 | template<typename _FIter, typename _Compare>  |
| 791 | _GLIBCXX14_CONSTEXPR  |
| 792 | _FIter  |
| 793 | min_element(_FIter, _FIter, _Compare);  |
| 794 |   |
| 795 | template<typename _IIter1, typename _IIter2>  |
| 796 | _GLIBCXX20_CONSTEXPR  |
| 797 | pair<_IIter1, _IIter2>  |
| 798 | mismatch(_IIter1, _IIter1, _IIter2);  |
| 799 |   |
| 800 | template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>  |
| 801 | _GLIBCXX20_CONSTEXPR  |
| 802 | pair<_IIter1, _IIter2>  |
| 803 | mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);  |
| 804 |   |
| 805 | template<typename _RAIter>  |
| 806 | _GLIBCXX20_CONSTEXPR  |
| 807 | void  |
| 808 | nth_element(_RAIter, _RAIter, _RAIter);  |
| 809 |   |
| 810 | template<typename _RAIter, typename _Compare>  |
| 811 | _GLIBCXX20_CONSTEXPR  |
| 812 | void  |
| 813 | nth_element(_RAIter, _RAIter, _RAIter, _Compare);  |
| 814 |   |
| 815 | template<typename _RAIter>  |
| 816 | _GLIBCXX20_CONSTEXPR  |
| 817 | void  |
| 818 | partial_sort(_RAIter, _RAIter, _RAIter);  |
| 819 |   |
| 820 | template<typename _RAIter, typename _Compare>  |
| 821 | _GLIBCXX20_CONSTEXPR  |
| 822 | void  |
| 823 | partial_sort(_RAIter, _RAIter, _RAIter, _Compare);  |
| 824 |   |
| 825 | template<typename _BIter, typename _Predicate>  |
| 826 | _GLIBCXX20_CONSTEXPR  |
| 827 | _BIter  |
| 828 | partition(_BIter, _BIter, _Predicate);  |
| 829 |   |
| 830 | template<typename _RAIter>  |
| 831 | void  |
| 832 | random_shuffle(_RAIter, _RAIter);  |
| 833 |   |
| 834 | template<typename _RAIter, typename _Generator>  |
| 835 | void  |
| 836 | random_shuffle(_RAIter, _RAIter,  |
| 837 | #if __cplusplus >= 201103L  |
| 838 | _Generator&&);  |
| 839 | #else  |
| 840 | _Generator&);  |
| 841 | #endif  |
| 842 |   |
| 843 | template<typename _FIter, typename _Tp>  |
| 844 | _GLIBCXX20_CONSTEXPR  |
| 845 | void  |
| 846 | replace(_FIter, _FIter, const _Tp&, const _Tp&);  |
| 847 |   |
| 848 | template<typename _FIter, typename _Predicate, typename _Tp>  |
| 849 | _GLIBCXX20_CONSTEXPR  |
| 850 | void  |
| 851 | replace_if(_FIter, _FIter, _Predicate, const _Tp&);  |
| 852 |   |
| 853 | template<typename _FIter1, typename _FIter2>  |
| 854 | _GLIBCXX20_CONSTEXPR  |
| 855 | _FIter1  |
| 856 | search(_FIter1, _FIter1, _FIter2, _FIter2);  |
| 857 |   |
| 858 | template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>  |
| 859 | _GLIBCXX20_CONSTEXPR  |
| 860 | _FIter1  |
| 861 | search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);  |
| 862 |   |
| 863 | template<typename _FIter, typename _Size, typename _Tp>  |
| 864 | _GLIBCXX20_CONSTEXPR  |
| 865 | _FIter  |
| 866 | search_n(_FIter, _FIter, _Size, const _Tp&);  |
| 867 |   |
| 868 | template<typename _FIter, typename _Size, typename _Tp,  |
| 869 | typename _BinaryPredicate>  |
| 870 | _GLIBCXX20_CONSTEXPR  |
| 871 | _FIter  |
| 872 | search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);  |
| 873 |   |
| 874 | template<typename _IIter1, typename _IIter2, typename _OIter>  |
| 875 | _GLIBCXX20_CONSTEXPR  |
| 876 | _OIter  |
| 877 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);  |
| 878 |   |
| 879 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 880 | typename _Compare>  |
| 881 | _GLIBCXX20_CONSTEXPR  |
| 882 | _OIter  |
| 883 | set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);  |
| 884 |   |
| 885 | template<typename _IIter1, typename _IIter2, typename _OIter>  |
| 886 | _GLIBCXX20_CONSTEXPR  |
| 887 | _OIter  |
| 888 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);  |
| 889 |   |
| 890 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 891 | typename _Compare>  |
| 892 | _GLIBCXX20_CONSTEXPR  |
| 893 | _OIter  |
| 894 | set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);  |
| 895 |   |
| 896 | template<typename _IIter1, typename _IIter2, typename _OIter>  |
| 897 | _GLIBCXX20_CONSTEXPR  |
| 898 | _OIter  |
| 899 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);  |
| 900 |   |
| 901 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 902 | typename _Compare>  |
| 903 | _GLIBCXX20_CONSTEXPR  |
| 904 | _OIter  |
| 905 | set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,  |
| 906 | _OIter, _Compare);  |
| 907 |   |
| 908 | template<typename _IIter1, typename _IIter2, typename _OIter>  |
| 909 | _GLIBCXX20_CONSTEXPR  |
| 910 | _OIter  |
| 911 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);  |
| 912 |   |
| 913 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 914 | typename _Compare>  |
| 915 | _GLIBCXX20_CONSTEXPR  |
| 916 | _OIter  |
| 917 | set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);  |
| 918 |   |
| 919 | template<typename _RAIter>  |
| 920 | _GLIBCXX20_CONSTEXPR  |
| 921 | void  |
| 922 | sort(_RAIter, _RAIter);  |
| 923 |   |
| 924 | template<typename _RAIter, typename _Compare>  |
| 925 | _GLIBCXX20_CONSTEXPR  |
| 926 | void  |
| 927 | sort(_RAIter, _RAIter, _Compare);  |
| 928 |   |
| 929 | template<typename _RAIter>  |
| 930 | void  |
| 931 | stable_sort(_RAIter, _RAIter);  |
| 932 |   |
| 933 | template<typename _RAIter, typename _Compare>  |
| 934 | void  |
| 935 | stable_sort(_RAIter, _RAIter, _Compare);  |
| 936 |   |
| 937 | template<typename _IIter, typename _OIter, typename _UnaryOperation>  |
| 938 | _GLIBCXX20_CONSTEXPR  |
| 939 | _OIter  |
| 940 | transform(_IIter, _IIter, _OIter, _UnaryOperation);  |
| 941 |   |
| 942 | template<typename _IIter1, typename _IIter2, typename _OIter,  |
| 943 | typename _BinaryOperation>  |
| 944 | _GLIBCXX20_CONSTEXPR  |
| 945 | _OIter  |
| 946 | transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);  |
| 947 |   |
| 948 | template<typename _IIter, typename _OIter>  |
| 949 | _GLIBCXX20_CONSTEXPR  |
| 950 | _OIter  |
| 951 | unique_copy(_IIter, _IIter, _OIter);  |
| 952 |   |
| 953 | template<typename _IIter, typename _OIter, typename _BinaryPredicate>  |
| 954 | _GLIBCXX20_CONSTEXPR  |
| 955 | _OIter  |
| 956 | unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);  |
| 957 |   |
| 958 | _GLIBCXX_END_NAMESPACE_ALGO  |
| 959 | _GLIBCXX_END_NAMESPACE_VERSION  |
| 960 | } // namespace std  |
| 961 |   |
| 962 | #ifdef _GLIBCXX_PARALLEL  |
| 963 | # include <parallel/algorithmfwd.h>  |
| 964 | #endif  |
| 965 |   |
| 966 | #endif  |
| 967 |   |
| 968 | |