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 _PSTL_ALGORITHM_FWD_H 11 #define _PSTL_ALGORITHM_FWD_H 12 13 #include <iterator> 14 #include <type_traits> 15 #include <utility> 16 17 #include "pstl_config.h" 18 19 _PSTL_HIDE_FROM_ABI_PUSH 20 21 namespace __pstl 22 { 23 namespace __internal 24 { 25 26 //------------------------------------------------------------------------ 27 // any_of 28 //------------------------------------------------------------------------ 29 30 template <class _ForwardIterator, class _Pred> 31 bool 32 __brick_any_of(const _ForwardIterator, const _ForwardIterator, _Pred, 33 /*__is_vector=*/std::false_type) noexcept; 34 35 template <class _RandomAccessIterator, class _Pred> 36 bool 37 __brick_any_of(const _RandomAccessIterator, const _RandomAccessIterator, _Pred, 38 /*__is_vector=*/std::true_type) noexcept; 39 40 template <class _ExecutionPolicy, class _ForwardIterator, class _Pred, class _IsVector> 41 bool 42 __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector, 43 /*parallel=*/std::false_type) noexcept; 44 45 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Pred, class _IsVector> 46 bool 47 __pattern_any_of(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Pred, _IsVector, 48 /*parallel=*/std::true_type); 49 50 //------------------------------------------------------------------------ 51 // walk1 (pseudo) 52 // 53 // walk1 evaluates f(x) for each dereferenced value x drawn from [first,last) 54 //------------------------------------------------------------------------ 55 56 template <class _ForwardIterator, class _Function> 57 void __brick_walk1(_ForwardIterator, _ForwardIterator, _Function, 58 /*vector=*/std::false_type) noexcept; 59 60 template <class _RandomAccessIterator, class _Function> 61 void __brick_walk1(_RandomAccessIterator, _RandomAccessIterator, _Function, 62 /*vector=*/std::true_type) noexcept; 63 64 template <class _ExecutionPolicy, class _ForwardIterator, class _Function, class _IsVector> 65 void 66 __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector, 67 /*parallel=*/std::false_type) noexcept; 68 69 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Function, class _IsVector> 70 void 71 __pattern_walk1(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Function, _IsVector, 72 /*parallel=*/std::true_type); 73 74 template <class _ExecutionPolicy, class _ForwardIterator, class _Brick> 75 void 76 __pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick, 77 /*parallel=*/std::false_type) noexcept; 78 79 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Brick> 80 void 81 __pattern_walk_brick(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Brick, 82 /*parallel=*/std::true_type); 83 84 //------------------------------------------------------------------------ 85 // walk1_n 86 //------------------------------------------------------------------------ 87 88 template <class _ForwardIterator, class _Size, class _Function> 89 _ForwardIterator __brick_walk1_n(_ForwardIterator, _Size, _Function, 90 /*_IsVectorTag=*/std::false_type); 91 92 template <class _RandomAccessIterator, class _DifferenceType, class _Function> 93 _RandomAccessIterator __brick_walk1_n(_RandomAccessIterator, _DifferenceType, _Function, 94 /*vectorTag=*/std::true_type) noexcept; 95 96 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Function, class _IsVector> 97 _ForwardIterator 98 __pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Function, _IsVector, 99 /*is_parallel=*/std::false_type) noexcept; 100 101 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Function, class _IsVector> 102 _RandomAccessIterator 103 __pattern_walk1_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Function, _IsVector, 104 /*is_parallel=*/std::true_type); 105 106 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Brick> 107 _ForwardIterator 108 __pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Brick, 109 /*is_parallel=*/std::false_type) noexcept; 110 111 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Brick> 112 _RandomAccessIterator 113 __pattern_walk_brick_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Brick, 114 /*is_parallel=*/std::true_type); 115 116 //------------------------------------------------------------------------ 117 // walk2 (pseudo) 118 // 119 // walk2 evaluates f(x,y) for deferenced values (x,y) drawn from [first1,last1) and [first2,...) 120 //------------------------------------------------------------------------ 121 122 template <class _ForwardIterator1, class _ForwardIterator2, class _Function> 123 _ForwardIterator2 __brick_walk2(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, 124 /*vector=*/std::false_type) noexcept; 125 126 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _Function> 127 _RandomAccessIterator2 __brick_walk2(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Function, 128 /*vector=*/std::true_type) noexcept; 129 130 template <class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function> 131 _ForwardIterator2 __brick_walk2_n(_ForwardIterator1, _Size, _ForwardIterator2, _Function, 132 /*vector=*/std::false_type) noexcept; 133 134 template <class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2, class _Function> 135 _RandomAccessIterator2 __brick_walk2_n(_RandomAccessIterator1, _Size, _RandomAccessIterator2, _Function, 136 /*vector=*/std::true_type) noexcept; 137 138 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Function, class _IsVector> 139 _ForwardIterator2 140 __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector, 141 /*parallel=*/std::false_type) noexcept; 142 143 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Function, 144 class _IsVector> 145 _RandomAccessIterator2 146 __pattern_walk2(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Function, 147 _IsVector, 148 /*parallel=*/std::true_type); 149 150 template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Function, 151 class _IsVector> 152 _ForwardIterator2 153 __pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Function, _IsVector, 154 /*parallel=*/std::false_type) noexcept; 155 156 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2, 157 class _Function, class _IsVector> 158 _RandomAccessIterator2 159 __pattern_walk2_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Function, _IsVector, 160 /*parallel=*/std::true_type); 161 162 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Brick> 163 _ForwardIterator2 164 __pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Brick, 165 /*parallel=*/std::false_type) noexcept; 166 167 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Brick> 168 _RandomAccessIterator2 169 __pattern_walk2_brick(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 170 _Brick, 171 /*parallel=*/std::true_type); 172 173 template <class _ExecutionPolicy, class _ForwardIterator1, class _Size, class _ForwardIterator2, class _Brick> 174 _ForwardIterator2 175 __pattern_walk2_brick_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Brick, 176 /*parallel=*/std::false_type) noexcept; 177 178 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2, class _Brick> 179 _RandomAccessIterator2 180 __pattern_walk2_brick_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Brick, 181 /*parallel=*/std::true_type); 182 183 //------------------------------------------------------------------------ 184 // walk3 (pseudo) 185 // 186 // walk3 evaluates f(x,y,z) for (x,y,z) drawn from [first1,last1), [first2,...), [first3,...) 187 //------------------------------------------------------------------------ 188 189 template <class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator3, class _Function> 190 _ForwardIterator3 __brick_walk3(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3, _Function, 191 /*vector=*/std::false_type) noexcept; 192 193 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _RandomAccessIterator3, class _Function> 194 _RandomAccessIterator3 __brick_walk3(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 195 _RandomAccessIterator3, _Function, 196 /*vector=*/std::true_type) noexcept; 197 198 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator3, 199 class _Function, class _IsVector> 200 _ForwardIterator3 201 __pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator3, 202 _Function, _IsVector, 203 /*parallel=*/std::false_type) noexcept; 204 205 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, 206 class _RandomAccessIterator3, class _Function, class _IsVector> 207 _RandomAccessIterator3 208 __pattern_walk3(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 209 _RandomAccessIterator3, _Function, _IsVector, /*parallel=*/std::true_type); 210 211 //------------------------------------------------------------------------ 212 // equal 213 //------------------------------------------------------------------------ 214 215 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 216 bool __brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate, 217 /* is_vector = */ std::false_type) noexcept; 218 219 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate> 220 bool __brick_equal(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _BinaryPredicate, 221 /* is_vector = */ std::true_type) noexcept; 222 223 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate, 224 class _IsVector> 225 bool 226 __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate, 227 _IsVector, /* is_parallel = */ std::false_type) noexcept; 228 229 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate, 230 class _IsVector> 231 bool 232 __pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 233 _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type); 234 235 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 236 bool __brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, 237 /* is_vector = */ std::false_type) noexcept; 238 239 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate> 240 bool __brick_equal(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, 241 _BinaryPredicate, /* is_vector = */ std::true_type) noexcept; 242 243 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate, 244 class _IsVector> 245 bool 246 __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 247 _BinaryPredicate, _IsVector, /* is_parallel = */ std::false_type) noexcept; 248 249 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate, 250 class _IsVector> 251 bool 252 __pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 253 _RandomAccessIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type); 254 255 //------------------------------------------------------------------------ 256 // find_if 257 //------------------------------------------------------------------------ 258 259 template <class _ForwardIterator, class _Predicate> 260 _ForwardIterator __brick_find_if(_ForwardIterator, _ForwardIterator, _Predicate, 261 /*is_vector=*/std::false_type) noexcept; 262 263 template <class _RandomAccessIterator, class _Predicate> 264 _RandomAccessIterator __brick_find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, 265 /*is_vector=*/std::true_type) noexcept; 266 267 template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector> 268 _ForwardIterator 269 __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector, 270 /*is_parallel=*/std::false_type) noexcept; 271 272 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Predicate, class _IsVector> 273 _RandomAccessIterator 274 __pattern_find_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Predicate, _IsVector, 275 /*is_parallel=*/std::true_type); 276 277 //------------------------------------------------------------------------ 278 // find_end 279 //------------------------------------------------------------------------ 280 281 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 282 _ForwardIterator1 __brick_find_end(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 283 _BinaryPredicate, 284 /*__is_vector=*/std::false_type) noexcept; 285 286 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate> 287 _RandomAccessIterator1 __brick_find_end(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 288 _RandomAccessIterator2, _BinaryPredicate, 289 /*__is_vector=*/std::true_type) noexcept; 290 291 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate, 292 class _IsVector> 293 _ForwardIterator1 294 __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 295 _BinaryPredicate, _IsVector, 296 /*is_parallel=*/std::false_type) noexcept; 297 298 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate, 299 class _IsVector> 300 _RandomAccessIterator1 301 __pattern_find_end(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 302 _RandomAccessIterator2, _BinaryPredicate, _IsVector, 303 /*is_parallel=*/std::true_type) noexcept; 304 305 //------------------------------------------------------------------------ 306 // find_first_of 307 //------------------------------------------------------------------------ 308 309 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 310 _ForwardIterator1 __brick_find_first_of(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 311 _BinaryPredicate, 312 /*__is_vector=*/std::false_type) noexcept; 313 314 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate> 315 _RandomAccessIterator1 __brick_find_first_of(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 316 _RandomAccessIterator2, _BinaryPredicate, 317 /*__is_vector=*/std::true_type) noexcept; 318 319 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate, 320 class _IsVector> 321 _ForwardIterator1 322 __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 323 _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; 324 325 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate, 326 class _IsVector> 327 _RandomAccessIterator1 328 __pattern_find_first_of(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 329 _RandomAccessIterator2, _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; 330 331 //------------------------------------------------------------------------ 332 // search 333 //------------------------------------------------------------------------ 334 335 template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> 336 _ForwardIterator1 __brick_search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 337 _BinaryPredicate, 338 /*vector=*/std::false_type) noexcept; 339 340 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate> 341 _RandomAccessIterator1 __brick_search(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 342 _RandomAccessIterator2, _BinaryPredicate, 343 /*vector=*/std::true_type) noexcept; 344 345 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate, 346 class _IsVector> 347 _ForwardIterator1 348 __pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 349 _BinaryPredicate, _IsVector, 350 /*is_parallel=*/std::false_type) noexcept; 351 352 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _BinaryPredicate, 353 class _IsVector> 354 _RandomAccessIterator1 355 __pattern_search(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 356 _RandomAccessIterator2, _BinaryPredicate, _IsVector, 357 /*is_parallel=*/std::true_type) noexcept; 358 359 //------------------------------------------------------------------------ 360 // search_n 361 //------------------------------------------------------------------------ 362 363 template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate> 364 _ForwardIterator 365 __brick_search_n(_ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate, 366 /*vector=*/std::false_type) noexcept; 367 368 template <class _RandomAccessIterator, class _Size, class _Tp, class _BinaryPredicate> 369 _RandomAccessIterator 370 __brick_search_n(_RandomAccessIterator, _RandomAccessIterator, _Size, const _Tp&, _BinaryPredicate, 371 /*vector=*/std::true_type) noexcept; 372 373 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate, 374 class IsVector> 375 _ForwardIterator 376 __pattern_search_n(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Size, const _Tp&, _BinaryPredicate, 377 IsVector, 378 /*is_parallel=*/std::false_type) noexcept; 379 380 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Tp, class _BinaryPredicate, 381 class IsVector> 382 _RandomAccessIterator 383 __pattern_search_n(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Size, const _Tp&, 384 _BinaryPredicate, IsVector, 385 /*is_parallel=*/std::true_type) noexcept; 386 387 //------------------------------------------------------------------------ 388 // copy_n 389 //------------------------------------------------------------------------ 390 391 template <class _ForwardIterator, class _Size, class _OutputIterator> 392 _OutputIterator __brick_copy_n(_ForwardIterator, _Size, _OutputIterator, 393 /*vector=*/std::false_type) noexcept; 394 395 template <class _RandomAccessIterator, class _Size, class _OutputIterator> 396 _OutputIterator __brick_copy_n(_RandomAccessIterator, _Size, _OutputIterator, 397 /*vector=*/std::true_type) noexcept; 398 399 //------------------------------------------------------------------------ 400 // copy 401 //------------------------------------------------------------------------ 402 403 template <class _ForwardIterator, class _OutputIterator> 404 _OutputIterator __brick_copy(_ForwardIterator, _ForwardIterator, _OutputIterator, 405 /*vector=*/std::false_type) noexcept; 406 407 template <class _RandomAccessIterator, class _OutputIterator> 408 _OutputIterator __brick_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, 409 /*vector=*/std::true_type) noexcept; 410 411 //------------------------------------------------------------------------ 412 // move 413 //------------------------------------------------------------------------ 414 415 template <class _ForwardIterator, class _OutputIterator> 416 _OutputIterator __brick_move(_ForwardIterator, _ForwardIterator, _OutputIterator, 417 /*vector=*/std::false_type) noexcept; 418 419 template <class _RandomAccessIterator, class _OutputIterator> 420 _OutputIterator __brick_move(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, 421 /*vector=*/std::true_type) noexcept; 422 423 //------------------------------------------------------------------------ 424 // swap_ranges 425 //------------------------------------------------------------------------ 426 template <class _ForwardIterator, class _OutputIterator> 427 _OutputIterator 428 __brick_swap_ranges(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, 429 /*vector=*/std::false_type) noexcept; 430 431 template <class _RandomAccessIterator, class _OutputIterator> 432 _OutputIterator 433 __brick_swap_ranges(_RandomAccessIterator __first, _RandomAccessIterator __last, _OutputIterator __result, 434 /*vector=*/std::true_type) noexcept; 435 436 //------------------------------------------------------------------------ 437 // copy_if 438 //------------------------------------------------------------------------ 439 440 template <class _ForwardIterator, class _OutputIterator, class _UnaryPredicate> 441 _OutputIterator __brick_copy_if(_ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, 442 /*vector=*/std::false_type) noexcept; 443 444 template <class _RandomAccessIterator, class _OutputIterator, class _UnaryPredicate> 445 _OutputIterator __brick_copy_if(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryPredicate, 446 /*vector=*/std::true_type) noexcept; 447 448 template <class _DifferenceType, class _ForwardIterator, class _UnaryPredicate> 449 std::pair<_DifferenceType, _DifferenceType> 450 __brick_calc_mask_1(_ForwardIterator, _ForwardIterator, bool* __restrict, _UnaryPredicate, 451 /*vector=*/std::false_type) noexcept; 452 template <class _DifferenceType, class _RandomAccessIterator, class _UnaryPredicate> 453 std::pair<_DifferenceType, _DifferenceType> 454 __brick_calc_mask_1(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _UnaryPredicate, 455 /*vector=*/std::true_type) noexcept; 456 457 template <class _ForwardIterator, class _OutputIterator> 458 void 459 __brick_copy_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator, bool*, 460 /*vector=*/std::false_type) noexcept; 461 462 template <class _RandomAccessIterator, class _OutputIterator> 463 void 464 __brick_copy_by_mask(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, bool* __restrict, 465 /*vector=*/std::true_type) noexcept; 466 467 template <class _ForwardIterator, class _OutputIterator1, class _OutputIterator2> 468 void 469 __brick_partition_by_mask(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, bool*, 470 /*vector=*/std::false_type) noexcept; 471 472 template <class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2> 473 void 474 __brick_partition_by_mask(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator1, _OutputIterator2, bool*, 475 /*vector=*/std::true_type) noexcept; 476 477 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _UnaryPredicate, class _IsVector> 478 _OutputIterator 479 __pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, _IsVector, 480 /*parallel=*/std::false_type) noexcept; 481 482 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _UnaryPredicate, 483 class _IsVector> 484 _OutputIterator 485 __pattern_copy_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryPredicate, 486 _IsVector, /*parallel=*/std::true_type); 487 488 //------------------------------------------------------------------------ 489 // count 490 //------------------------------------------------------------------------ 491 492 template <class _RandomAccessIterator, class _Predicate> 493 typename std::iterator_traits<_RandomAccessIterator>::difference_type 494 __brick_count(_RandomAccessIterator, _RandomAccessIterator, _Predicate, 495 /* is_vector = */ std::true_type) noexcept; 496 497 template <class _ForwardIterator, class _Predicate> 498 typename std::iterator_traits<_ForwardIterator>::difference_type 499 __brick_count(_ForwardIterator, _ForwardIterator, _Predicate, 500 /* is_vector = */ std::false_type) noexcept; 501 502 template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate, class _IsVector> 503 typename std::iterator_traits<_ForwardIterator>::difference_type 504 __pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, 505 /* is_parallel */ std::false_type, _IsVector) noexcept; 506 507 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Predicate, class _IsVector> 508 typename std::iterator_traits<_RandomAccessIterator>::difference_type 509 __pattern_count(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Predicate, 510 /* is_parallel */ std::true_type, _IsVector); 511 512 //------------------------------------------------------------------------ 513 // unique 514 //------------------------------------------------------------------------ 515 516 template <class _ForwardIterator, class _BinaryPredicate> 517 _ForwardIterator __brick_unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate, 518 /*is_vector=*/std::false_type) noexcept; 519 520 template <class _RandomAccessIterator, class _BinaryPredicate> 521 _RandomAccessIterator __brick_unique(_RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, 522 /*is_vector=*/std::true_type) noexcept; 523 524 template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector> 525 _ForwardIterator 526 __pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector, 527 /*is_parallel=*/std::false_type) noexcept; 528 529 template <class _ExecutionPolicy, class _RandomAccessIterator, class _BinaryPredicate, class _IsVector> 530 _RandomAccessIterator 531 __pattern_unique(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, _IsVector, 532 /*is_parallel=*/std::true_type) noexcept; 533 534 //------------------------------------------------------------------------ 535 // unique_copy 536 //------------------------------------------------------------------------ 537 538 template <class _ForwardIterator, class OutputIterator, class _BinaryPredicate> 539 OutputIterator __brick_unique_copy(_ForwardIterator, _ForwardIterator, OutputIterator, _BinaryPredicate, 540 /*vector=*/std::false_type) noexcept; 541 542 template <class _RandomAccessIterator, class _OutputIterator, class _BinaryPredicate> 543 _OutputIterator __brick_unique_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _BinaryPredicate, 544 /*vector=*/std::true_type) noexcept; 545 546 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _BinaryPredicate, 547 class _IsVector> 548 _OutputIterator 549 __pattern_unique_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryPredicate, 550 _IsVector, /*parallel=*/std::false_type) noexcept; 551 552 template <class _ExecutionPolicy, class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate> 553 _DifferenceType 554 __brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate, 555 /*vector=*/std::false_type) noexcept; 556 557 template <class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate> 558 _DifferenceType 559 __brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate, 560 /*vector=*/std::true_type) noexcept; 561 562 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _BinaryPredicate, 563 class _IsVector> 564 _OutputIterator 565 __pattern_unique_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, 566 _BinaryPredicate, _IsVector, /*parallel=*/std::true_type); 567 568 //------------------------------------------------------------------------ 569 // reverse 570 //------------------------------------------------------------------------ 571 572 template <class _BidirectionalIterator> 573 void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator, 574 /*__is_vector=*/std::false_type) noexcept; 575 576 template <class _RandomAccessIterator> 577 void __brick_reverse(_RandomAccessIterator, _RandomAccessIterator, 578 /*__is_vector=*/std::true_type) noexcept; 579 580 template <class _BidirectionalIterator> 581 void __brick_reverse(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, 582 /*is_vector=*/std::false_type) noexcept; 583 584 template <class _RandomAccessIterator> 585 void __brick_reverse(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 586 /*is_vector=*/std::true_type) noexcept; 587 588 template <class _ExecutionPolicy, class _BidirectionalIterator, class _IsVector> 589 void 590 __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector, 591 /*is_parallel=*/std::false_type) noexcept; 592 593 template <class _ExecutionPolicy, class _RandomAccessIterator, class _IsVector> 594 void 595 __pattern_reverse(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _IsVector, 596 /*is_parallel=*/std::true_type); 597 598 //------------------------------------------------------------------------ 599 // reverse_copy 600 //------------------------------------------------------------------------ 601 602 template <class _BidirectionalIterator, class _OutputIterator> 603 _OutputIterator __brick_reverse_copy(_BidirectionalIterator, _BidirectionalIterator, _OutputIterator, 604 /*is_vector=*/std::false_type) noexcept; 605 606 template <class _RandomAccessIterator, class _OutputIterator> 607 _OutputIterator __brick_reverse_copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, 608 /*is_vector=*/std::true_type) noexcept; 609 610 template <class _ExecutionPolicy, class _BidirectionalIterator, class _OutputIterator, class _IsVector> 611 _OutputIterator 612 __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector, 613 /*is_parallel=*/std::false_type) noexcept; 614 615 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _IsVector> 616 _OutputIterator 617 __pattern_reverse_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _IsVector, 618 /*is_parallel=*/std::true_type); 619 620 //------------------------------------------------------------------------ 621 // rotate 622 //------------------------------------------------------------------------ 623 624 template <class _ForwardIterator> 625 _ForwardIterator __brick_rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator, 626 /*is_vector=*/std::false_type) noexcept; 627 628 template <class _RandomAccessIterator> 629 _RandomAccessIterator __brick_rotate(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 630 /*is_vector=*/std::true_type) noexcept; 631 632 template <class _ExecutionPolicy, class _ForwardIterator, class _IsVector> 633 _ForwardIterator 634 __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector, 635 /*is_parallel=*/std::false_type) noexcept; 636 637 template <class _ExecutionPolicy, class _RandomAccessIterator, class _IsVector> 638 _RandomAccessIterator 639 __pattern_rotate(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _IsVector, 640 /*is_parallel=*/std::true_type); 641 642 //------------------------------------------------------------------------ 643 // rotate_copy 644 //------------------------------------------------------------------------ 645 646 template <class _ForwardIterator, class _OutputIterator> 647 _OutputIterator __brick_rotate_copy(_ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, 648 /*__is_vector=*/std::false_type) noexcept; 649 650 template <class _RandomAccessIterator, class _OutputIterator> 651 _OutputIterator __brick_rotate_copy(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 652 _OutputIterator, 653 /*__is_vector=*/std::true_type) noexcept; 654 655 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector> 656 _OutputIterator 657 __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, 658 _IsVector, 659 /*is_parallel=*/std::false_type) noexcept; 660 661 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _IsVector> 662 _OutputIterator 663 __pattern_rotate_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 664 _OutputIterator, _IsVector, 665 /*is_parallel=*/std::true_type); 666 667 //------------------------------------------------------------------------ 668 // is_partitioned 669 //------------------------------------------------------------------------ 670 671 template <class _ForwardIterator, class _UnaryPredicate> 672 bool __brick_is_partitioned(_ForwardIterator, _ForwardIterator, _UnaryPredicate, 673 /*is_vector=*/std::false_type) noexcept; 674 675 template <class _RandomAccessIterator, class _UnaryPredicate> 676 bool __brick_is_partitioned(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, 677 /*is_vector=*/std::true_type) noexcept; 678 679 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector> 680 bool 681 __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, 682 /*is_parallel=*/std::false_type) noexcept; 683 684 template <class _ExecutionPolicy, class _RandomAccessIterator, class _UnaryPredicate, class _IsVector> 685 bool 686 __pattern_is_partitioned(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, _IsVector, 687 /*is_parallel=*/std::true_type); 688 689 //------------------------------------------------------------------------ 690 // partition 691 //------------------------------------------------------------------------ 692 693 template <class _ForwardIterator, class _UnaryPredicate> 694 _ForwardIterator __brick_partition(_ForwardIterator, _ForwardIterator, _UnaryPredicate, 695 /*is_vector=*/std::false_type) noexcept; 696 697 template <class _RandomAccessIterator, class _UnaryPredicate> 698 _RandomAccessIterator __brick_partition(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, 699 /*is_vector=*/std::true_type) noexcept; 700 701 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector> 702 _ForwardIterator 703 __pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, 704 /*is_parallel=*/std::false_type) noexcept; 705 706 template <class _ExecutionPolicy, class _RandomAccessIterator, class _UnaryPredicate, class _IsVector> 707 _RandomAccessIterator 708 __pattern_partition(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, _IsVector, 709 /*is_parallel=*/std::true_type); 710 711 //------------------------------------------------------------------------ 712 // stable_partition 713 //------------------------------------------------------------------------ 714 715 template <class _BidirectionalIterator, class _UnaryPredicate> 716 _BidirectionalIterator __brick_stable_partition(_BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, 717 /*__is_vector=*/std::false_type) noexcept; 718 719 template <class _RandomAccessIterator, class _UnaryPredicate> 720 _RandomAccessIterator __brick_stable_partition(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, 721 /*__is_vector=*/std::true_type) noexcept; 722 723 template <class _ExecutionPolicy, class _BidirectionalIterator, class _UnaryPredicate, class _IsVector> 724 _BidirectionalIterator 725 __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, 726 _IsVector, 727 /*is_parallelization=*/std::false_type) noexcept; 728 729 template <class _ExecutionPolicy, class _RandomAccessIterator, class _UnaryPredicate, class _IsVector> 730 _RandomAccessIterator 731 __pattern_stable_partition(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, _IsVector, 732 /*is_parallelization=*/std::true_type) noexcept; 733 734 //------------------------------------------------------------------------ 735 // partition_copy 736 //------------------------------------------------------------------------ 737 738 template <class _ForwardIterator, class _OutputIterator1, class _OutputIterator2, class _UnaryPredicate> 739 std::pair<_OutputIterator1, _OutputIterator2> 740 __brick_partition_copy(_ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, _UnaryPredicate, 741 /*is_vector=*/std::false_type) noexcept; 742 743 template <class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2, class _UnaryPredicate> 744 std::pair<_OutputIterator1, _OutputIterator2> __brick_partition_copy(_RandomAccessIterator, _RandomAccessIterator, 745 _OutputIterator1, _OutputIterator2, 746 _UnaryPredicate, 747 /*is_vector=*/std::true_type) noexcept; 748 749 template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator1, class _OutputIterator2, 750 class _UnaryPredicate, class _IsVector> 751 std::pair<_OutputIterator1, _OutputIterator2> 752 __pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator1, _OutputIterator2, 753 _UnaryPredicate, _IsVector, 754 /*is_parallelization=*/std::false_type) noexcept; 755 756 template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator1, class _OutputIterator2, 757 class _UnaryPredicate, class _IsVector> 758 std::pair<_OutputIterator1, _OutputIterator2> 759 __pattern_partition_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator1, 760 _OutputIterator2, _UnaryPredicate, _IsVector, 761 /*is_parallelization=*/std::true_type); 762 763 //------------------------------------------------------------------------ 764 // sort 765 //------------------------------------------------------------------------ 766 767 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector, 768 class _IsMoveConstructible> 769 void 770 __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, 771 /*is_parallel=*/std::false_type, _IsMoveConstructible) noexcept; 772 773 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 774 void 775 __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, 776 /*is_parallel=*/std::true_type, 777 /*is_move_constructible=*/std::true_type); 778 779 //------------------------------------------------------------------------ 780 // stable_sort 781 //------------------------------------------------------------------------ 782 783 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 784 void 785 __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, 786 _IsVector /*is_vector*/, 787 /*is_parallel=*/std::false_type) noexcept; 788 789 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 790 void 791 __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, 792 _IsVector /*is_vector*/, 793 /*is_parallel=*/std::true_type); 794 795 //------------------------------------------------------------------------ 796 // partial_sort 797 //------------------------------------------------------------------------ 798 799 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 800 void 801 __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 802 _Compare, _IsVector, 803 /*is_parallel=*/std::false_type) noexcept; 804 805 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 806 void 807 __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 808 _Compare, _IsVector, 809 /*is_parallel=*/std::true_type); 810 811 //------------------------------------------------------------------------ 812 // partial_sort_copy 813 //------------------------------------------------------------------------ 814 815 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Compare, 816 class _IsVector> 817 _RandomAccessIterator2 818 __pattern_partial_sort_copy(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 819 _RandomAccessIterator2, _Compare, _IsVector, 820 /*is_parallel=*/std::false_type) noexcept; 821 822 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Compare, 823 class _IsVector> 824 _RandomAccessIterator2 825 __pattern_partial_sort_copy(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 826 _RandomAccessIterator2, _Compare, _IsVector, 827 /*is_parallel=*/std::true_type); 828 829 //------------------------------------------------------------------------ 830 // adjacent_find 831 //------------------------------------------------------------------------ 832 833 template <class _RandomAccessIterator, class _BinaryPredicate> 834 _RandomAccessIterator 835 __brick_adjacent_find(_RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, 836 /* IsVector = */ std::true_type, bool) noexcept; 837 838 template <class _ForwardIterator, class _BinaryPredicate> 839 _ForwardIterator 840 __brick_adjacent_find(_ForwardIterator, _ForwardIterator, _BinaryPredicate, 841 /* IsVector = */ std::false_type, bool) noexcept; 842 843 template <class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate, class _IsVector> 844 _ForwardIterator 845 __pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, 846 /* is_parallel */ std::false_type, _IsVector, bool) noexcept; 847 848 template <class _ExecutionPolicy, class _RandomAccessIterator, class _BinaryPredicate, class _IsVector> 849 _RandomAccessIterator 850 __pattern_adjacent_find(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, 851 /* is_parallel */ std::true_type, _IsVector, bool); 852 853 //------------------------------------------------------------------------ 854 // nth_element 855 //------------------------------------------------------------------------ 856 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 857 void 858 __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, 859 _IsVector, 860 /*is_parallel=*/std::false_type) noexcept; 861 862 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 863 void 864 __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, 865 _IsVector, 866 /*is_parallel=*/std::true_type) noexcept; 867 868 //------------------------------------------------------------------------ 869 // fill, fill_n 870 //------------------------------------------------------------------------ 871 template <class _RandomAccessIterator, class _Tp> 872 void 873 __brick_fill(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, 874 /* __is_vector = */ std::true_type) noexcept; 875 876 template <class _ForwardIterator, class _Tp> 877 void 878 __brick_fill(_ForwardIterator, _ForwardIterator, const _Tp&, 879 /* __is_vector = */ std::false_type) noexcept; 880 881 template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _IsVector> 882 void 883 __pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, 884 /*is_parallel=*/std::false_type, _IsVector) noexcept; 885 886 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Tp, class _IsVector> 887 _RandomAccessIterator 888 __pattern_fill(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, const _Tp&, 889 /*is_parallel=*/std::true_type, _IsVector); 890 891 template <class _RandomAccessIterator, class _Size, class _Tp> 892 _RandomAccessIterator 893 __brick_fill_n(_RandomAccessIterator, _Size, const _Tp&, 894 /* __is_vector = */ std::true_type) noexcept; 895 896 template <class _OutputIterator, class _Size, class _Tp> 897 _OutputIterator 898 __brick_fill_n(_OutputIterator, _Size, const _Tp&, 899 /* __is_vector = */ std::false_type) noexcept; 900 901 template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Tp, class _IsVector> 902 _OutputIterator 903 __pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&, 904 /*is_parallel=*/std::false_type, _IsVector) noexcept; 905 906 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Tp, class _IsVector> 907 _RandomAccessIterator 908 __pattern_fill_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, const _Tp&, 909 /*is_parallel=*/std::true_type, _IsVector); 910 911 //------------------------------------------------------------------------ 912 // generate, generate_n 913 //------------------------------------------------------------------------ 914 915 template <class _RandomAccessIterator, class _Generator> 916 void __brick_generate(_RandomAccessIterator, _RandomAccessIterator, _Generator, 917 /* is_vector = */ std::true_type) noexcept; 918 919 template <class _ForwardIterator, class _Generator> 920 void __brick_generate(_ForwardIterator, _ForwardIterator, _Generator, 921 /* is_vector = */ std::false_type) noexcept; 922 923 template <class _ExecutionPolicy, class _ForwardIterator, class _Generator, class _IsVector> 924 void 925 __pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator, 926 /*is_parallel=*/std::false_type, _IsVector) noexcept; 927 928 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Generator, class _IsVector> 929 _RandomAccessIterator 930 __pattern_generate(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Generator, 931 /*is_parallel=*/std::true_type, _IsVector); 932 933 template <class _RandomAccessIterator, class Size, class _Generator> 934 _RandomAccessIterator __brick_generate_n(_RandomAccessIterator, Size, _Generator, 935 /* is_vector = */ std::true_type) noexcept; 936 937 template <class OutputIterator, class Size, class _Generator> 938 OutputIterator __brick_generate_n(OutputIterator, Size, _Generator, 939 /* is_vector = */ std::false_type) noexcept; 940 941 template <class _ExecutionPolicy, class OutputIterator, class Size, class _Generator, class _IsVector> 942 OutputIterator 943 __pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator, 944 /*is_parallel=*/std::false_type, _IsVector) noexcept; 945 946 template <class _ExecutionPolicy, class _RandomAccessIterator, class Size, class _Generator, class _IsVector> 947 _RandomAccessIterator 948 __pattern_generate_n(_ExecutionPolicy&&, _RandomAccessIterator, Size, _Generator, 949 /*is_parallel=*/std::true_type, _IsVector); 950 951 //------------------------------------------------------------------------ 952 // remove 953 //------------------------------------------------------------------------ 954 template <class _ForwardIterator, class _UnaryPredicate> 955 _ForwardIterator __brick_remove_if(_ForwardIterator, _ForwardIterator, _UnaryPredicate, 956 /* __is_vector = */ std::false_type) noexcept; 957 958 template <class _RandomAccessIterator, class _UnaryPredicate> 959 _RandomAccessIterator __brick_remove_if(_RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, 960 /* __is_vector = */ std::true_type) noexcept; 961 962 template <class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate, class _IsVector> 963 _ForwardIterator 964 __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, 965 /*is_parallel*/ std::false_type) noexcept; 966 967 template <class _ExecutionPolicy, class _RandomAccessIterator, class _UnaryPredicate, class _IsVector> 968 _RandomAccessIterator 969 __pattern_remove_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _UnaryPredicate, _IsVector, 970 /*is_parallel*/ std::true_type) noexcept; 971 972 //------------------------------------------------------------------------ 973 // merge 974 //------------------------------------------------------------------------ 975 976 template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare> 977 _OutputIterator __brick_merge(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 978 _OutputIterator, _Compare, 979 /* __is_vector = */ std::false_type) noexcept; 980 981 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, class _Compare> 982 _OutputIterator __brick_merge(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 983 _RandomAccessIterator2, _OutputIterator, _Compare, 984 /* __is_vector = */ std::true_type) noexcept; 985 986 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, 987 class _Compare, class _IsVector> 988 _OutputIterator 989 __pattern_merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 990 _OutputIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; 991 992 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, 993 class _Compare, class _IsVector> 994 _OutputIterator 995 __pattern_merge(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 996 _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, 997 /* is_parallel = */ std::true_type); 998 999 //------------------------------------------------------------------------ 1000 // inplace_merge 1001 //------------------------------------------------------------------------ 1002 1003 template <class _BidirectionalIterator, class _Compare> 1004 void __brick_inplace_merge(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, 1005 /* __is_vector = */ std::false_type) noexcept; 1006 1007 template <class _RandomAccessIterator, class _Compare> 1008 void __brick_inplace_merge(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, 1009 /* __is_vector = */ std::true_type) noexcept; 1010 1011 template <class _ExecutionPolicy, class _BidirectionalIterator, class _Compare, class _IsVector> 1012 void 1013 __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, 1014 _Compare, _IsVector, 1015 /* is_parallel = */ std::false_type) noexcept; 1016 1017 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 1018 void 1019 __pattern_inplace_merge(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, 1020 _Compare, _IsVector, 1021 /*is_parallel=*/std::true_type); 1022 1023 //------------------------------------------------------------------------ 1024 // includes 1025 //------------------------------------------------------------------------ 1026 1027 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector> 1028 bool 1029 __pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1030 _Compare, _IsVector, 1031 /*is_parallel=*/std::false_type) noexcept; 1032 1033 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Compare, 1034 class _IsVector> 1035 bool 1036 __pattern_includes(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1037 _RandomAccessIterator2, _Compare, _IsVector, 1038 /*is_parallel=*/std::true_type); 1039 1040 //------------------------------------------------------------------------ 1041 // set_union 1042 //------------------------------------------------------------------------ 1043 1044 template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare> 1045 _OutputIterator __brick_set_union(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1046 _OutputIterator, _Compare, 1047 /*__is_vector=*/std::false_type) noexcept; 1048 1049 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, class _Compare> 1050 _OutputIterator __brick_set_union(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1051 _RandomAccessIterator2, _OutputIterator, _Compare, 1052 /*__is_vector=*/std::true_type) noexcept; 1053 1054 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, 1055 class _Compare, class _IsVector> 1056 _OutputIterator 1057 __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1058 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; 1059 1060 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, 1061 class _Compare, class _IsVector> 1062 _OutputIterator 1063 __pattern_set_union(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1064 _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); 1065 1066 //------------------------------------------------------------------------ 1067 // set_intersection 1068 //------------------------------------------------------------------------ 1069 1070 template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare> 1071 _OutputIterator __brick_set_intersection(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1072 _OutputIterator, _Compare, 1073 /*__is_vector=*/std::false_type) noexcept; 1074 1075 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, class _Compare> 1076 _OutputIterator __brick_set_intersection(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1077 _RandomAccessIterator2, _OutputIterator, _Compare, 1078 /*__is_vector=*/std::true_type) noexcept; 1079 1080 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, 1081 class _Compare, class _IsVector> 1082 _OutputIterator 1083 __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, 1084 _ForwardIterator2, _OutputIterator, _Compare, _IsVector, 1085 /*is_parallel=*/std::false_type) noexcept; 1086 1087 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, 1088 class _Compare, class _IsVector> 1089 _OutputIterator 1090 __pattern_set_intersection(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1091 _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, 1092 /*is_parallel=*/std::true_type); 1093 1094 //------------------------------------------------------------------------ 1095 // set_difference 1096 //------------------------------------------------------------------------ 1097 1098 template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare> 1099 _OutputIterator __brick_set_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1100 _OutputIterator, _Compare, 1101 /*__is_vector=*/std::false_type) noexcept; 1102 1103 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, class _Compare> 1104 _OutputIterator __brick_set_difference(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1105 _RandomAccessIterator2, _OutputIterator, _Compare, 1106 /*__is_vector=*/std::true_type) noexcept; 1107 1108 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, 1109 class _Compare, class _IsVector> 1110 _OutputIterator 1111 __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1112 _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; 1113 1114 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, 1115 class _Compare, class _IsVector> 1116 _OutputIterator 1117 __pattern_set_difference(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1118 _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); 1119 1120 //------------------------------------------------------------------------ 1121 // set_symmetric_difference 1122 //------------------------------------------------------------------------ 1123 1124 template <class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, class _Compare> 1125 _OutputIterator __brick_set_symmetric_difference(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, 1126 _ForwardIterator2, _OutputIterator, _Compare, 1127 /*__is_vector=*/std::false_type) noexcept; 1128 1129 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, class _Compare> 1130 _OutputIterator __brick_set_symmetric_difference(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1131 _RandomAccessIterator2, _OutputIterator, _Compare, 1132 /*__is_vector=*/std::true_type) noexcept; 1133 1134 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _OutputIterator, 1135 class _Compare, class _IsVector> 1136 _OutputIterator 1137 __pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, 1138 _ForwardIterator2, _OutputIterator, _Compare, _IsVector, 1139 /*is_parallel=*/std::false_type) noexcept; 1140 1141 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _OutputIterator, 1142 class _Compare, class _IsVector> 1143 _OutputIterator 1144 __pattern_set_symmetric_difference(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, 1145 _RandomAccessIterator2, _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, 1146 /*is_parallel=*/std::true_type); 1147 1148 //------------------------------------------------------------------------ 1149 // is_heap_until 1150 //------------------------------------------------------------------------ 1151 1152 template <class _RandomAccessIterator, class _Compare> 1153 _RandomAccessIterator __brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare, 1154 /* __is_vector = */ std::false_type) noexcept; 1155 1156 template <class _RandomAccessIterator, class _Compare> 1157 _RandomAccessIterator __brick_is_heap_until(_RandomAccessIterator, _RandomAccessIterator, _Compare, 1158 /* __is_vector = */ std::true_type) noexcept; 1159 1160 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 1161 _RandomAccessIterator 1162 __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, 1163 /* is_parallel = */ std::false_type) noexcept; 1164 1165 template <class _ExecutionPolicy, class _RandomAccessIterator, class _Compare, class _IsVector> 1166 _RandomAccessIterator 1167 __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, 1168 /* is_parallel = */ std::true_type) noexcept; 1169 1170 //------------------------------------------------------------------------ 1171 // min_element 1172 //------------------------------------------------------------------------ 1173 1174 template <typename _ForwardIterator, typename _Compare> 1175 _ForwardIterator __brick_min_element(_ForwardIterator, _ForwardIterator, _Compare, 1176 /* __is_vector = */ std::false_type) noexcept; 1177 1178 template <typename _RandomAccessIterator, typename _Compare> 1179 _RandomAccessIterator __brick_min_element(_RandomAccessIterator, _RandomAccessIterator, _Compare, 1180 /* __is_vector = */ std::true_type) noexcept; 1181 1182 template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector> 1183 _ForwardIterator 1184 __pattern_min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, 1185 /* is_parallel = */ std::false_type) noexcept; 1186 1187 template <typename _ExecutionPolicy, typename _RandomAccessIterator, typename _Compare, typename _IsVector> 1188 _RandomAccessIterator 1189 __pattern_min_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, 1190 /* is_parallel = */ std::true_type); 1191 1192 //------------------------------------------------------------------------ 1193 // minmax_element 1194 //------------------------------------------------------------------------ 1195 1196 template <typename _ForwardIterator, typename _Compare> 1197 std::pair<_ForwardIterator, _ForwardIterator> __brick_minmax_element(_ForwardIterator, _ForwardIterator, _Compare, 1198 /* __is_vector = */ std::false_type) noexcept; 1199 1200 template <typename _RandomAccessIterator, typename _Compare> 1201 std::pair<_RandomAccessIterator, _RandomAccessIterator> 1202 __brick_minmax_element(_RandomAccessIterator, _RandomAccessIterator, _Compare, 1203 /* __is_vector = */ std::true_type) noexcept; 1204 1205 template <typename _ExecutionPolicy, typename _ForwardIterator, typename _Compare, typename _IsVector> 1206 std::pair<_ForwardIterator, _ForwardIterator> 1207 __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, 1208 /* is_parallel = */ std::false_type) noexcept; 1209 1210 template <typename _ExecutionPolicy, typename _RandomAccessIterator, typename _Compare, typename _IsVector> 1211 std::pair<_RandomAccessIterator, _RandomAccessIterator> 1212 __pattern_minmax_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, 1213 /* is_parallel = */ std::true_type); 1214 1215 //------------------------------------------------------------------------ 1216 // mismatch 1217 //------------------------------------------------------------------------ 1218 1219 template <class _ForwardIterator1, class _ForwardIterator2, class _Predicate> 1220 std::pair<_ForwardIterator1, _ForwardIterator2> __brick_mismatch(_ForwardIterator1, _ForwardIterator1, 1221 _ForwardIterator2, _ForwardIterator2, _Predicate, 1222 /* __is_vector = */ std::false_type) noexcept; 1223 1224 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _Predicate> 1225 std::pair<_RandomAccessIterator1, _RandomAccessIterator2> 1226 __brick_mismatch(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, 1227 _Predicate, 1228 /* __is_vector = */ std::true_type) noexcept; 1229 1230 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate, class _IsVector> 1231 std::pair<_ForwardIterator1, _ForwardIterator2> 1232 __pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1233 _Predicate, _IsVector, 1234 /* is_parallel = */ std::false_type) noexcept; 1235 1236 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Predicate, 1237 class _IsVector> 1238 std::pair<_RandomAccessIterator1, _RandomAccessIterator2> 1239 __pattern_mismatch(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1240 _RandomAccessIterator2, _Predicate, _IsVector, /* is_parallel = */ std::true_type) noexcept; 1241 1242 //------------------------------------------------------------------------ 1243 // lexicographical_compare 1244 //------------------------------------------------------------------------ 1245 1246 template <class _ForwardIterator1, class _ForwardIterator2, class _Compare> 1247 bool __brick_lexicographical_compare(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, 1248 _Compare, 1249 /* __is_vector = */ std::false_type) noexcept; 1250 1251 template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _Compare> 1252 bool __brick_lexicographical_compare(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, 1253 _RandomAccessIterator2, _Compare, 1254 /* __is_vector = */ std::true_type) noexcept; 1255 1256 template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Compare, class _IsVector> 1257 bool 1258 __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, 1259 _ForwardIterator2, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; 1260 1261 template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Compare, 1262 class _IsVector> 1263 bool 1264 __pattern_lexicographical_compare(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, 1265 _RandomAccessIterator2, _RandomAccessIterator2, _Compare, _IsVector, 1266 /* is_parallel = */ std::true_type) noexcept; 1267 1268 } // namespace __internal 1269 } // namespace __pstl 1270 1271 _PSTL_HIDE_FROM_ABI_POP 1272 1273 #endif /* _PSTL_ALGORITHM_FWD_H */ 1274