| 1 |
// { dg-do compile } |
| 2 |
|
| 3 |
// Copyright (C) 2007-2025 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 |
// You should have received a copy of the GNU General Public License along |
| 17 |
// with this library; see the file COPYING3. If not see |
| 18 |
// <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
#include <algorithm> |
| 21 |
|
| 22 |
#if __cplusplus >= 202002L |
| 23 |
#ifndef __cpp_lib_ranges |
| 24 |
# error "Feature test macro for ranges is missing in <algorithm>" |
| 25 |
#elif __cpp_lib_ranges < 201911L |
| 26 |
# error "Feature test macro for ranges has wrong value in <algorithm>" |
| 27 |
#endif |
| 28 |
#endif |
| 29 |
|
| 30 |
namespace std |
| 31 |
{ |
| 32 |
// 25.1, non-modifying sequence operations: |
| 33 |
template<typename _IIter, typename _Funct> |
| 34 |
_GLIBCXX20_CONSTEXPR |
| 35 |
_Funct |
| 36 |
for_each(_IIter, _IIter, _Funct); |
| 37 |
|
| 38 |
template<typename _IIter, typename _Tp> |
| 39 |
_GLIBCXX20_CONSTEXPR |
| 40 |
_IIter |
| 41 |
find(_IIter, _IIter, const _Tp&); |
| 42 |
|
| 43 |
template<typename _IIter, typename _Predicate> |
| 44 |
_GLIBCXX20_CONSTEXPR |
| 45 |
_IIter |
| 46 |
find_if(_IIter, _IIter, _Predicate); |
| 47 |
|
| 48 |
#if __cplusplus >= 201103L |
| 49 |
template<typename _IIter, typename _Predicate> |
| 50 |
_GLIBCXX20_CONSTEXPR |
| 51 |
bool |
| 52 |
all_of(_IIter, _IIter, _Predicate); |
| 53 |
|
| 54 |
template<typename _IIter, typename _Predicate> |
| 55 |
_GLIBCXX20_CONSTEXPR |
| 56 |
bool |
| 57 |
any_of(_IIter, _IIter, _Predicate); |
| 58 |
|
| 59 |
template<typename _IIter, typename _Predicate> |
| 60 |
_GLIBCXX20_CONSTEXPR |
| 61 |
bool |
| 62 |
none_of(_IIter, _IIter, _Predicate); |
| 63 |
|
| 64 |
template<typename _IIter, typename _Predicate> |
| 65 |
_GLIBCXX20_CONSTEXPR |
| 66 |
_IIter |
| 67 |
find_if_not(_IIter, _IIter, _Predicate); |
| 68 |
|
| 69 |
template<typename _IIter, typename _Predicate> |
| 70 |
_GLIBCXX20_CONSTEXPR |
| 71 |
bool |
| 72 |
is_partitioned(_IIter, _IIter, _Predicate); |
| 73 |
|
| 74 |
template<typename _FIter, typename _Predicate> |
| 75 |
_GLIBCXX20_CONSTEXPR |
| 76 |
_FIter |
| 77 |
partition_point(_FIter, _FIter, _Predicate); |
| 78 |
#endif |
| 79 |
|
| 80 |
template<typename _FIter1, typename _FIter2> |
| 81 |
_GLIBCXX20_CONSTEXPR |
| 82 |
_FIter1 |
| 83 |
find_end(_FIter1, _FIter1, _FIter2, _FIter2); |
| 84 |
|
| 85 |
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 86 |
_GLIBCXX20_CONSTEXPR |
| 87 |
_FIter1 |
| 88 |
find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 89 |
|
| 90 |
template<typename _FIter1, typename _FIter2> |
| 91 |
_GLIBCXX20_CONSTEXPR |
| 92 |
_FIter1 |
| 93 |
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); |
| 94 |
|
| 95 |
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 96 |
_GLIBCXX20_CONSTEXPR |
| 97 |
_FIter1 |
| 98 |
find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 99 |
|
| 100 |
template<typename _FIter> |
| 101 |
_GLIBCXX20_CONSTEXPR |
| 102 |
_FIter |
| 103 |
adjacent_find(_FIter, _FIter); |
| 104 |
|
| 105 |
template<typename _FIter, typename _BinaryPredicate> |
| 106 |
_GLIBCXX20_CONSTEXPR |
| 107 |
_FIter |
| 108 |
adjacent_find(_FIter, _FIter, _BinaryPredicate); |
| 109 |
|
| 110 |
template<typename _IIter, typename _Tp> |
| 111 |
_GLIBCXX20_CONSTEXPR |
| 112 |
typename iterator_traits<_IIter>::difference_type |
| 113 |
count(_IIter, _IIter, const _Tp&); |
| 114 |
|
| 115 |
template<typename _IIter, typename _Predicate> |
| 116 |
_GLIBCXX20_CONSTEXPR |
| 117 |
typename iterator_traits<_IIter>::difference_type |
| 118 |
count_if(_IIter, _IIter, _Predicate); |
| 119 |
|
| 120 |
template<typename _IIter1, typename _IIter2> |
| 121 |
_GLIBCXX20_CONSTEXPR |
| 122 |
pair<_IIter1, _IIter2> |
| 123 |
mismatch(_IIter1, _IIter1, _IIter2); |
| 124 |
|
| 125 |
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> |
| 126 |
_GLIBCXX20_CONSTEXPR |
| 127 |
pair<_IIter1, _IIter2> |
| 128 |
mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); |
| 129 |
|
| 130 |
template<typename _IIter1, typename _IIter2> |
| 131 |
_GLIBCXX20_CONSTEXPR |
| 132 |
bool |
| 133 |
equal(_IIter1, _IIter1, _IIter2); |
| 134 |
|
| 135 |
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> |
| 136 |
_GLIBCXX20_CONSTEXPR |
| 137 |
bool |
| 138 |
equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); |
| 139 |
|
| 140 |
template<typename _FIter1, typename _FIter2> |
| 141 |
_GLIBCXX20_CONSTEXPR |
| 142 |
_FIter1 |
| 143 |
search(_FIter1, _FIter1, _FIter2, _FIter2); |
| 144 |
|
| 145 |
template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> |
| 146 |
_GLIBCXX20_CONSTEXPR |
| 147 |
_FIter1 |
| 148 |
search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); |
| 149 |
|
| 150 |
template<typename _FIter, typename _Size, typename _Tp> |
| 151 |
_GLIBCXX20_CONSTEXPR |
| 152 |
_FIter |
| 153 |
search_n(_FIter, _FIter, _Size, const _Tp&); |
| 154 |
|
| 155 |
template<typename _FIter, typename _Size, typename _Tp, |
| 156 |
typename _BinaryPredicate> |
| 157 |
_GLIBCXX20_CONSTEXPR |
| 158 |
_FIter |
| 159 |
search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); |
| 160 |
|
| 161 |
// 25.2, modifying sequence operations: |
| 162 |
// 25.2.1, copy: |
| 163 |
template<typename _IIter, typename _OIter> |
| 164 |
_GLIBCXX20_CONSTEXPR |
| 165 |
_OIter |
| 166 |
copy(_IIter, _IIter, _OIter); |
| 167 |
|
| 168 |
template<typename _BIter1, typename _BIter2> |
| 169 |
_GLIBCXX20_CONSTEXPR |
| 170 |
_BIter2 |
| 171 |
copy_backward (_BIter1, _BIter1, _BIter2); |
| 172 |
|
| 173 |
// 25.2.2, swap: |
| 174 |
#if __cplusplus < 201103L |
| 175 |
template<typename _Tp> |
| 176 |
_GLIBCXX20_CONSTEXPR |
| 177 |
void |
| 178 |
swap(_Tp&, _Tp& b); |
| 179 |
|
| 180 |
template<typename _Tp, size_t _Nm> |
| 181 |
_GLIBCXX20_CONSTEXPR |
| 182 |
void |
| 183 |
swap(_Tp (&)[_Nm], _Tp (&)[_Nm]); |
| 184 |
#else |
| 185 |
// C++11 swap() has complicated SFINAE constraints, test signatures like so: |
| 186 |
void (*swap_scalars)(int&, int&) = &swap; |
| 187 |
void (*swap_arrays)(int(&)[5], int(&)[5]) = &swap; |
| 188 |
#endif |
| 189 |
|
| 190 |
template<typename _FIter1, typename _FIter2> |
| 191 |
_GLIBCXX20_CONSTEXPR |
| 192 |
_FIter2 |
| 193 |
swap_ranges(_FIter1 first1, _FIter1, _FIter2); |
| 194 |
|
| 195 |
template<typename _FIter1, typename _FIter2> |
| 196 |
_GLIBCXX20_CONSTEXPR |
| 197 |
void |
| 198 |
iter_swap(_FIter1, _FIter2 b); |
| 199 |
|
| 200 |
template<typename _IIter, typename _OIter, typename _UnaryOperation> |
| 201 |
_GLIBCXX20_CONSTEXPR |
| 202 |
_OIter |
| 203 |
transform(_IIter, _IIter, _OIter, _UnaryOperation op); |
| 204 |
|
| 205 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 206 |
typename _BinaryOperation> |
| 207 |
_GLIBCXX20_CONSTEXPR |
| 208 |
_OIter |
| 209 |
transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); |
| 210 |
|
| 211 |
template<typename _FIter, typename _Tp> |
| 212 |
_GLIBCXX20_CONSTEXPR |
| 213 |
void |
| 214 |
replace(_FIter, _FIter, const _Tp&, const _Tp&); |
| 215 |
|
| 216 |
template<typename _FIter, typename _Predicate, typename _Tp> |
| 217 |
_GLIBCXX20_CONSTEXPR |
| 218 |
void |
| 219 |
replace_if(_FIter, _FIter, _Predicate, const _Tp&); |
| 220 |
|
| 221 |
template<typename _IIter, typename _OIter, typename _Tp> |
| 222 |
_GLIBCXX20_CONSTEXPR |
| 223 |
_OIter |
| 224 |
replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); |
| 225 |
|
| 226 |
template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> |
| 227 |
_GLIBCXX20_CONSTEXPR |
| 228 |
_OIter |
| 229 |
replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); |
| 230 |
|
| 231 |
template<typename _FIter, typename _Tp> |
| 232 |
_GLIBCXX20_CONSTEXPR |
| 233 |
void |
| 234 |
fill(_FIter, _FIter, const _Tp&); |
| 235 |
|
| 236 |
template<typename _OIter, typename _Size, typename _Tp> |
| 237 |
_GLIBCXX20_CONSTEXPR |
| 238 |
void |
| 239 |
fill_n(_OIter, _Size n, const _Tp&); |
| 240 |
|
| 241 |
template<typename _FIter, typename _Generator> |
| 242 |
_GLIBCXX20_CONSTEXPR |
| 243 |
void |
| 244 |
generate(_FIter, _FIter, _Generator); |
| 245 |
|
| 246 |
template<typename _OIter, typename _Size, typename _Generator> |
| 247 |
_GLIBCXX20_CONSTEXPR |
| 248 |
void |
| 249 |
generate_n(_OIter, _Size, _Generator); |
| 250 |
|
| 251 |
template<typename _FIter, typename _Tp> |
| 252 |
_GLIBCXX20_CONSTEXPR |
| 253 |
_FIter |
| 254 |
remove(_FIter, _FIter, const _Tp&); |
| 255 |
|
| 256 |
template<typename _FIter, typename _Predicate> |
| 257 |
_GLIBCXX20_CONSTEXPR |
| 258 |
_FIter |
| 259 |
remove_if(_FIter, _FIter, _Predicate); |
| 260 |
|
| 261 |
template<typename _IIter, typename _OIter, typename _Tp> |
| 262 |
_GLIBCXX20_CONSTEXPR |
| 263 |
_OIter |
| 264 |
remove_copy(_IIter, _IIter, _OIter, const _Tp&); |
| 265 |
|
| 266 |
template<typename _IIter, typename _OIter, typename _Predicate> |
| 267 |
_GLIBCXX20_CONSTEXPR |
| 268 |
_OIter |
| 269 |
remove_copy_if(_IIter, _IIter, _OIter, _Predicate); |
| 270 |
|
| 271 |
#if __cplusplus >= 201103L |
| 272 |
template<typename _IIter, typename _OIter, typename _Predicate> |
| 273 |
_GLIBCXX20_CONSTEXPR |
| 274 |
_OIter |
| 275 |
copy_if(_IIter, _IIter, _OIter, _Predicate); |
| 276 |
|
| 277 |
template<typename _IIter, typename _Size, typename _OIter> |
| 278 |
_GLIBCXX20_CONSTEXPR |
| 279 |
_OIter |
| 280 |
copy_n(_IIter, _Size, _OIter); |
| 281 |
|
| 282 |
template<typename _IIter, typename _OIter1, |
| 283 |
typename _OIter2, typename _Predicate> |
| 284 |
_GLIBCXX20_CONSTEXPR |
| 285 |
pair<_OIter1, _OIter2> |
| 286 |
partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); |
| 287 |
#endif |
| 288 |
|
| 289 |
template<typename _FIter> |
| 290 |
_GLIBCXX20_CONSTEXPR |
| 291 |
_FIter |
| 292 |
unique(_FIter, _FIter); |
| 293 |
|
| 294 |
template<typename _FIter, typename _BinaryPredicate> |
| 295 |
_GLIBCXX20_CONSTEXPR |
| 296 |
_FIter |
| 297 |
unique(_FIter, _FIter, _BinaryPredicate); |
| 298 |
|
| 299 |
template<typename _IIter, typename _OIter> |
| 300 |
_GLIBCXX20_CONSTEXPR |
| 301 |
_OIter |
| 302 |
unique_copy(_IIter, _IIter, _OIter); |
| 303 |
|
| 304 |
template<typename _IIter, typename _OIter, typename _BinaryPredicate> |
| 305 |
_GLIBCXX20_CONSTEXPR |
| 306 |
_OIter |
| 307 |
unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); |
| 308 |
|
| 309 |
template<typename _BIter> |
| 310 |
_GLIBCXX20_CONSTEXPR |
| 311 |
void |
| 312 |
reverse(_BIter, _BIter); |
| 313 |
|
| 314 |
template<typename _BIter, typename _OIter> |
| 315 |
_GLIBCXX20_CONSTEXPR |
| 316 |
_OIter |
| 317 |
reverse_copy(_BIter, _BIter, _OIter); |
| 318 |
|
| 319 |
template<typename _FIter> |
| 320 |
_GLIBCXX20_CONSTEXPR |
| 321 |
void |
| 322 |
rotate(_FIter, _FIter, _FIter); |
| 323 |
|
| 324 |
template<typename _FIter, typename _OIter> |
| 325 |
_GLIBCXX20_CONSTEXPR |
| 326 |
_OIter |
| 327 |
rotate_copy (_FIter, _FIter, _FIter, _OIter); |
| 328 |
|
| 329 |
#if __cplusplus <= 201103L |
| 330 |
template<typename _RAIter> |
| 331 |
void |
| 332 |
random_shuffle(_RAIter, _RAIter); |
| 333 |
|
| 334 |
template<typename _RAIter, typename _Generator> |
| 335 |
void |
| 336 |
random_shuffle(_RAIter, _RAIter, _Generator&); |
| 337 |
#endif |
| 338 |
|
| 339 |
#if __cplusplus >= 201103L |
| 340 |
template<typename _RAIter, typename _UniformRandomBitGenerator> |
| 341 |
void |
| 342 |
shuffle(_RAIter, _RAIter, _UniformRandomBitGenerator&); |
| 343 |
#endif |
| 344 |
|
| 345 |
// 25.2.12, partitions: |
| 346 |
template<typename _BIter, typename _Predicate> |
| 347 |
_GLIBCXX20_CONSTEXPR |
| 348 |
_BIter |
| 349 |
partition(_BIter, _BIter, _Predicate); |
| 350 |
|
| 351 |
template<typename _BIter, typename _Predicate> |
| 352 |
_GLIBCXX26_CONSTEXPR |
| 353 |
_BIter |
| 354 |
stable_partition(_BIter, _BIter, _Predicate); |
| 355 |
|
| 356 |
// 25.3, sorting and related operations: |
| 357 |
// 25.3.1, sorting: |
| 358 |
template<typename _RAIter> |
| 359 |
_GLIBCXX20_CONSTEXPR |
| 360 |
void |
| 361 |
sort(_RAIter, _RAIter); |
| 362 |
|
| 363 |
template<typename _RAIter, typename _Compare> |
| 364 |
_GLIBCXX20_CONSTEXPR |
| 365 |
void |
| 366 |
sort(_RAIter, _RAIter, _Compare); |
| 367 |
|
| 368 |
template<typename _RAIter> |
| 369 |
_GLIBCXX26_CONSTEXPR |
| 370 |
void |
| 371 |
stable_sort(_RAIter, _RAIter); |
| 372 |
|
| 373 |
template<typename _RAIter, typename _Compare> |
| 374 |
_GLIBCXX26_CONSTEXPR |
| 375 |
void |
| 376 |
stable_sort(_RAIter, _RAIter, _Compare); |
| 377 |
|
| 378 |
template<typename _RAIter> |
| 379 |
_GLIBCXX20_CONSTEXPR |
| 380 |
void |
| 381 |
partial_sort(_RAIter, _RAIter, _RAIter); |
| 382 |
|
| 383 |
template<typename _RAIter, typename _Compare> |
| 384 |
_GLIBCXX20_CONSTEXPR |
| 385 |
void |
| 386 |
partial_sort(_RAIter, _RAIter, _RAIter, _Compare); |
| 387 |
|
| 388 |
template<typename _IIter, typename _RAIter> |
| 389 |
_GLIBCXX20_CONSTEXPR |
| 390 |
_RAIter |
| 391 |
partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); |
| 392 |
|
| 393 |
template<typename _IIter, typename _RAIter, typename _Compare> |
| 394 |
_GLIBCXX20_CONSTEXPR |
| 395 |
_RAIter |
| 396 |
partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); |
| 397 |
|
| 398 |
template<typename _RAIter> |
| 399 |
_GLIBCXX20_CONSTEXPR |
| 400 |
void |
| 401 |
nth_element(_RAIter, _RAIter, _RAIter); |
| 402 |
|
| 403 |
template<typename _RAIter, typename _Compare> |
| 404 |
_GLIBCXX20_CONSTEXPR |
| 405 |
void |
| 406 |
nth_element(_RAIter, _RAIter, _RAIter, _Compare); |
| 407 |
|
| 408 |
// 25.3.3, binary search: |
| 409 |
template<typename _FIter, typename _Tp> |
| 410 |
_GLIBCXX20_CONSTEXPR |
| 411 |
_FIter |
| 412 |
lower_bound(_FIter, _FIter, const _Tp&); |
| 413 |
|
| 414 |
template<typename _FIter, typename _Tp, typename _Compare> |
| 415 |
_GLIBCXX20_CONSTEXPR |
| 416 |
_FIter |
| 417 |
lower_bound(_FIter, _FIter, const _Tp&, _Compare); |
| 418 |
|
| 419 |
template<typename _FIter, typename _Tp> |
| 420 |
_GLIBCXX20_CONSTEXPR |
| 421 |
_FIter |
| 422 |
upper_bound(_FIter, _FIter, const _Tp&); |
| 423 |
|
| 424 |
template<typename _FIter, typename _Tp, typename _Compare> |
| 425 |
_GLIBCXX20_CONSTEXPR |
| 426 |
_FIter |
| 427 |
upper_bound(_FIter, _FIter, const _Tp&, _Compare); |
| 428 |
|
| 429 |
template<typename _FIter, typename _Tp> |
| 430 |
_GLIBCXX20_CONSTEXPR |
| 431 |
pair<_FIter, _FIter> |
| 432 |
equal_range(_FIter, _FIter, const _Tp&); |
| 433 |
|
| 434 |
template<typename _FIter, typename _Tp, typename _Compare> |
| 435 |
_GLIBCXX20_CONSTEXPR |
| 436 |
pair<_FIter, _FIter> |
| 437 |
equal_range(_FIter, _FIter, const _Tp&, _Compare); |
| 438 |
|
| 439 |
template<typename _FIter, typename _Tp> |
| 440 |
_GLIBCXX20_CONSTEXPR |
| 441 |
bool |
| 442 |
binary_search(_FIter, _FIter, const _Tp&); |
| 443 |
|
| 444 |
template<typename _FIter, typename _Tp, typename _Compare> |
| 445 |
_GLIBCXX20_CONSTEXPR |
| 446 |
bool |
| 447 |
binary_search(_FIter, _FIter, const _Tp&, _Compare); |
| 448 |
|
| 449 |
// 25.3.4, merge: |
| 450 |
template<typename _IIter1, typename _IIter2, typename _OIter> |
| 451 |
_GLIBCXX20_CONSTEXPR |
| 452 |
_OIter |
| 453 |
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 454 |
|
| 455 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 456 |
typename _Compare> |
| 457 |
_GLIBCXX20_CONSTEXPR |
| 458 |
_OIter |
| 459 |
merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 460 |
|
| 461 |
template<typename _BIter> |
| 462 |
_GLIBCXX26_CONSTEXPR |
| 463 |
void |
| 464 |
inplace_merge(_BIter, _BIter, _BIter); |
| 465 |
|
| 466 |
template<typename _BIter, typename _Compare> |
| 467 |
_GLIBCXX26_CONSTEXPR |
| 468 |
void |
| 469 |
inplace_merge(_BIter, _BIter, _BIter, _Compare); |
| 470 |
|
| 471 |
// 25.3.5, set operations: |
| 472 |
template<typename _IIter1, typename _IIter2> |
| 473 |
_GLIBCXX20_CONSTEXPR |
| 474 |
bool |
| 475 |
includes(_IIter1, _IIter1, _IIter2, _IIter2); |
| 476 |
|
| 477 |
template<typename _IIter1, typename _IIter2, typename _Compare> |
| 478 |
_GLIBCXX20_CONSTEXPR |
| 479 |
bool |
| 480 |
includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); |
| 481 |
|
| 482 |
template<typename _IIter1, typename _IIter2, typename _OIter> |
| 483 |
_GLIBCXX20_CONSTEXPR |
| 484 |
_OIter |
| 485 |
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 486 |
|
| 487 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 488 |
typename _Compare> |
| 489 |
_GLIBCXX20_CONSTEXPR |
| 490 |
_OIter |
| 491 |
set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 492 |
|
| 493 |
template<typename _IIter1, typename _IIter2, typename _OIter> |
| 494 |
_GLIBCXX20_CONSTEXPR |
| 495 |
_OIter |
| 496 |
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 497 |
|
| 498 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 499 |
typename _Compare> |
| 500 |
_GLIBCXX20_CONSTEXPR |
| 501 |
_OIter |
| 502 |
set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 503 |
|
| 504 |
template<typename _IIter1, typename _IIter2, typename _OIter> |
| 505 |
_GLIBCXX20_CONSTEXPR |
| 506 |
_OIter |
| 507 |
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 508 |
|
| 509 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 510 |
typename _Compare> |
| 511 |
_GLIBCXX20_CONSTEXPR |
| 512 |
_OIter |
| 513 |
set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); |
| 514 |
|
| 515 |
template<typename _IIter1, typename _IIter2, typename _OIter> |
| 516 |
_GLIBCXX20_CONSTEXPR |
| 517 |
_OIter |
| 518 |
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); |
| 519 |
|
| 520 |
template<typename _IIter1, typename _IIter2, typename _OIter, |
| 521 |
typename _Compare> |
| 522 |
_GLIBCXX20_CONSTEXPR |
| 523 |
_OIter |
| 524 |
set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, |
| 525 |
_OIter, _Compare); |
| 526 |
|
| 527 |
// 25.3.6, heap operations: |
| 528 |
template<typename _RAIter> |
| 529 |
_GLIBCXX20_CONSTEXPR |
| 530 |
void |
| 531 |
push_heap(_RAIter, _RAIter); |
| 532 |
|
| 533 |
template<typename _RAIter, typename _Compare> |
| 534 |
_GLIBCXX20_CONSTEXPR |
| 535 |
void |
| 536 |
push_heap(_RAIter, _RAIter, _Compare); |
| 537 |
|
| 538 |
template<typename _RAIter> |
| 539 |
_GLIBCXX20_CONSTEXPR |
| 540 |
void |
| 541 |
pop_heap(_RAIter, _RAIter); |
| 542 |
|
| 543 |
template<typename _RAIter, typename _Compare> |
| 544 |
_GLIBCXX20_CONSTEXPR |
| 545 |
void |
| 546 |
pop_heap(_RAIter, _RAIter, _Compare); |
| 547 |
|
| 548 |
template<typename _RAIter> |
| 549 |
_GLIBCXX20_CONSTEXPR |
| 550 |
void |
| 551 |
make_heap(_RAIter, _RAIter); |
| 552 |
|
| 553 |
template<typename _RAIter, typename _Compare> |
| 554 |
_GLIBCXX20_CONSTEXPR |
| 555 |
void |
| 556 |
make_heap(_RAIter, _RAIter, _Compare); |
| 557 |
|
| 558 |
template<typename _RAIter> |
| 559 |
_GLIBCXX20_CONSTEXPR |
| 560 |
void |
| 561 |
sort_heap(_RAIter, _RAIter); |
| 562 |
|
| 563 |
template<typename _RAIter, typename _Compare> |
| 564 |
_GLIBCXX20_CONSTEXPR |
| 565 |
void |
| 566 |
sort_heap(_RAIter, _RAIter, _Compare); |
| 567 |
|
| 568 |
#if __cplusplus >= 201103L |
| 569 |
template<typename _RAIter> |
| 570 |
_GLIBCXX20_CONSTEXPR |
| 571 |
bool |
| 572 |
is_heap(_RAIter, _RAIter); |
| 573 |
|
| 574 |
template<typename _RAIter, typename _Compare> |
| 575 |
_GLIBCXX20_CONSTEXPR |
| 576 |
bool |
| 577 |
is_heap(_RAIter, _RAIter, _Compare); |
| 578 |
|
| 579 |
template<typename _RAIter> |
| 580 |
_GLIBCXX20_CONSTEXPR |
| 581 |
_RAIter |
| 582 |
is_heap_until(_RAIter, _RAIter); |
| 583 |
|
| 584 |
template<typename _RAIter, typename _Compare> |
| 585 |
_GLIBCXX20_CONSTEXPR |
| 586 |
_RAIter |
| 587 |
is_heap_until(_RAIter, _RAIter, _Compare); |
| 588 |
|
| 589 |
template<typename _FIter> |
| 590 |
_GLIBCXX20_CONSTEXPR |
| 591 |
bool |
| 592 |
is_sorted(_FIter, _FIter); |
| 593 |
|
| 594 |
template<typename _FIter, typename _Compare> |
| 595 |
_GLIBCXX20_CONSTEXPR |
| 596 |
bool |
| 597 |
is_sorted(_FIter, _FIter, _Compare); |
| 598 |
|
| 599 |
template<typename _FIter> |
| 600 |
_GLIBCXX20_CONSTEXPR |
| 601 |
_FIter |
| 602 |
is_sorted_until(_FIter, _FIter); |
| 603 |
|
| 604 |
template<typename _FIter, typename _Compare> |
| 605 |
_GLIBCXX20_CONSTEXPR |
| 606 |
_FIter |
| 607 |
is_sorted_until(_FIter, _FIter, _Compare); |
| 608 |
#endif |
| 609 |
|
| 610 |
// 25.3.7, minimum and maximum: |
| 611 |
template<typename _Tp> |
| 612 |
_GLIBCXX14_CONSTEXPR |
| 613 |
const _Tp& |
| 614 |
min(const _Tp&, const _Tp&); |
| 615 |
|
| 616 |
template<typename _Tp, typename _Compare> |
| 617 |
_GLIBCXX14_CONSTEXPR |
| 618 |
const _Tp& |
| 619 |
min(const _Tp&, const _Tp&, _Compare); |
| 620 |
|
| 621 |
template<typename _Tp> |
| 622 |
_GLIBCXX14_CONSTEXPR |
| 623 |
const _Tp& |
| 624 |
max(const _Tp&, const _Tp&); |
| 625 |
|
| 626 |
template<typename _Tp, typename _Compare> |
| 627 |
_GLIBCXX14_CONSTEXPR |
| 628 |
const _Tp& |
| 629 |
max(const _Tp&, const _Tp&, _Compare); |
| 630 |
|
| 631 |
template<typename _FIter> |
| 632 |
_GLIBCXX14_CONSTEXPR |
| 633 |
_FIter |
| 634 |
min_element(_FIter, _FIter); |
| 635 |
|
| 636 |
template<typename _FIter, typename _Compare> |
| 637 |
_GLIBCXX14_CONSTEXPR |
| 638 |
_FIter |
| 639 |
min_element(_FIter, _FIter, _Compare); |
| 640 |
|
| 641 |
template<typename _FIter> |
| 642 |
_GLIBCXX14_CONSTEXPR |
| 643 |
_FIter |
| 644 |
max_element(_FIter, _FIter); |
| 645 |
|
| 646 |
template<typename _FIter, typename _Compare> |
| 647 |
_GLIBCXX14_CONSTEXPR |
| 648 |
_FIter |
| 649 |
max_element(_FIter, _FIter, _Compare); |
| 650 |
|
| 651 |
#if __cplusplus >= 201103L |
| 652 |
template<typename _Tp> |
| 653 |
_GLIBCXX14_CONSTEXPR |
| 654 |
pair<const _Tp&, const _Tp&> |
| 655 |
minmax(const _Tp&, const _Tp&); |
| 656 |
|
| 657 |
template<typename _Tp, typename _Compare> |
| 658 |
_GLIBCXX14_CONSTEXPR |
| 659 |
pair<const _Tp&, const _Tp&> |
| 660 |
minmax(const _Tp&, const _Tp&, _Compare); |
| 661 |
|
| 662 |
template<typename _FIter> |
| 663 |
_GLIBCXX14_CONSTEXPR |
| 664 |
pair<_FIter, _FIter> |
| 665 |
minmax_element(_FIter, _FIter); |
| 666 |
|
| 667 |
template<typename _FIter, typename _Compare> |
| 668 |
_GLIBCXX14_CONSTEXPR |
| 669 |
pair<_FIter, _FIter> |
| 670 |
minmax_element(_FIter, _FIter, _Compare); |
| 671 |
|
| 672 |
template<typename _Tp> |
| 673 |
_GLIBCXX14_CONSTEXPR |
| 674 |
_Tp |
| 675 |
min(initializer_list<_Tp>); |
| 676 |
|
| 677 |
template<typename _Tp, typename _Compare> |
| 678 |
_GLIBCXX14_CONSTEXPR |
| 679 |
_Tp |
| 680 |
min(initializer_list<_Tp>, _Compare); |
| 681 |
|
| 682 |
template<typename _Tp> |
| 683 |
_GLIBCXX14_CONSTEXPR |
| 684 |
_Tp |
| 685 |
max(initializer_list<_Tp>); |
| 686 |
|
| 687 |
template<typename _Tp, typename _Compare> |
| 688 |
_GLIBCXX14_CONSTEXPR |
| 689 |
_Tp |
| 690 |
max(initializer_list<_Tp>, _Compare); |
| 691 |
|
| 692 |
template<typename _Tp> |
| 693 |
_GLIBCXX14_CONSTEXPR |
| 694 |
pair<_Tp, _Tp> |
| 695 |
minmax(initializer_list<_Tp>); |
| 696 |
|
| 697 |
template<typename _Tp, typename _Compare> |
| 698 |
_GLIBCXX14_CONSTEXPR |
| 699 |
pair<_Tp, _Tp> |
| 700 |
minmax(initializer_list<_Tp>, _Compare); |
| 701 |
#endif |
| 702 |
|
| 703 |
template<typename _IIter1, typename _IIter2> |
| 704 |
_GLIBCXX20_CONSTEXPR |
| 705 |
bool |
| 706 |
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); |
| 707 |
|
| 708 |
template<typename _IIter1, typename _IIter2, typename _Compare> |
| 709 |
_GLIBCXX20_CONSTEXPR |
| 710 |
bool |
| 711 |
lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); |
| 712 |
|
| 713 |
// 25.3.9, permutations |
| 714 |
template<typename _BIter> |
| 715 |
_GLIBCXX20_CONSTEXPR |
| 716 |
bool |
| 717 |
next_permutation(_BIter, _BIter); |
| 718 |
|
| 719 |
template<typename _BIter, typename _Compare> |
| 720 |
_GLIBCXX20_CONSTEXPR |
| 721 |
bool |
| 722 |
next_permutation(_BIter, _BIter, _Compare); |
| 723 |
|
| 724 |
template<typename _BIter> |
| 725 |
_GLIBCXX20_CONSTEXPR |
| 726 |
bool |
| 727 |
prev_permutation(_BIter, _BIter); |
| 728 |
|
| 729 |
template<typename _BIter, typename _Compare> |
| 730 |
_GLIBCXX20_CONSTEXPR |
| 731 |
bool |
| 732 |
prev_permutation(_BIter, _BIter, _Compare); |
| 733 |
} |