- tmp/tmpnvw_taza/{from.md → to.md} +3298 -634
tmp/tmpnvw_taza/{from.md → to.md}
RENAMED
|
@@ -5,25 +5,26 @@
|
|
| 5 |
This Clause describes components that C++ programs may use to perform
|
| 6 |
algorithmic operations on containers [[containers]] and other sequences.
|
| 7 |
|
| 8 |
The following subclauses describe components for non-modifying sequence
|
| 9 |
operations, mutating sequence operations, sorting and related
|
| 10 |
-
operations, and algorithms from the
|
| 11 |
[[algorithms.summary]].
|
| 12 |
|
| 13 |
**Table: Algorithms library summary** <a id="algorithms.summary">[algorithms.summary]</a>
|
| 14 |
|
| 15 |
| Subclause | | Header |
|
| 16 |
| ---------------------------- | --------------------------------- | ------------- |
|
| 17 |
| [[algorithms.requirements]] | Algorithms requirements | |
|
| 18 |
-
| [[algorithms.parallel]] | Parallel algorithms |
|
| 19 |
| [[algorithms.results]] | Algorithm result types | `<algorithm>` |
|
| 20 |
| [[alg.nonmodifying]] | Non-modifying sequence operations | |
|
| 21 |
| [[alg.modifying.operations]] | Mutating sequence operations | |
|
| 22 |
| [[alg.sorting]] | Sorting and related operations | |
|
| 23 |
| [[numeric.ops]] | Generalized numeric operations | `<numeric>` |
|
| 24 |
| [[specialized.algorithms]] | Specialized `<memory>` algorithms | `<memory>` |
|
|
|
|
| 25 |
| [[alg.c.library]] | C library algorithms | `<cstdlib>` |
|
| 26 |
|
| 27 |
|
| 28 |
## Algorithms requirements <a id="algorithms.requirements">[[algorithms.requirements]]</a>
|
| 29 |
|
|
@@ -31,34 +32,13 @@ All of the algorithms are separated from the particular implementations
|
|
| 31 |
of data structures and are parameterized by iterator types. Because of
|
| 32 |
this, they can work with program-defined data structures, as long as
|
| 33 |
these data structures have iterator types satisfying the assumptions on
|
| 34 |
the algorithms.
|
| 35 |
|
| 36 |
-
The entities defined in the `std::ranges` namespace in this Clause
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
*postfix-expression* in a function call [[expr.call]], they inhibit
|
| 40 |
-
argument-dependent name lookup.
|
| 41 |
-
|
| 42 |
-
[*Example 1*:
|
| 43 |
-
|
| 44 |
-
``` cpp
|
| 45 |
-
void foo() {
|
| 46 |
-
using namespace std::ranges;
|
| 47 |
-
std::vector<int> vec{1,2,3};
|
| 48 |
-
find(begin(vec), end(vec), 2); // #1
|
| 49 |
-
}
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
The function call expression at `#1` invokes `std::ranges::find`, not
|
| 53 |
-
`std::find`, despite that (a) the iterator type returned from
|
| 54 |
-
`begin(vec)` and `end(vec)` may be associated with namespace `std` and
|
| 55 |
-
(b) `std::find` is more specialized [[temp.func.order]] than
|
| 56 |
-
`std::ranges::find` since the former requires its first two parameters
|
| 57 |
-
to have the same type.
|
| 58 |
-
|
| 59 |
-
— *end example*]
|
| 60 |
|
| 61 |
For purposes of determining the existence of data races, algorithms
|
| 62 |
shall not modify objects referenced through an iterator argument unless
|
| 63 |
the specification requires such modification.
|
| 64 |
|
|
@@ -187,10 +167,18 @@ and if \[`b`, `a`) denotes a range, the same as those of
|
|
| 187 |
iter_difference_t<decltype(b)> n = 0;
|
| 188 |
for (auto tmp = b; tmp != a; ++tmp) --n;
|
| 189 |
return n;
|
| 190 |
```
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
In the description of the algorithms, given an iterator `a` whose
|
| 193 |
difference type is `D`, and an expression `n` of integer-like type other
|
| 194 |
than cv `D`, the semantics of `a + n` and `a - n` are, respectively,
|
| 195 |
those of `a + D(n)` and `a - D(n)`.
|
| 196 |
|
|
@@ -198,19 +186,27 @@ In the description of algorithm return values, a sentinel value `s`
|
|
| 198 |
denoting the end of a range \[`i`, `s`) is sometimes returned where an
|
| 199 |
iterator is expected. In these cases, the semantics are as if the
|
| 200 |
sentinel is converted into an iterator using `ranges::next(i, s)`.
|
| 201 |
|
| 202 |
Overloads of algorithms that take `range` arguments [[range.range]]
|
| 203 |
-
behave as if they are implemented by
|
| 204 |
-
`ranges
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
The well-formedness and behavior of a call to an algorithm with an
|
| 208 |
explicitly-specified template argument list is unspecified, except where
|
| 209 |
explicitly stated otherwise.
|
| 210 |
|
| 211 |
-
[*Note
|
| 212 |
with different template parameters than those presented. — *end note*]
|
| 213 |
|
| 214 |
## Parallel algorithms <a id="algorithms.parallel">[[algorithms.parallel]]</a>
|
| 215 |
|
| 216 |
### Preamble <a id="algorithms.parallel.defns">[[algorithms.parallel.defns]]</a>
|
|
@@ -218,22 +214,31 @@ with different template parameters than those presented. — *end note*]
|
|
| 218 |
Subclause [[algorithms.parallel]] describes components that C++ programs
|
| 219 |
may use to perform operations on containers and other sequences in
|
| 220 |
parallel.
|
| 221 |
|
| 222 |
A *parallel algorithm* is a function template listed in this document
|
| 223 |
-
with a template parameter named `ExecutionPolicy`
|
|
|
|
| 224 |
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
arguments by invoking the following functions:
|
| 227 |
|
| 228 |
-
- All operations of the categories of the iterators
|
| 229 |
-
is instantiated with.
|
| 230 |
- Operations on those sequence elements that are required by its
|
| 231 |
specification.
|
| 232 |
-
- User-provided
|
| 233 |
the algorithm, if required by the specification.
|
| 234 |
-
- Operations on those
|
| 235 |
\[*Note 1*: See [[algorithms.requirements]]. — *end note*]
|
| 236 |
|
| 237 |
These functions are herein called *element access functions*.
|
| 238 |
|
| 239 |
[*Example 1*:
|
|
@@ -250,11 +255,12 @@ The `sort` function may invoke the following element access functions:
|
|
| 250 |
— *end example*]
|
| 251 |
|
| 252 |
A standard library function is *vectorization-unsafe* if it is specified
|
| 253 |
to synchronize with another function invocation, or another function
|
| 254 |
invocation is specified to synchronize with it, and if it is not a
|
| 255 |
-
memory allocation or deallocation function
|
|
|
|
| 256 |
|
| 257 |
[*Note 2*: Implementations must ensure that internal synchronization
|
| 258 |
inside standard library functions does not prevent forward progress when
|
| 259 |
those functions are executed by threads of execution with weakly
|
| 260 |
parallel forward progress guarantees. — *end note*]
|
|
@@ -280,25 +286,26 @@ different threads of execution.
|
|
| 280 |
|
| 281 |
— *end example*]
|
| 282 |
|
| 283 |
### Requirements on user-provided function objects <a id="algorithms.parallel.user">[[algorithms.parallel.user]]</a>
|
| 284 |
|
| 285 |
-
Unless otherwise specified,
|
| 286 |
-
algorithms as objects of type
|
| 287 |
-
`
|
| 288 |
-
`
|
|
|
|
|
|
|
| 289 |
these parallel algorithms that are formed by an invocation with the
|
| 290 |
specified default predicate or operation (where applicable) shall not
|
| 291 |
directly or indirectly modify objects via their arguments, nor shall
|
| 292 |
they rely on the identity of the provided objects.
|
| 293 |
|
| 294 |
### Effect of execution policies on algorithm execution <a id="algorithms.parallel.exec">[[algorithms.parallel.exec]]</a>
|
| 295 |
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
element access functions.
|
| 300 |
|
| 301 |
If an object is modified by an element access function, the algorithm
|
| 302 |
will perform no other unsynchronized accesses to that object. The
|
| 303 |
modifying element access functions are those which are specified as
|
| 304 |
modifying the object.
|
|
@@ -470,40 +477,174 @@ During the execution of a parallel algorithm, if temporary memory
|
|
| 470 |
resources are required for parallelization and none are available, the
|
| 471 |
algorithm throws a `bad_alloc` exception.
|
| 472 |
|
| 473 |
During the execution of a parallel algorithm, if the invocation of an
|
| 474 |
element access function exits via an uncaught exception, the behavior is
|
| 475 |
-
determined by the
|
| 476 |
|
| 477 |
-
###
|
| 478 |
|
| 479 |
Parallel algorithms are algorithm overloads. Each parallel algorithm
|
| 480 |
-
overload has an additional
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
type `ExecutionPolicy&&`, which is the first function parameter.
|
| 484 |
|
| 485 |
[*Note 1*: Not all algorithms have parallel algorithm
|
| 486 |
overloads. — *end note*]
|
| 487 |
|
| 488 |
-
Unless otherwise specified, the semantics of
|
| 489 |
-
|
|
|
|
| 490 |
|
| 491 |
-
Unless otherwise specified, the complexity requirements of
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
says “at most *expr*” or “exactly *expr*” and does not specify
|
| 495 |
-
number of assignments or swaps, and *expr* is not already expressed
|
| 496 |
-
𝑂() notation, the complexity of the algorithm shall be
|
| 497 |
𝑂(\placeholder{expr}).
|
| 498 |
|
| 499 |
-
|
| 500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
|
| 502 |
## Header `<algorithm>` synopsis <a id="algorithm.syn">[[algorithm.syn]]</a>
|
| 503 |
|
| 504 |
``` cpp
|
|
|
|
| 505 |
#include <initializer_list> // see [initializer.list.syn]
|
| 506 |
|
| 507 |
namespace std {
|
| 508 |
namespace ranges {
|
| 509 |
// [algorithms.results], algorithm result types
|
|
@@ -538,64 +679,98 @@ namespace std {
|
|
| 538 |
// [alg.nonmodifying], non-modifying sequence operations
|
| 539 |
// [alg.all.of], all of
|
| 540 |
template<class InputIterator, class Predicate>
|
| 541 |
constexpr bool all_of(InputIterator first, InputIterator last, Predicate pred);
|
| 542 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 543 |
-
bool all_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 544 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 545 |
|
| 546 |
namespace ranges {
|
| 547 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 548 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 549 |
constexpr bool all_of(I first, S last, Pred pred, Proj proj = {});
|
| 550 |
template<input_range R, class Proj = identity,
|
| 551 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 552 |
constexpr bool all_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 553 |
}
|
| 554 |
|
| 555 |
// [alg.any.of], any of
|
| 556 |
template<class InputIterator, class Predicate>
|
| 557 |
constexpr bool any_of(InputIterator first, InputIterator last, Predicate pred);
|
| 558 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 559 |
-
bool any_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 560 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 561 |
|
| 562 |
namespace ranges {
|
| 563 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 564 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 565 |
constexpr bool any_of(I first, S last, Pred pred, Proj proj = {});
|
| 566 |
template<input_range R, class Proj = identity,
|
| 567 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 568 |
constexpr bool any_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
}
|
| 570 |
|
| 571 |
// [alg.none.of], none of
|
| 572 |
template<class InputIterator, class Predicate>
|
| 573 |
constexpr bool none_of(InputIterator first, InputIterator last, Predicate pred);
|
| 574 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 575 |
-
bool none_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 576 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 577 |
|
| 578 |
namespace ranges {
|
| 579 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 580 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 581 |
constexpr bool none_of(I first, S last, Pred pred, Proj proj = {});
|
| 582 |
template<input_range R, class Proj = identity,
|
| 583 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 584 |
constexpr bool none_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
}
|
| 586 |
|
| 587 |
// [alg.contains], contains
|
| 588 |
namespace ranges {
|
| 589 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 590 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 591 |
constexpr bool contains(I first, S last, const T& value, Proj proj = {});
|
| 592 |
-
template<input_range R, class
|
|
|
|
| 593 |
requires
|
| 594 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 595 |
constexpr bool contains(R&& r, const T& value, Proj proj = {});
|
| 596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 597 |
template<forward_iterator I1, sentinel_for<I1> S1,
|
| 598 |
forward_iterator I2, sentinel_for<I2> S2,
|
| 599 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 600 |
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 601 |
constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
|
|
@@ -603,17 +778,29 @@ namespace std {
|
|
| 603 |
template<forward_range R1, forward_range R2,
|
| 604 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 605 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 606 |
constexpr bool contains_subrange(R1&& r1, R2&& r2,
|
| 607 |
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
}
|
| 609 |
|
| 610 |
// [alg.foreach], for each
|
| 611 |
template<class InputIterator, class Function>
|
| 612 |
constexpr Function for_each(InputIterator first, InputIterator last, Function f);
|
| 613 |
template<class ExecutionPolicy, class ForwardIterator, class Function>
|
| 614 |
-
void for_each(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 615 |
ForwardIterator first, ForwardIterator last, Function f);
|
| 616 |
|
| 617 |
namespace ranges {
|
| 618 |
template<class I, class F>
|
| 619 |
using for_each_result = in_fun_result<I, F>;
|
|
@@ -624,97 +811,182 @@ namespace std {
|
|
| 624 |
for_each(I first, S last, Fun f, Proj proj = {});
|
| 625 |
template<input_range R, class Proj = identity,
|
| 626 |
indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
|
| 627 |
constexpr for_each_result<borrowed_iterator_t<R>, Fun>
|
| 628 |
for_each(R&& r, Fun f, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
}
|
| 630 |
|
| 631 |
template<class InputIterator, class Size, class Function>
|
| 632 |
constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
|
| 633 |
template<class ExecutionPolicy, class ForwardIterator, class Size, class Function>
|
| 634 |
-
ForwardIterator for_each_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 635 |
ForwardIterator first, Size n, Function f);
|
| 636 |
|
| 637 |
namespace ranges {
|
| 638 |
template<class I, class F>
|
| 639 |
using for_each_n_result = in_fun_result<I, F>;
|
| 640 |
|
| 641 |
template<input_iterator I, class Proj = identity,
|
| 642 |
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 643 |
constexpr for_each_n_result<I, Fun>
|
| 644 |
for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 645 |
}
|
| 646 |
|
| 647 |
// [alg.find], find
|
| 648 |
-
template<class InputIterator, class T>
|
| 649 |
constexpr InputIterator find(InputIterator first, InputIterator last,
|
| 650 |
const T& value);
|
| 651 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
| 652 |
-
|
|
|
|
| 653 |
ForwardIterator first, ForwardIterator last,
|
| 654 |
const T& value);
|
| 655 |
template<class InputIterator, class Predicate>
|
| 656 |
constexpr InputIterator find_if(InputIterator first, InputIterator last,
|
| 657 |
Predicate pred);
|
| 658 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 659 |
-
ForwardIterator find_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 660 |
ForwardIterator first, ForwardIterator last,
|
| 661 |
Predicate pred);
|
| 662 |
template<class InputIterator, class Predicate>
|
| 663 |
constexpr InputIterator find_if_not(InputIterator first, InputIterator last,
|
| 664 |
Predicate pred);
|
| 665 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 666 |
-
ForwardIterator find_if_not(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 667 |
ForwardIterator first, ForwardIterator last,
|
| 668 |
Predicate pred);
|
| 669 |
|
| 670 |
namespace ranges {
|
| 671 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 672 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 673 |
constexpr I find(I first, S last, const T& value, Proj proj = {});
|
| 674 |
-
template<input_range R, class
|
|
|
|
| 675 |
requires indirect_binary_predicate<ranges::equal_to,
|
| 676 |
projected<iterator_t<R>, Proj>, const T*>
|
| 677 |
constexpr borrowed_iterator_t<R>
|
| 678 |
find(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 679 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 680 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 681 |
constexpr I find_if(I first, S last, Pred pred, Proj proj = {});
|
| 682 |
template<input_range R, class Proj = identity,
|
| 683 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 684 |
constexpr borrowed_iterator_t<R>
|
| 685 |
find_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 687 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 688 |
constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 689 |
template<input_range R, class Proj = identity,
|
| 690 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 691 |
constexpr borrowed_iterator_t<R>
|
| 692 |
find_if_not(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 693 |
}
|
| 694 |
|
| 695 |
// [alg.find.last], find last
|
| 696 |
namespace ranges {
|
| 697 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 698 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 699 |
constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {});
|
| 700 |
-
template<forward_range R, class
|
|
|
|
| 701 |
requires
|
| 702 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 703 |
constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 705 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 706 |
constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {});
|
| 707 |
template<forward_range R, class Proj = identity,
|
| 708 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 709 |
constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 711 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 712 |
constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 713 |
template<forward_range R, class Proj = identity,
|
| 714 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 715 |
constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 716 |
}
|
| 717 |
|
| 718 |
// [alg.find.end], find end
|
| 719 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 720 |
constexpr ForwardIterator1
|
|
@@ -725,17 +997,17 @@ namespace std {
|
|
| 725 |
find_end(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 726 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 727 |
BinaryPredicate pred);
|
| 728 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 729 |
ForwardIterator1
|
| 730 |
-
find_end(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 731 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 732 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 733 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 734 |
class ForwardIterator2, class BinaryPredicate>
|
| 735 |
ForwardIterator1
|
| 736 |
-
find_end(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 737 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 738 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 739 |
BinaryPredicate pred);
|
| 740 |
|
| 741 |
namespace ranges {
|
|
@@ -749,13 +1021,27 @@ namespace std {
|
|
| 749 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 750 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 751 |
constexpr borrowed_subrange_t<R1>
|
| 752 |
find_end(R1&& r1, R2&& r2, Pred pred = {},
|
| 753 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
}
|
| 755 |
|
| 756 |
-
// [alg.find.first.of], find first
|
| 757 |
template<class InputIterator, class ForwardIterator>
|
| 758 |
constexpr InputIterator
|
| 759 |
find_first_of(InputIterator first1, InputIterator last1,
|
| 760 |
ForwardIterator first2, ForwardIterator last2);
|
| 761 |
template<class InputIterator, class ForwardIterator, class BinaryPredicate>
|
|
@@ -763,17 +1049,17 @@ namespace std {
|
|
| 763 |
find_first_of(InputIterator first1, InputIterator last1,
|
| 764 |
ForwardIterator first2, ForwardIterator last2,
|
| 765 |
BinaryPredicate pred);
|
| 766 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 767 |
ForwardIterator1
|
| 768 |
-
find_first_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 769 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 770 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 771 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 772 |
class ForwardIterator2, class BinaryPredicate>
|
| 773 |
ForwardIterator1
|
| 774 |
-
find_first_of(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 775 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 776 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 777 |
BinaryPredicate pred);
|
| 778 |
|
| 779 |
namespace ranges {
|
|
@@ -786,10 +1072,23 @@ namespace std {
|
|
| 786 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 787 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 788 |
constexpr borrowed_iterator_t<R1>
|
| 789 |
find_first_of(R1&& r1, R2&& r2, Pred pred = {},
|
| 790 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 791 |
}
|
| 792 |
|
| 793 |
// [alg.adjacent.find], adjacent find
|
| 794 |
template<class ForwardIterator>
|
| 795 |
constexpr ForwardIterator
|
|
@@ -798,15 +1097,15 @@ namespace std {
|
|
| 798 |
constexpr ForwardIterator
|
| 799 |
adjacent_find(ForwardIterator first, ForwardIterator last,
|
| 800 |
BinaryPredicate pred);
|
| 801 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 802 |
ForwardIterator
|
| 803 |
-
adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 804 |
ForwardIterator first, ForwardIterator last);
|
| 805 |
template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
|
| 806 |
ForwardIterator
|
| 807 |
-
adjacent_find(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 808 |
ForwardIterator first, ForwardIterator last,
|
| 809 |
BinaryPredicate pred);
|
| 810 |
|
| 811 |
namespace ranges {
|
| 812 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -817,49 +1116,86 @@ namespace std {
|
|
| 817 |
template<forward_range R, class Proj = identity,
|
| 818 |
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 819 |
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 820 |
constexpr borrowed_iterator_t<R>
|
| 821 |
adjacent_find(R&& r, Pred pred = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
}
|
| 823 |
|
| 824 |
// [alg.count], count
|
| 825 |
-
template<class InputIterator, class T>
|
| 826 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 827 |
count(InputIterator first, InputIterator last, const T& value);
|
| 828 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 829 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 830 |
-
count(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 831 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 832 |
template<class InputIterator, class Predicate>
|
| 833 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 834 |
count_if(InputIterator first, InputIterator last, Predicate pred);
|
| 835 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 836 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 837 |
-
count_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 838 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 839 |
|
| 840 |
namespace ranges {
|
| 841 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 842 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 843 |
constexpr iter_difference_t<I>
|
| 844 |
count(I first, S last, const T& value, Proj proj = {});
|
| 845 |
-
template<input_range R, class
|
|
|
|
| 846 |
requires indirect_binary_predicate<ranges::equal_to,
|
| 847 |
projected<iterator_t<R>, Proj>, const T*>
|
| 848 |
constexpr range_difference_t<R>
|
| 849 |
count(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 850 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 851 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 852 |
constexpr iter_difference_t<I>
|
| 853 |
count_if(I first, S last, Pred pred, Proj proj = {});
|
| 854 |
template<input_range R, class Proj = identity,
|
| 855 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 856 |
constexpr range_difference_t<R>
|
| 857 |
count_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 858 |
}
|
| 859 |
|
| 860 |
-
// [mismatch], mismatch
|
| 861 |
template<class InputIterator1, class InputIterator2>
|
| 862 |
constexpr pair<InputIterator1, InputIterator2>
|
| 863 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 864 |
InputIterator2 first2);
|
| 865 |
template<class InputIterator1, class InputIterator2, class BinaryPredicate>
|
|
@@ -875,28 +1211,28 @@ namespace std {
|
|
| 875 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 876 |
InputIterator2 first2, InputIterator2 last2,
|
| 877 |
BinaryPredicate pred);
|
| 878 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 879 |
pair<ForwardIterator1, ForwardIterator2>
|
| 880 |
-
mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 881 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 882 |
ForwardIterator2 first2);
|
| 883 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 884 |
class BinaryPredicate>
|
| 885 |
pair<ForwardIterator1, ForwardIterator2>
|
| 886 |
-
mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 887 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 888 |
ForwardIterator2 first2, BinaryPredicate pred);
|
| 889 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 890 |
pair<ForwardIterator1, ForwardIterator2>
|
| 891 |
-
mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 892 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 893 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 894 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 895 |
class BinaryPredicate>
|
| 896 |
pair<ForwardIterator1, ForwardIterator2>
|
| 897 |
-
mismatch(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 898 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 899 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 900 |
BinaryPredicate pred);
|
| 901 |
|
| 902 |
namespace ranges {
|
|
@@ -913,10 +1249,24 @@ namespace std {
|
|
| 913 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 914 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 915 |
constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 916 |
mismatch(R1&& r1, R2&& r2, Pred pred = {},
|
| 917 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 918 |
}
|
| 919 |
|
| 920 |
// [alg.equal], equal
|
| 921 |
template<class InputIterator1, class InputIterator2>
|
| 922 |
constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -930,25 +1280,25 @@ namespace std {
|
|
| 930 |
template<class InputIterator1, class InputIterator2, class BinaryPredicate>
|
| 931 |
constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 932 |
InputIterator2 first2, InputIterator2 last2,
|
| 933 |
BinaryPredicate pred);
|
| 934 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 935 |
-
bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 936 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 937 |
ForwardIterator2 first2);
|
| 938 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 939 |
class BinaryPredicate>
|
| 940 |
-
bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 941 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 942 |
ForwardIterator2 first2, BinaryPredicate pred);
|
| 943 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 944 |
-
bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 945 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 946 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 947 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 948 |
class BinaryPredicate>
|
| 949 |
-
bool equal(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 950 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 951 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 952 |
BinaryPredicate pred);
|
| 953 |
|
| 954 |
namespace ranges {
|
|
@@ -961,10 +1311,22 @@ namespace std {
|
|
| 961 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to,
|
| 962 |
class Proj1 = identity, class Proj2 = identity>
|
| 963 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 964 |
constexpr bool equal(R1&& r1, R2&& r2, Pred pred = {},
|
| 965 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 966 |
}
|
| 967 |
|
| 968 |
// [alg.is.permutation], is permutation
|
| 969 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 970 |
constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
|
@@ -1007,17 +1369,17 @@ namespace std {
|
|
| 1007 |
search(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1008 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1009 |
BinaryPredicate pred);
|
| 1010 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1011 |
ForwardIterator1
|
| 1012 |
-
search(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1013 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1014 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1015 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1016 |
class BinaryPredicate>
|
| 1017 |
ForwardIterator1
|
| 1018 |
-
search(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1019 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1020 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1021 |
BinaryPredicate pred);
|
| 1022 |
|
| 1023 |
namespace ranges {
|
|
@@ -1032,46 +1394,78 @@ namespace std {
|
|
| 1032 |
class Proj1 = identity, class Proj2 = identity>
|
| 1033 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1034 |
constexpr borrowed_subrange_t<R1>
|
| 1035 |
search(R1&& r1, R2&& r2, Pred pred = {},
|
| 1036 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1037 |
}
|
| 1038 |
|
| 1039 |
-
template<class ForwardIterator, class Size,
|
|
|
|
| 1040 |
constexpr ForwardIterator
|
| 1041 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 1042 |
Size count, const T& value);
|
| 1043 |
-
template<class ForwardIterator, class Size,
|
|
|
|
| 1044 |
constexpr ForwardIterator
|
| 1045 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 1046 |
Size count, const T& value, BinaryPredicate pred);
|
| 1047 |
-
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
|
|
|
| 1048 |
ForwardIterator
|
| 1049 |
-
search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1050 |
ForwardIterator first, ForwardIterator last,
|
| 1051 |
Size count, const T& value);
|
| 1052 |
-
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 1053 |
-
class BinaryPredicate>
|
| 1054 |
ForwardIterator
|
| 1055 |
-
search_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1056 |
ForwardIterator first, ForwardIterator last,
|
| 1057 |
Size count, const T& value,
|
| 1058 |
BinaryPredicate pred);
|
| 1059 |
|
| 1060 |
namespace ranges {
|
| 1061 |
-
template<forward_iterator I, sentinel_for<I> S,
|
| 1062 |
-
class Pred = ranges::equal_to, class Proj = identity
|
|
|
|
| 1063 |
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 1064 |
constexpr subrange<I>
|
| 1065 |
search_n(I first, S last, iter_difference_t<I> count,
|
| 1066 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 1067 |
-
template<forward_range R, class
|
| 1068 |
-
class Proj = identity>
|
| 1069 |
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 1070 |
constexpr borrowed_subrange_t<R>
|
| 1071 |
search_n(R&& r, range_difference_t<R> count,
|
| 1072 |
const T& value, Pred pred = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1073 |
}
|
| 1074 |
|
| 1075 |
template<class ForwardIterator, class Searcher>
|
| 1076 |
constexpr ForwardIterator
|
| 1077 |
search(ForwardIterator first, ForwardIterator last, const Searcher& searcher);
|
|
@@ -1087,10 +1481,23 @@ namespace std {
|
|
| 1087 |
class Proj1 = identity, class Proj2 = identity>
|
| 1088 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1089 |
constexpr bool starts_with(R1&& r1, R2&& r2, Pred pred = {},
|
| 1090 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1091 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1092 |
// [alg.ends.with], ends with
|
| 1093 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 1094 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1095 |
requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
|
| 1096 |
(forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
|
|
@@ -1103,10 +1510,23 @@ namespace std {
|
|
| 1103 |
(forward_range<R2> || sized_range<R2>) &&
|
| 1104 |
indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1105 |
constexpr bool ends_with(R1&& r1, R2&& r2, Pred pred = {},
|
| 1106 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1108 |
// [alg.fold], fold
|
| 1109 |
template<class F>
|
| 1110 |
class flipped { // exposition only
|
| 1111 |
F f; // exposition only
|
| 1112 |
|
|
@@ -1132,15 +1552,16 @@ namespace std {
|
|
| 1132 |
|
| 1133 |
template<class F, class T, class I>
|
| 1134 |
concept indirectly-binary-right-foldable = // exposition only
|
| 1135 |
indirectly-binary-left-foldable<flipped<F>, T, I>;
|
| 1136 |
|
| 1137 |
-
template<input_iterator I, sentinel_for<I> S, class T,
|
| 1138 |
indirectly-binary-left-foldable<T, I> F>
|
| 1139 |
constexpr auto fold_left(I first, S last, T init, F f);
|
| 1140 |
|
| 1141 |
-
template<input_range R, class T
|
|
|
|
| 1142 |
constexpr auto fold_left(R&& r, T init, F f);
|
| 1143 |
|
| 1144 |
template<input_iterator I, sentinel_for<I> S,
|
| 1145 |
indirectly-binary-left-foldable<iter_value_t<I>, I> F>
|
| 1146 |
requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
|
|
@@ -1148,15 +1569,15 @@ namespace std {
|
|
| 1148 |
|
| 1149 |
template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F>
|
| 1150 |
requires constructible_from<range_value_t<R>, range_reference_t<R>>
|
| 1151 |
constexpr auto fold_left_first(R&& r, F f);
|
| 1152 |
|
| 1153 |
-
template<bidirectional_iterator I, sentinel_for<I> S, class T,
|
| 1154 |
indirectly-binary-right-foldable<T, I> F>
|
| 1155 |
constexpr auto fold_right(I first, S last, T init, F f);
|
| 1156 |
|
| 1157 |
-
template<bidirectional_range R, class T,
|
| 1158 |
indirectly-binary-right-foldable<T, iterator_t<R>> F>
|
| 1159 |
constexpr auto fold_right(R&& r, T init, F f);
|
| 1160 |
|
| 1161 |
template<bidirectional_iterator I, sentinel_for<I> S,
|
| 1162 |
indirectly-binary-right-foldable<iter_value_t<I>, I> F>
|
|
@@ -1171,15 +1592,16 @@ namespace std {
|
|
| 1171 |
template<class I, class T>
|
| 1172 |
using fold_left_with_iter_result = in_value_result<I, T>;
|
| 1173 |
template<class I, class T>
|
| 1174 |
using fold_left_first_with_iter_result = in_value_result<I, T>;
|
| 1175 |
|
| 1176 |
-
template<input_iterator I, sentinel_for<I> S, class T,
|
| 1177 |
indirectly-binary-left-foldable<T, I> F>
|
| 1178 |
constexpr see below fold_left_with_iter(I first, S last, T init, F f);
|
| 1179 |
|
| 1180 |
-
template<input_range R, class T
|
|
|
|
| 1181 |
constexpr see below fold_left_with_iter(R&& r, T init, F f);
|
| 1182 |
|
| 1183 |
template<input_iterator I, sentinel_for<I> S,
|
| 1184 |
indirectly-binary-left-foldable<iter_value_t<I>, I> F>
|
| 1185 |
requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
|
|
@@ -1195,11 +1617,11 @@ namespace std {
|
|
| 1195 |
// [alg.copy], copy
|
| 1196 |
template<class InputIterator, class OutputIterator>
|
| 1197 |
constexpr OutputIterator copy(InputIterator first, InputIterator last,
|
| 1198 |
OutputIterator result);
|
| 1199 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1200 |
-
ForwardIterator2 copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1201 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1202 |
ForwardIterator2 result);
|
| 1203 |
|
| 1204 |
namespace ranges {
|
| 1205 |
template<class I, class O>
|
|
@@ -1211,18 +1633,28 @@ namespace std {
|
|
| 1211 |
copy(I first, S last, O result);
|
| 1212 |
template<input_range R, weakly_incrementable O>
|
| 1213 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1214 |
constexpr copy_result<borrowed_iterator_t<R>, O>
|
| 1215 |
copy(R&& r, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1216 |
}
|
| 1217 |
|
| 1218 |
template<class InputIterator, class Size, class OutputIterator>
|
| 1219 |
constexpr OutputIterator copy_n(InputIterator first, Size n,
|
| 1220 |
OutputIterator result);
|
| 1221 |
template<class ExecutionPolicy, class ForwardIterator1, class Size,
|
| 1222 |
class ForwardIterator2>
|
| 1223 |
-
ForwardIterator2 copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1224 |
ForwardIterator1 first, Size n,
|
| 1225 |
ForwardIterator2 result);
|
| 1226 |
|
| 1227 |
namespace ranges {
|
| 1228 |
template<class I, class O>
|
|
@@ -1230,18 +1662,25 @@ namespace std {
|
|
| 1230 |
|
| 1231 |
template<input_iterator I, weakly_incrementable O>
|
| 1232 |
requires indirectly_copyable<I, O>
|
| 1233 |
constexpr copy_n_result<I, O>
|
| 1234 |
copy_n(I first, iter_difference_t<I> n, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1235 |
}
|
| 1236 |
|
| 1237 |
template<class InputIterator, class OutputIterator, class Predicate>
|
| 1238 |
constexpr OutputIterator copy_if(InputIterator first, InputIterator last,
|
| 1239 |
OutputIterator result, Predicate pred);
|
| 1240 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1241 |
class Predicate>
|
| 1242 |
-
ForwardIterator2 copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1243 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1244 |
ForwardIterator2 result, Predicate pred);
|
| 1245 |
|
| 1246 |
namespace ranges {
|
| 1247 |
template<class I, class O>
|
|
@@ -1255,10 +1694,25 @@ namespace std {
|
|
| 1255 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 1256 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1257 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1258 |
constexpr copy_if_result<borrowed_iterator_t<R>, O>
|
| 1259 |
copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1260 |
}
|
| 1261 |
|
| 1262 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
| 1263 |
constexpr BidirectionalIterator2
|
| 1264 |
copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
|
|
@@ -1282,11 +1736,11 @@ namespace std {
|
|
| 1282 |
template<class InputIterator, class OutputIterator>
|
| 1283 |
constexpr OutputIterator move(InputIterator first, InputIterator last,
|
| 1284 |
OutputIterator result);
|
| 1285 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 1286 |
class ForwardIterator2>
|
| 1287 |
-
ForwardIterator2 move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1288 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1289 |
ForwardIterator2 result);
|
| 1290 |
|
| 1291 |
namespace ranges {
|
| 1292 |
template<class I, class O>
|
|
@@ -1298,10 +1752,20 @@ namespace std {
|
|
| 1298 |
move(I first, S last, O result);
|
| 1299 |
template<input_range R, weakly_incrementable O>
|
| 1300 |
requires indirectly_movable<iterator_t<R>, O>
|
| 1301 |
constexpr move_result<borrowed_iterator_t<R>, O>
|
| 1302 |
move(R&& r, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1303 |
}
|
| 1304 |
|
| 1305 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
| 1306 |
constexpr BidirectionalIterator2
|
| 1307 |
move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
|
|
@@ -1324,11 +1788,11 @@ namespace std {
|
|
| 1324 |
// [alg.swap], swap
|
| 1325 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 1326 |
constexpr ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1327 |
ForwardIterator2 first2);
|
| 1328 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1329 |
-
ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1330 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1331 |
ForwardIterator2 first2);
|
| 1332 |
|
| 1333 |
namespace ranges {
|
| 1334 |
template<class I1, class I2>
|
|
@@ -1340,10 +1804,20 @@ namespace std {
|
|
| 1340 |
swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
|
| 1341 |
template<input_range R1, input_range R2>
|
| 1342 |
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 1343 |
constexpr swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1344 |
swap_ranges(R1&& r1, R2&& r2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1345 |
}
|
| 1346 |
|
| 1347 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 1348 |
constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
|
| 1349 |
|
|
@@ -1359,17 +1833,17 @@ namespace std {
|
|
| 1359 |
InputIterator2 first2, OutputIterator result,
|
| 1360 |
BinaryOperation binary_op);
|
| 1361 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1362 |
class UnaryOperation>
|
| 1363 |
ForwardIterator2
|
| 1364 |
-
transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1365 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1366 |
ForwardIterator2 result, UnaryOperation op);
|
| 1367 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1368 |
class ForwardIterator, class BinaryOperation>
|
| 1369 |
ForwardIterator
|
| 1370 |
-
transform(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1371 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1372 |
ForwardIterator2 first2, ForwardIterator result,
|
| 1373 |
BinaryOperation binary_op);
|
| 1374 |
|
| 1375 |
namespace ranges {
|
|
@@ -1385,10 +1859,24 @@ namespace std {
|
|
| 1385 |
class Proj = identity>
|
| 1386 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 1387 |
constexpr unary_transform_result<borrowed_iterator_t<R>, O>
|
| 1388 |
transform(R&& r, O result, F op, Proj proj = {});
|
| 1389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1390 |
template<class I1, class I2, class O>
|
| 1391 |
using binary_transform_result = in_in_out_result<I1, I2, O>;
|
| 1392 |
|
| 1393 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 1394 |
weakly_incrementable O, copy_constructible F, class Proj1 = identity,
|
|
@@ -1403,142 +1891,256 @@ namespace std {
|
|
| 1403 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 1404 |
projected<iterator_t<R2>, Proj2>>>
|
| 1405 |
constexpr binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 1406 |
transform(R1&& r1, R2&& r2, O result,
|
| 1407 |
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1408 |
}
|
| 1409 |
|
| 1410 |
// [alg.replace], replace
|
| 1411 |
template<class ForwardIterator, class T>
|
| 1412 |
constexpr void replace(ForwardIterator first, ForwardIterator last,
|
| 1413 |
const T& old_value, const T& new_value);
|
| 1414 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
| 1415 |
-
|
|
|
|
| 1416 |
ForwardIterator first, ForwardIterator last,
|
| 1417 |
const T& old_value, const T& new_value);
|
| 1418 |
-
template<class ForwardIterator, class Predicate,
|
|
|
|
| 1419 |
constexpr void replace_if(ForwardIterator first, ForwardIterator last,
|
| 1420 |
Predicate pred, const T& new_value);
|
| 1421 |
-
template<class ExecutionPolicy, class ForwardIterator, class Predicate,
|
| 1422 |
-
|
|
|
|
| 1423 |
ForwardIterator first, ForwardIterator last,
|
| 1424 |
Predicate pred, const T& new_value);
|
| 1425 |
|
| 1426 |
namespace ranges {
|
| 1427 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 1428 |
requires indirectly_writable<I, const T2&> &&
|
| 1429 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 1430 |
constexpr I
|
| 1431 |
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 1432 |
-
template<input_range R, class
|
|
|
|
| 1433 |
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 1434 |
indirect_binary_predicate<ranges::equal_to,
|
| 1435 |
projected<iterator_t<R>, Proj>, const T1*>
|
| 1436 |
constexpr borrowed_iterator_t<R>
|
| 1437 |
replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 1438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1439 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1440 |
requires indirectly_writable<I, const T&>
|
| 1441 |
constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
|
| 1442 |
-
template<input_range R, class
|
| 1443 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1444 |
requires indirectly_writable<iterator_t<R>, const T&>
|
| 1445 |
constexpr borrowed_iterator_t<R>
|
| 1446 |
replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1447 |
}
|
| 1448 |
|
| 1449 |
template<class InputIterator, class OutputIterator, class T>
|
| 1450 |
constexpr OutputIterator replace_copy(InputIterator first, InputIterator last,
|
| 1451 |
OutputIterator result,
|
| 1452 |
const T& old_value, const T& new_value);
|
| 1453 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
|
| 1454 |
-
ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1455 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1456 |
ForwardIterator2 result,
|
| 1457 |
const T& old_value, const T& new_value);
|
| 1458 |
-
template<class InputIterator, class OutputIterator, class Predicate,
|
|
|
|
| 1459 |
constexpr OutputIterator replace_copy_if(InputIterator first, InputIterator last,
|
| 1460 |
OutputIterator result,
|
| 1461 |
Predicate pred, const T& new_value);
|
| 1462 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1463 |
-
class Predicate, class T>
|
| 1464 |
-
ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1465 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1466 |
ForwardIterator2 result,
|
| 1467 |
Predicate pred, const T& new_value);
|
| 1468 |
|
| 1469 |
namespace ranges {
|
| 1470 |
template<class I, class O>
|
| 1471 |
using replace_copy_result = in_out_result<I, O>;
|
| 1472 |
|
| 1473 |
-
template<input_iterator I, sentinel_for<I> S, class
|
| 1474 |
-
|
|
|
|
| 1475 |
requires indirectly_copyable<I, O> &&
|
| 1476 |
-
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
|
|
|
| 1477 |
constexpr replace_copy_result<I, O>
|
| 1478 |
replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
|
| 1479 |
Proj proj = {});
|
| 1480 |
-
template<input_range R, class
|
| 1481 |
-
class Proj =
|
| 1482 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 1483 |
indirect_binary_predicate<ranges::equal_to,
|
| 1484 |
-
projected<iterator_t<R>, Proj>, const T1*>
|
|
|
|
| 1485 |
constexpr replace_copy_result<borrowed_iterator_t<R>, O>
|
| 1486 |
replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
|
| 1487 |
Proj proj = {});
|
| 1488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1489 |
template<class I, class O>
|
| 1490 |
using replace_copy_if_result = in_out_result<I, O>;
|
| 1491 |
|
| 1492 |
-
template<input_iterator I, sentinel_for<I> S, class
|
| 1493 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1494 |
-
requires indirectly_copyable<I, O>
|
| 1495 |
constexpr replace_copy_if_result<I, O>
|
| 1496 |
replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
|
| 1497 |
Proj proj = {});
|
| 1498 |
-
template<input_range R, class
|
| 1499 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1500 |
-
requires indirectly_copyable<iterator_t<R>, O>
|
| 1501 |
constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
|
| 1502 |
replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
|
| 1503 |
Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1504 |
}
|
| 1505 |
|
| 1506 |
// [alg.fill], fill
|
| 1507 |
-
template<class ForwardIterator, class T>
|
| 1508 |
constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value);
|
| 1509 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
| 1510 |
-
|
|
|
|
| 1511 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 1512 |
-
template<class OutputIterator, class Size,
|
| 1513 |
-
|
|
|
|
| 1514 |
template<class ExecutionPolicy, class ForwardIterator,
|
| 1515 |
-
class Size, class T>
|
| 1516 |
-
ForwardIterator fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1517 |
ForwardIterator first, Size n, const T& value);
|
| 1518 |
|
| 1519 |
namespace ranges {
|
| 1520 |
-
template<class
|
|
|
|
| 1521 |
constexpr O fill(O first, S last, const T& value);
|
| 1522 |
-
template<class
|
|
|
|
| 1523 |
constexpr borrowed_iterator_t<R> fill(R&& r, const T& value);
|
| 1524 |
-
template<class
|
|
|
|
| 1525 |
constexpr O fill_n(O first, iter_difference_t<O> n, const T& value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1526 |
}
|
| 1527 |
|
| 1528 |
// [alg.generate], generate
|
| 1529 |
template<class ForwardIterator, class Generator>
|
| 1530 |
constexpr void generate(ForwardIterator first, ForwardIterator last,
|
| 1531 |
Generator gen);
|
| 1532 |
template<class ExecutionPolicy, class ForwardIterator, class Generator>
|
| 1533 |
-
void generate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1534 |
ForwardIterator first, ForwardIterator last,
|
| 1535 |
Generator gen);
|
| 1536 |
template<class OutputIterator, class Size, class Generator>
|
| 1537 |
constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
|
| 1538 |
template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
|
| 1539 |
-
ForwardIterator generate_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1540 |
ForwardIterator first, Size n, Generator gen);
|
| 1541 |
|
| 1542 |
namespace ranges {
|
| 1543 |
template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
|
| 1544 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
|
@@ -1547,86 +2149,142 @@ namespace std {
|
|
| 1547 |
requires invocable<F&> && output_range<R, invoke_result_t<F&>>
|
| 1548 |
constexpr borrowed_iterator_t<R> generate(R&& r, F gen);
|
| 1549 |
template<input_or_output_iterator O, copy_constructible F>
|
| 1550 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 1551 |
constexpr O generate_n(O first, iter_difference_t<O> n, F gen);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1552 |
}
|
| 1553 |
|
| 1554 |
// [alg.remove], remove
|
| 1555 |
-
template<class ForwardIterator, class T>
|
| 1556 |
constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last,
|
| 1557 |
const T& value);
|
| 1558 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
| 1559 |
-
|
|
|
|
| 1560 |
ForwardIterator first, ForwardIterator last,
|
| 1561 |
const T& value);
|
| 1562 |
template<class ForwardIterator, class Predicate>
|
| 1563 |
constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
|
| 1564 |
Predicate pred);
|
| 1565 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 1566 |
-
ForwardIterator remove_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1567 |
ForwardIterator first, ForwardIterator last,
|
| 1568 |
Predicate pred);
|
| 1569 |
|
| 1570 |
namespace ranges {
|
| 1571 |
-
template<permutable I, sentinel_for<I> S, class
|
|
|
|
| 1572 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 1573 |
constexpr subrange<I> remove(I first, S last, const T& value, Proj proj = {});
|
| 1574 |
-
template<forward_range R, class
|
|
|
|
| 1575 |
requires permutable<iterator_t<R>> &&
|
| 1576 |
indirect_binary_predicate<ranges::equal_to,
|
| 1577 |
projected<iterator_t<R>, Proj>, const T*>
|
| 1578 |
constexpr borrowed_subrange_t<R>
|
| 1579 |
remove(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1580 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 1581 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1582 |
constexpr subrange<I> remove_if(I first, S last, Pred pred, Proj proj = {});
|
| 1583 |
template<forward_range R, class Proj = identity,
|
| 1584 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1585 |
requires permutable<iterator_t<R>>
|
| 1586 |
constexpr borrowed_subrange_t<R>
|
| 1587 |
remove_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1588 |
}
|
| 1589 |
|
| 1590 |
-
template<class InputIterator, class OutputIterator,
|
|
|
|
| 1591 |
constexpr OutputIterator
|
| 1592 |
remove_copy(InputIterator first, InputIterator last,
|
| 1593 |
OutputIterator result, const T& value);
|
| 1594 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1595 |
-
class T>
|
| 1596 |
ForwardIterator2
|
| 1597 |
-
remove_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1598 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1599 |
ForwardIterator2 result, const T& value);
|
| 1600 |
template<class InputIterator, class OutputIterator, class Predicate>
|
| 1601 |
constexpr OutputIterator
|
| 1602 |
remove_copy_if(InputIterator first, InputIterator last,
|
| 1603 |
OutputIterator result, Predicate pred);
|
| 1604 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1605 |
class Predicate>
|
| 1606 |
ForwardIterator2
|
| 1607 |
-
remove_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1608 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1609 |
ForwardIterator2 result, Predicate pred);
|
| 1610 |
|
| 1611 |
namespace ranges {
|
| 1612 |
template<class I, class O>
|
| 1613 |
using remove_copy_result = in_out_result<I, O>;
|
| 1614 |
|
| 1615 |
-
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 1616 |
-
class Proj = identity>
|
| 1617 |
requires indirectly_copyable<I, O> &&
|
| 1618 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 1619 |
constexpr remove_copy_result<I, O>
|
| 1620 |
remove_copy(I first, S last, O result, const T& value, Proj proj = {});
|
| 1621 |
-
template<input_range R, weakly_incrementable O, class
|
|
|
|
| 1622 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 1623 |
indirect_binary_predicate<ranges::equal_to,
|
| 1624 |
projected<iterator_t<R>, Proj>, const T*>
|
| 1625 |
constexpr remove_copy_result<borrowed_iterator_t<R>, O>
|
| 1626 |
remove_copy(R&& r, O result, const T& value, Proj proj = {});
|
| 1627 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1628 |
template<class I, class O>
|
| 1629 |
using remove_copy_if_result = in_out_result<I, O>;
|
| 1630 |
|
| 1631 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 1632 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
|
@@ -1636,23 +2294,38 @@ namespace std {
|
|
| 1636 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 1637 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1638 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1639 |
constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
|
| 1640 |
remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1641 |
}
|
| 1642 |
|
| 1643 |
// [alg.unique], unique
|
| 1644 |
template<class ForwardIterator>
|
| 1645 |
constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last);
|
| 1646 |
template<class ForwardIterator, class BinaryPredicate>
|
| 1647 |
constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last,
|
| 1648 |
BinaryPredicate pred);
|
| 1649 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 1650 |
-
ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1651 |
ForwardIterator first, ForwardIterator last);
|
| 1652 |
template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
|
| 1653 |
-
ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1654 |
ForwardIterator first, ForwardIterator last,
|
| 1655 |
BinaryPredicate pred);
|
| 1656 |
|
| 1657 |
namespace ranges {
|
| 1658 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -1661,10 +2334,22 @@ namespace std {
|
|
| 1661 |
template<forward_range R, class Proj = identity,
|
| 1662 |
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 1663 |
requires permutable<iterator_t<R>>
|
| 1664 |
constexpr borrowed_subrange_t<R>
|
| 1665 |
unique(R&& r, C comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1666 |
}
|
| 1667 |
|
| 1668 |
template<class InputIterator, class OutputIterator>
|
| 1669 |
constexpr OutputIterator
|
| 1670 |
unique_copy(InputIterator first, InputIterator last,
|
|
@@ -1673,17 +2358,17 @@ namespace std {
|
|
| 1673 |
constexpr OutputIterator
|
| 1674 |
unique_copy(InputIterator first, InputIterator last,
|
| 1675 |
OutputIterator result, BinaryPredicate pred);
|
| 1676 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1677 |
ForwardIterator2
|
| 1678 |
-
unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1679 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1680 |
ForwardIterator2 result);
|
| 1681 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1682 |
class BinaryPredicate>
|
| 1683 |
ForwardIterator2
|
| 1684 |
-
unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1685 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1686 |
ForwardIterator2 result, BinaryPredicate pred);
|
| 1687 |
|
| 1688 |
namespace ranges {
|
| 1689 |
template<class I, class O>
|
|
@@ -1703,93 +2388,151 @@ namespace std {
|
|
| 1703 |
(forward_iterator<iterator_t<R>> ||
|
| 1704 |
(input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
|
| 1705 |
indirectly_copyable_storable<iterator_t<R>, O>)
|
| 1706 |
constexpr unique_copy_result<borrowed_iterator_t<R>, O>
|
| 1707 |
unique_copy(R&& r, O result, C comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1708 |
}
|
| 1709 |
|
| 1710 |
// [alg.reverse], reverse
|
| 1711 |
template<class BidirectionalIterator>
|
| 1712 |
constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last);
|
| 1713 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 1714 |
-
void reverse(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1715 |
BidirectionalIterator first, BidirectionalIterator last);
|
| 1716 |
|
| 1717 |
namespace ranges {
|
| 1718 |
template<bidirectional_iterator I, sentinel_for<I> S>
|
| 1719 |
requires permutable<I>
|
| 1720 |
constexpr I reverse(I first, S last);
|
| 1721 |
template<bidirectional_range R>
|
| 1722 |
requires permutable<iterator_t<R>>
|
| 1723 |
constexpr borrowed_iterator_t<R> reverse(R&& r);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1724 |
}
|
| 1725 |
|
| 1726 |
template<class BidirectionalIterator, class OutputIterator>
|
| 1727 |
constexpr OutputIterator
|
| 1728 |
reverse_copy(BidirectionalIterator first, BidirectionalIterator last,
|
| 1729 |
OutputIterator result);
|
| 1730 |
template<class ExecutionPolicy, class BidirectionalIterator, class ForwardIterator>
|
| 1731 |
ForwardIterator
|
| 1732 |
-
reverse_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1733 |
BidirectionalIterator first, BidirectionalIterator last,
|
| 1734 |
ForwardIterator result);
|
| 1735 |
|
| 1736 |
namespace ranges {
|
| 1737 |
template<class I, class O>
|
| 1738 |
using reverse_copy_result = in_out_result<I, O>;
|
|
|
|
|
|
|
| 1739 |
|
| 1740 |
template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
|
| 1741 |
requires indirectly_copyable<I, O>
|
| 1742 |
constexpr reverse_copy_result<I, O>
|
| 1743 |
reverse_copy(I first, S last, O result);
|
| 1744 |
template<bidirectional_range R, weakly_incrementable O>
|
| 1745 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1746 |
constexpr reverse_copy_result<borrowed_iterator_t<R>, O>
|
| 1747 |
reverse_copy(R&& r, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1748 |
}
|
| 1749 |
|
| 1750 |
// [alg.rotate], rotate
|
| 1751 |
template<class ForwardIterator>
|
| 1752 |
constexpr ForwardIterator rotate(ForwardIterator first,
|
| 1753 |
ForwardIterator middle,
|
| 1754 |
ForwardIterator last);
|
| 1755 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 1756 |
-
ForwardIterator rotate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1757 |
ForwardIterator first,
|
| 1758 |
ForwardIterator middle,
|
| 1759 |
ForwardIterator last);
|
| 1760 |
|
| 1761 |
namespace ranges {
|
| 1762 |
template<permutable I, sentinel_for<I> S>
|
| 1763 |
constexpr subrange<I> rotate(I first, I middle, S last);
|
| 1764 |
template<forward_range R>
|
| 1765 |
requires permutable<iterator_t<R>>
|
| 1766 |
constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1767 |
}
|
| 1768 |
|
| 1769 |
template<class ForwardIterator, class OutputIterator>
|
| 1770 |
constexpr OutputIterator
|
| 1771 |
rotate_copy(ForwardIterator first, ForwardIterator middle,
|
| 1772 |
ForwardIterator last, OutputIterator result);
|
| 1773 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1774 |
ForwardIterator2
|
| 1775 |
-
rotate_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1776 |
ForwardIterator1 first, ForwardIterator1 middle,
|
| 1777 |
ForwardIterator1 last, ForwardIterator2 result);
|
| 1778 |
|
| 1779 |
namespace ranges {
|
| 1780 |
template<class I, class O>
|
| 1781 |
using rotate_copy_result = in_out_result<I, O>;
|
|
|
|
|
|
|
| 1782 |
|
| 1783 |
template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
|
| 1784 |
requires indirectly_copyable<I, O>
|
| 1785 |
constexpr rotate_copy_result<I, O>
|
| 1786 |
rotate_copy(I first, I middle, S last, O result);
|
| 1787 |
template<forward_range R, weakly_incrementable O>
|
| 1788 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1789 |
constexpr rotate_copy_result<borrowed_iterator_t<R>, O>
|
| 1790 |
rotate_copy(R&& r, iterator_t<R> middle, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1791 |
}
|
| 1792 |
|
| 1793 |
// [alg.random.sample], sample
|
| 1794 |
template<class PopulationIterator, class SampleIterator,
|
| 1795 |
class Distance, class UniformRandomBitGenerator>
|
|
@@ -1833,52 +2576,70 @@ namespace std {
|
|
| 1833 |
constexpr ForwardIterator
|
| 1834 |
shift_left(ForwardIterator first, ForwardIterator last,
|
| 1835 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 1836 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 1837 |
ForwardIterator
|
| 1838 |
-
shift_left(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1839 |
ForwardIterator first, ForwardIterator last,
|
| 1840 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 1841 |
|
| 1842 |
namespace ranges {
|
| 1843 |
template<permutable I, sentinel_for<I> S>
|
| 1844 |
constexpr subrange<I> shift_left(I first, S last, iter_difference_t<I> n);
|
| 1845 |
template<forward_range R>
|
| 1846 |
requires permutable<iterator_t<R>>
|
| 1847 |
constexpr borrowed_subrange_t<R> shift_left(R&& r, range_difference_t<R> n);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1848 |
}
|
| 1849 |
|
| 1850 |
template<class ForwardIterator>
|
| 1851 |
constexpr ForwardIterator
|
| 1852 |
shift_right(ForwardIterator first, ForwardIterator last,
|
| 1853 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 1854 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 1855 |
ForwardIterator
|
| 1856 |
-
shift_right(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1857 |
ForwardIterator first, ForwardIterator last,
|
| 1858 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 1859 |
|
| 1860 |
namespace ranges {
|
| 1861 |
template<permutable I, sentinel_for<I> S>
|
| 1862 |
constexpr subrange<I> shift_right(I first, S last, iter_difference_t<I> n);
|
| 1863 |
template<forward_range R>
|
| 1864 |
requires permutable<iterator_t<R>>
|
| 1865 |
constexpr borrowed_subrange_t<R> shift_right(R&& r, range_difference_t<R> n);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1866 |
}
|
| 1867 |
|
| 1868 |
// [alg.sorting], sorting and related operations
|
| 1869 |
// [alg.sort], sorting
|
| 1870 |
template<class RandomAccessIterator>
|
| 1871 |
constexpr void sort(RandomAccessIterator first, RandomAccessIterator last);
|
| 1872 |
template<class RandomAccessIterator, class Compare>
|
| 1873 |
constexpr void sort(RandomAccessIterator first, RandomAccessIterator last,
|
| 1874 |
Compare comp);
|
| 1875 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 1876 |
-
void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1877 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 1878 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 1879 |
-
void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1880 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 1881 |
Compare comp);
|
| 1882 |
|
| 1883 |
namespace ranges {
|
| 1884 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
@@ -1888,48 +2649,69 @@ namespace std {
|
|
| 1888 |
sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 1889 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 1890 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 1891 |
constexpr borrowed_iterator_t<R>
|
| 1892 |
sort(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1893 |
}
|
| 1894 |
|
| 1895 |
template<class RandomAccessIterator>
|
| 1896 |
-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
|
| 1897 |
template<class RandomAccessIterator, class Compare>
|
| 1898 |
-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
|
| 1899 |
Compare comp);
|
| 1900 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 1901 |
-
void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1902 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 1903 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 1904 |
-
void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1905 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 1906 |
Compare comp);
|
| 1907 |
|
| 1908 |
namespace ranges {
|
| 1909 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 1910 |
class Proj = identity>
|
| 1911 |
requires sortable<I, Comp, Proj>
|
| 1912 |
-
I stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 1913 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 1914 |
requires sortable<iterator_t<R>, Comp, Proj>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1915 |
borrowed_iterator_t<R>
|
| 1916 |
-
stable_sort(R&& r, Comp comp = {}, Proj proj = {});
|
| 1917 |
}
|
| 1918 |
|
| 1919 |
template<class RandomAccessIterator>
|
| 1920 |
constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle,
|
| 1921 |
RandomAccessIterator last);
|
| 1922 |
template<class RandomAccessIterator, class Compare>
|
| 1923 |
constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle,
|
| 1924 |
RandomAccessIterator last, Compare comp);
|
| 1925 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 1926 |
-
void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1927 |
RandomAccessIterator first, RandomAccessIterator middle,
|
| 1928 |
RandomAccessIterator last);
|
| 1929 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 1930 |
-
void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1931 |
RandomAccessIterator first, RandomAccessIterator middle,
|
| 1932 |
RandomAccessIterator last, Compare comp);
|
| 1933 |
|
| 1934 |
namespace ranges {
|
| 1935 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
@@ -1940,10 +2722,22 @@ namespace std {
|
|
| 1940 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 1941 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 1942 |
constexpr borrowed_iterator_t<R>
|
| 1943 |
partial_sort(R&& r, iterator_t<R> middle, Comp comp = {},
|
| 1944 |
Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1945 |
}
|
| 1946 |
|
| 1947 |
template<class InputIterator, class RandomAccessIterator>
|
| 1948 |
constexpr RandomAccessIterator
|
| 1949 |
partial_sort_copy(InputIterator first, InputIterator last,
|
|
@@ -1955,18 +2749,18 @@ namespace std {
|
|
| 1955 |
RandomAccessIterator result_first,
|
| 1956 |
RandomAccessIterator result_last,
|
| 1957 |
Compare comp);
|
| 1958 |
template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator>
|
| 1959 |
RandomAccessIterator
|
| 1960 |
-
partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1961 |
ForwardIterator first, ForwardIterator last,
|
| 1962 |
RandomAccessIterator result_first,
|
| 1963 |
RandomAccessIterator result_last);
|
| 1964 |
template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator,
|
| 1965 |
class Compare>
|
| 1966 |
RandomAccessIterator
|
| 1967 |
-
partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 1968 |
ForwardIterator first, ForwardIterator last,
|
| 1969 |
RandomAccessIterator result_first,
|
| 1970 |
RandomAccessIterator result_last,
|
| 1971 |
Compare comp);
|
| 1972 |
|
|
@@ -1989,32 +2783,60 @@ namespace std {
|
|
| 1989 |
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 1990 |
projected<iterator_t<R2>, Proj2>>
|
| 1991 |
constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1992 |
partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
|
| 1993 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1994 |
}
|
| 1995 |
|
| 1996 |
template<class ForwardIterator>
|
| 1997 |
constexpr bool is_sorted(ForwardIterator first, ForwardIterator last);
|
| 1998 |
template<class ForwardIterator, class Compare>
|
| 1999 |
constexpr bool is_sorted(ForwardIterator first, ForwardIterator last,
|
| 2000 |
Compare comp);
|
| 2001 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2002 |
-
bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2003 |
ForwardIterator first, ForwardIterator last);
|
| 2004 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2005 |
-
bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2006 |
ForwardIterator first, ForwardIterator last,
|
| 2007 |
Compare comp);
|
| 2008 |
|
| 2009 |
namespace ranges {
|
| 2010 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2011 |
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 2012 |
constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2013 |
template<forward_range R, class Proj = identity,
|
| 2014 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2015 |
constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2016 |
}
|
| 2017 |
|
| 2018 |
template<class ForwardIterator>
|
| 2019 |
constexpr ForwardIterator
|
| 2020 |
is_sorted_until(ForwardIterator first, ForwardIterator last);
|
|
@@ -2022,15 +2844,15 @@ namespace std {
|
|
| 2022 |
constexpr ForwardIterator
|
| 2023 |
is_sorted_until(ForwardIterator first, ForwardIterator last,
|
| 2024 |
Compare comp);
|
| 2025 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2026 |
ForwardIterator
|
| 2027 |
-
is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2028 |
ForwardIterator first, ForwardIterator last);
|
| 2029 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2030 |
ForwardIterator
|
| 2031 |
-
is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2032 |
ForwardIterator first, ForwardIterator last,
|
| 2033 |
Compare comp);
|
| 2034 |
|
| 2035 |
namespace ranges {
|
| 2036 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -2038,25 +2860,35 @@ namespace std {
|
|
| 2038 |
constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2039 |
template<forward_range R, class Proj = identity,
|
| 2040 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2041 |
constexpr borrowed_iterator_t<R>
|
| 2042 |
is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2043 |
}
|
| 2044 |
|
| 2045 |
// [alg.nth.element], Nth element
|
| 2046 |
template<class RandomAccessIterator>
|
| 2047 |
constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
|
| 2048 |
RandomAccessIterator last);
|
| 2049 |
template<class RandomAccessIterator, class Compare>
|
| 2050 |
constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
|
| 2051 |
RandomAccessIterator last, Compare comp);
|
| 2052 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2053 |
-
void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2054 |
RandomAccessIterator first, RandomAccessIterator nth,
|
| 2055 |
RandomAccessIterator last);
|
| 2056 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2057 |
-
void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2058 |
RandomAccessIterator first, RandomAccessIterator nth,
|
| 2059 |
RandomAccessIterator last, Compare comp);
|
| 2060 |
|
| 2061 |
namespace ranges {
|
| 2062 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
@@ -2066,118 +2898,150 @@ namespace std {
|
|
| 2066 |
nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 2067 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 2068 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2069 |
constexpr borrowed_iterator_t<R>
|
| 2070 |
nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2071 |
}
|
| 2072 |
|
| 2073 |
// [alg.binary.search], binary search
|
| 2074 |
-
template<class ForwardIterator, class T>
|
| 2075 |
constexpr ForwardIterator
|
| 2076 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 2077 |
const T& value);
|
| 2078 |
-
template<class ForwardIterator, class T
|
|
|
|
| 2079 |
constexpr ForwardIterator
|
| 2080 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 2081 |
const T& value, Compare comp);
|
| 2082 |
|
| 2083 |
namespace ranges {
|
| 2084 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 2085 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2086 |
constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
|
| 2087 |
Proj proj = {});
|
| 2088 |
-
template<forward_range R, class
|
|
|
|
| 2089 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2090 |
ranges::less>
|
| 2091 |
constexpr borrowed_iterator_t<R>
|
| 2092 |
lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2093 |
}
|
| 2094 |
|
| 2095 |
-
template<class ForwardIterator, class T>
|
| 2096 |
constexpr ForwardIterator
|
| 2097 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 2098 |
const T& value);
|
| 2099 |
-
template<class ForwardIterator, class T
|
|
|
|
| 2100 |
constexpr ForwardIterator
|
| 2101 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 2102 |
const T& value, Compare comp);
|
| 2103 |
|
| 2104 |
namespace ranges {
|
| 2105 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 2106 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2107 |
constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 2108 |
-
template<forward_range R, class
|
|
|
|
| 2109 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2110 |
ranges::less>
|
| 2111 |
constexpr borrowed_iterator_t<R>
|
| 2112 |
upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2113 |
}
|
| 2114 |
|
| 2115 |
-
template<class ForwardIterator, class T>
|
| 2116 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2117 |
equal_range(ForwardIterator first, ForwardIterator last,
|
| 2118 |
const T& value);
|
| 2119 |
-
template<class ForwardIterator, class T
|
|
|
|
| 2120 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2121 |
equal_range(ForwardIterator first, ForwardIterator last,
|
| 2122 |
const T& value, Compare comp);
|
| 2123 |
|
| 2124 |
namespace ranges {
|
| 2125 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 2126 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2127 |
constexpr subrange<I>
|
| 2128 |
equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 2129 |
-
template<forward_range R, class
|
|
|
|
| 2130 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2131 |
ranges::less>
|
| 2132 |
constexpr borrowed_subrange_t<R>
|
| 2133 |
equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2134 |
}
|
| 2135 |
|
| 2136 |
-
template<class ForwardIterator, class T>
|
| 2137 |
constexpr bool
|
| 2138 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 2139 |
const T& value);
|
| 2140 |
-
template<class ForwardIterator, class T
|
|
|
|
| 2141 |
constexpr bool
|
| 2142 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 2143 |
const T& value, Compare comp);
|
| 2144 |
|
| 2145 |
namespace ranges {
|
| 2146 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 2147 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2148 |
constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
|
| 2149 |
Proj proj = {});
|
| 2150 |
-
template<forward_range R, class
|
|
|
|
| 2151 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2152 |
ranges::less>
|
| 2153 |
constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
|
| 2154 |
Proj proj = {});
|
| 2155 |
}
|
| 2156 |
|
| 2157 |
// [alg.partitions], partitions
|
| 2158 |
template<class InputIterator, class Predicate>
|
| 2159 |
constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);
|
| 2160 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 2161 |
-
bool is_partitioned(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2162 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 2163 |
|
| 2164 |
namespace ranges {
|
| 2165 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2166 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2167 |
constexpr bool is_partitioned(I first, S last, Pred pred, Proj proj = {});
|
| 2168 |
template<input_range R, class Proj = identity,
|
| 2169 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2170 |
constexpr bool is_partitioned(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2171 |
}
|
| 2172 |
|
| 2173 |
template<class ForwardIterator, class Predicate>
|
| 2174 |
constexpr ForwardIterator partition(ForwardIterator first,
|
| 2175 |
ForwardIterator last,
|
| 2176 |
Predicate pred);
|
| 2177 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 2178 |
-
ForwardIterator partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2179 |
ForwardIterator first,
|
| 2180 |
ForwardIterator last,
|
| 2181 |
Predicate pred);
|
| 2182 |
|
| 2183 |
namespace ranges {
|
|
@@ -2188,31 +3052,55 @@ namespace std {
|
|
| 2188 |
template<forward_range R, class Proj = identity,
|
| 2189 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2190 |
requires permutable<iterator_t<R>>
|
| 2191 |
constexpr borrowed_subrange_t<R>
|
| 2192 |
partition(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2193 |
}
|
| 2194 |
|
| 2195 |
template<class BidirectionalIterator, class Predicate>
|
| 2196 |
-
BidirectionalIterator stable_partition(BidirectionalIterator first,
|
| 2197 |
BidirectionalIterator last,
|
| 2198 |
Predicate pred);
|
| 2199 |
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
|
| 2200 |
-
BidirectionalIterator stable_partition(ExecutionPolicy&& exec,
|
| 2201 |
-
BidirectionalIterator first,
|
| 2202 |
BidirectionalIterator last,
|
| 2203 |
Predicate pred);
|
| 2204 |
|
| 2205 |
namespace ranges {
|
| 2206 |
template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2207 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2208 |
requires permutable<I>
|
| 2209 |
-
subrange<I> stable_partition(I first, S last, Pred pred,
|
|
|
|
| 2210 |
template<bidirectional_range R, class Proj = identity,
|
| 2211 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2212 |
requires permutable<iterator_t<R>>
|
| 2213 |
-
borrowed_subrange_t<R> stable_partition(R&& r, Pred pred,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2214 |
}
|
| 2215 |
|
| 2216 |
template<class InputIterator, class OutputIterator1,
|
| 2217 |
class OutputIterator2, class Predicate>
|
| 2218 |
constexpr pair<OutputIterator1, OutputIterator2>
|
|
@@ -2220,11 +3108,11 @@ namespace std {
|
|
| 2220 |
OutputIterator1 out_true, OutputIterator2 out_false,
|
| 2221 |
Predicate pred);
|
| 2222 |
template<class ExecutionPolicy, class ForwardIterator, class ForwardIterator1,
|
| 2223 |
class ForwardIterator2, class Predicate>
|
| 2224 |
pair<ForwardIterator1, ForwardIterator2>
|
| 2225 |
-
partition_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2226 |
ForwardIterator first, ForwardIterator last,
|
| 2227 |
ForwardIterator1 out_true, ForwardIterator2 out_false,
|
| 2228 |
Predicate pred);
|
| 2229 |
|
| 2230 |
namespace ranges {
|
|
@@ -2243,10 +3131,30 @@ namespace std {
|
|
| 2243 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2244 |
requires indirectly_copyable<iterator_t<R>, O1> &&
|
| 2245 |
indirectly_copyable<iterator_t<R>, O2>
|
| 2246 |
constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
|
| 2247 |
partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2248 |
}
|
| 2249 |
|
| 2250 |
template<class ForwardIterator, class Predicate>
|
| 2251 |
constexpr ForwardIterator
|
| 2252 |
partition_point(ForwardIterator first, ForwardIterator last,
|
|
@@ -2275,18 +3183,18 @@ namespace std {
|
|
| 2275 |
InputIterator2 first2, InputIterator2 last2,
|
| 2276 |
OutputIterator result, Compare comp);
|
| 2277 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2278 |
class ForwardIterator>
|
| 2279 |
ForwardIterator
|
| 2280 |
-
merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2281 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2282 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2283 |
ForwardIterator result);
|
| 2284 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2285 |
class ForwardIterator, class Compare>
|
| 2286 |
ForwardIterator
|
| 2287 |
-
merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2288 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2289 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2290 |
ForwardIterator result, Compare comp);
|
| 2291 |
|
| 2292 |
namespace ranges {
|
|
@@ -2304,41 +3212,69 @@ namespace std {
|
|
| 2304 |
class Proj1 = identity, class Proj2 = identity>
|
| 2305 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 2306 |
constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 2307 |
merge(R1&& r1, R2&& r2, O result,
|
| 2308 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2309 |
}
|
| 2310 |
|
| 2311 |
template<class BidirectionalIterator>
|
| 2312 |
-
void inplace_merge(BidirectionalIterator first,
|
| 2313 |
BidirectionalIterator middle,
|
| 2314 |
BidirectionalIterator last);
|
| 2315 |
template<class BidirectionalIterator, class Compare>
|
| 2316 |
-
void inplace_merge(BidirectionalIterator first,
|
| 2317 |
BidirectionalIterator middle,
|
| 2318 |
BidirectionalIterator last, Compare comp);
|
| 2319 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 2320 |
-
void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2321 |
BidirectionalIterator first,
|
| 2322 |
BidirectionalIterator middle,
|
| 2323 |
BidirectionalIterator last);
|
| 2324 |
template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
|
| 2325 |
-
void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2326 |
BidirectionalIterator first,
|
| 2327 |
BidirectionalIterator middle,
|
| 2328 |
BidirectionalIterator last, Compare comp);
|
| 2329 |
|
| 2330 |
namespace ranges {
|
| 2331 |
template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 2332 |
class Proj = identity>
|
| 2333 |
requires sortable<I, Comp, Proj>
|
| 2334 |
-
|
|
|
|
| 2335 |
template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
|
| 2336 |
requires sortable<iterator_t<R>, Comp, Proj>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2337 |
borrowed_iterator_t<R>
|
| 2338 |
-
inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
|
| 2339 |
-
Proj proj = {});
|
| 2340 |
}
|
| 2341 |
|
| 2342 |
// [alg.set.operations], set operations
|
| 2343 |
template<class InputIterator1, class InputIterator2>
|
| 2344 |
constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -2346,16 +3282,16 @@ namespace std {
|
|
| 2346 |
template<class InputIterator1, class InputIterator2, class Compare>
|
| 2347 |
constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
|
| 2348 |
InputIterator2 first2, InputIterator2 last2,
|
| 2349 |
Compare comp);
|
| 2350 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 2351 |
-
bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2352 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2353 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 2354 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2355 |
class Compare>
|
| 2356 |
-
bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2357 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2358 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2359 |
Compare comp);
|
| 2360 |
|
| 2361 |
namespace ranges {
|
|
@@ -2369,10 +3305,24 @@ namespace std {
|
|
| 2369 |
class Proj2 = identity,
|
| 2370 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 2371 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 2372 |
constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
|
| 2373 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2374 |
}
|
| 2375 |
|
| 2376 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 2377 |
constexpr OutputIterator
|
| 2378 |
set_union(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -2384,18 +3334,18 @@ namespace std {
|
|
| 2384 |
InputIterator2 first2, InputIterator2 last2,
|
| 2385 |
OutputIterator result, Compare comp);
|
| 2386 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2387 |
class ForwardIterator>
|
| 2388 |
ForwardIterator
|
| 2389 |
-
set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2390 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2391 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2392 |
ForwardIterator result);
|
| 2393 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2394 |
class ForwardIterator, class Compare>
|
| 2395 |
ForwardIterator
|
| 2396 |
-
set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2397 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2398 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2399 |
ForwardIterator result, Compare comp);
|
| 2400 |
|
| 2401 |
namespace ranges {
|
|
@@ -2413,10 +3363,28 @@ namespace std {
|
|
| 2413 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 2414 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 2415 |
constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 2416 |
set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 2417 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2418 |
}
|
| 2419 |
|
| 2420 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 2421 |
constexpr OutputIterator
|
| 2422 |
set_intersection(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -2428,18 +3396,18 @@ namespace std {
|
|
| 2428 |
InputIterator2 first2, InputIterator2 last2,
|
| 2429 |
OutputIterator result, Compare comp);
|
| 2430 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2431 |
class ForwardIterator>
|
| 2432 |
ForwardIterator
|
| 2433 |
-
set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2434 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2435 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2436 |
ForwardIterator result);
|
| 2437 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2438 |
class ForwardIterator, class Compare>
|
| 2439 |
ForwardIterator
|
| 2440 |
-
set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2441 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2442 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2443 |
ForwardIterator result, Compare comp);
|
| 2444 |
|
| 2445 |
namespace ranges {
|
|
@@ -2457,10 +3425,28 @@ namespace std {
|
|
| 2457 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 2458 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 2459 |
constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 2460 |
set_intersection(R1&& r1, R2&& r2, O result,
|
| 2461 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2462 |
}
|
| 2463 |
|
| 2464 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 2465 |
constexpr OutputIterator
|
| 2466 |
set_difference(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -2472,18 +3458,18 @@ namespace std {
|
|
| 2472 |
InputIterator2 first2, InputIterator2 last2,
|
| 2473 |
OutputIterator result, Compare comp);
|
| 2474 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2475 |
class ForwardIterator>
|
| 2476 |
ForwardIterator
|
| 2477 |
-
set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2478 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2479 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2480 |
ForwardIterator result);
|
| 2481 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2482 |
class ForwardIterator, class Compare>
|
| 2483 |
ForwardIterator
|
| 2484 |
-
set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2485 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2486 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2487 |
ForwardIterator result, Compare comp);
|
| 2488 |
|
| 2489 |
namespace ranges {
|
|
@@ -2501,10 +3487,27 @@ namespace std {
|
|
| 2501 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 2502 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 2503 |
constexpr set_difference_result<borrowed_iterator_t<R1>, O>
|
| 2504 |
set_difference(R1&& r1, R2&& r2, O result,
|
| 2505 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2506 |
}
|
| 2507 |
|
| 2508 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 2509 |
constexpr OutputIterator
|
| 2510 |
set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -2516,18 +3519,18 @@ namespace std {
|
|
| 2516 |
InputIterator2 first2, InputIterator2 last2,
|
| 2517 |
OutputIterator result, Compare comp);
|
| 2518 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2519 |
class ForwardIterator>
|
| 2520 |
ForwardIterator
|
| 2521 |
-
set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2522 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2523 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2524 |
ForwardIterator result);
|
| 2525 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2526 |
class ForwardIterator, class Compare>
|
| 2527 |
ForwardIterator
|
| 2528 |
-
set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2529 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2530 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2531 |
ForwardIterator result, Compare comp);
|
| 2532 |
|
| 2533 |
namespace ranges {
|
|
@@ -2547,10 +3550,28 @@ namespace std {
|
|
| 2547 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 2548 |
constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
|
| 2549 |
borrowed_iterator_t<R2>, O>
|
| 2550 |
set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 2551 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2552 |
}
|
| 2553 |
|
| 2554 |
// [alg.heap.operations], heap operations
|
| 2555 |
template<class RandomAccessIterator>
|
| 2556 |
constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last);
|
|
@@ -2628,24 +3649,33 @@ namespace std {
|
|
| 2628 |
constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
|
| 2629 |
template<class RandomAccessIterator, class Compare>
|
| 2630 |
constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last,
|
| 2631 |
Compare comp);
|
| 2632 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2633 |
-
bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2634 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 2635 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2636 |
-
bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2637 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 2638 |
Compare comp);
|
| 2639 |
|
| 2640 |
namespace ranges {
|
| 2641 |
template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2642 |
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 2643 |
constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2644 |
template<random_access_range R, class Proj = identity,
|
| 2645 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2646 |
constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2647 |
}
|
| 2648 |
|
| 2649 |
template<class RandomAccessIterator>
|
| 2650 |
constexpr RandomAccessIterator
|
| 2651 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
|
|
@@ -2653,15 +3683,15 @@ namespace std {
|
|
| 2653 |
constexpr RandomAccessIterator
|
| 2654 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last,
|
| 2655 |
Compare comp);
|
| 2656 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2657 |
RandomAccessIterator
|
| 2658 |
-
is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2659 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 2660 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2661 |
RandomAccessIterator
|
| 2662 |
-
is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2663 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 2664 |
Compare comp);
|
| 2665 |
|
| 2666 |
namespace ranges {
|
| 2667 |
template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -2669,10 +3699,20 @@ namespace std {
|
|
| 2669 |
constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2670 |
template<random_access_range R, class Proj = identity,
|
| 2671 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2672 |
constexpr borrowed_iterator_t<R>
|
| 2673 |
is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2674 |
}
|
| 2675 |
|
| 2676 |
// [alg.min.max], minimum and maximum
|
| 2677 |
template<class T> constexpr const T& min(const T& a, const T& b);
|
| 2678 |
template<class T, class Compare>
|
|
@@ -2692,10 +3732,15 @@ namespace std {
|
|
| 2692 |
template<input_range R, class Proj = identity,
|
| 2693 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2694 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 2695 |
constexpr range_value_t<R>
|
| 2696 |
min(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2697 |
}
|
| 2698 |
|
| 2699 |
template<class T> constexpr const T& max(const T& a, const T& b);
|
| 2700 |
template<class T, class Compare>
|
| 2701 |
constexpr const T& max(const T& a, const T& b, Compare comp);
|
|
@@ -2714,10 +3759,15 @@ namespace std {
|
|
| 2714 |
template<input_range R, class Proj = identity,
|
| 2715 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2716 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 2717 |
constexpr range_value_t<R>
|
| 2718 |
max(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2719 |
}
|
| 2720 |
|
| 2721 |
template<class T> constexpr pair<const T&, const T&> minmax(const T& a, const T& b);
|
| 2722 |
template<class T, class Compare>
|
| 2723 |
constexpr pair<const T&, const T&> minmax(const T& a, const T& b, Compare comp);
|
|
@@ -2741,22 +3791,27 @@ namespace std {
|
|
| 2741 |
template<input_range R, class Proj = identity,
|
| 2742 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2743 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 2744 |
constexpr minmax_result<range_value_t<R>>
|
| 2745 |
minmax(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2746 |
}
|
| 2747 |
|
| 2748 |
template<class ForwardIterator>
|
| 2749 |
constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
|
| 2750 |
template<class ForwardIterator, class Compare>
|
| 2751 |
constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
|
| 2752 |
Compare comp);
|
| 2753 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2754 |
-
ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2755 |
ForwardIterator first, ForwardIterator last);
|
| 2756 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2757 |
-
ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2758 |
ForwardIterator first, ForwardIterator last,
|
| 2759 |
Compare comp);
|
| 2760 |
|
| 2761 |
namespace ranges {
|
| 2762 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -2764,22 +3819,33 @@ namespace std {
|
|
| 2764 |
constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2765 |
template<forward_range R, class Proj = identity,
|
| 2766 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2767 |
constexpr borrowed_iterator_t<R>
|
| 2768 |
min_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2769 |
}
|
| 2770 |
|
| 2771 |
template<class ForwardIterator>
|
| 2772 |
constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
|
| 2773 |
template<class ForwardIterator, class Compare>
|
| 2774 |
constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
|
| 2775 |
Compare comp);
|
| 2776 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2777 |
-
ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2778 |
ForwardIterator first, ForwardIterator last);
|
| 2779 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2780 |
-
ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2781 |
ForwardIterator first, ForwardIterator last,
|
| 2782 |
Compare comp);
|
| 2783 |
|
| 2784 |
namespace ranges {
|
| 2785 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
@@ -2787,25 +3853,36 @@ namespace std {
|
|
| 2787 |
constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2788 |
template<forward_range R, class Proj = identity,
|
| 2789 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2790 |
constexpr borrowed_iterator_t<R>
|
| 2791 |
max_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2792 |
}
|
| 2793 |
|
| 2794 |
template<class ForwardIterator>
|
| 2795 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2796 |
minmax_element(ForwardIterator first, ForwardIterator last);
|
| 2797 |
template<class ForwardIterator, class Compare>
|
| 2798 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2799 |
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
| 2800 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2801 |
pair<ForwardIterator, ForwardIterator>
|
| 2802 |
-
minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2803 |
ForwardIterator first, ForwardIterator last);
|
| 2804 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2805 |
pair<ForwardIterator, ForwardIterator>
|
| 2806 |
-
minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2807 |
ForwardIterator first, ForwardIterator last, Compare comp);
|
| 2808 |
|
| 2809 |
namespace ranges {
|
| 2810 |
template<class I>
|
| 2811 |
using minmax_element_result = min_max_result<I>;
|
|
@@ -2816,10 +3893,21 @@ namespace std {
|
|
| 2816 |
minmax_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2817 |
template<forward_range R, class Proj = identity,
|
| 2818 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2819 |
constexpr minmax_element_result<borrowed_iterator_t<R>>
|
| 2820 |
minmax_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2821 |
}
|
| 2822 |
|
| 2823 |
// [alg.clamp], bounded value
|
| 2824 |
template<class T>
|
| 2825 |
constexpr const T& clamp(const T& v, const T& lo, const T& hi);
|
|
@@ -2843,17 +3931,17 @@ namespace std {
|
|
| 2843 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 2844 |
InputIterator2 first2, InputIterator2 last2,
|
| 2845 |
Compare comp);
|
| 2846 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 2847 |
bool
|
| 2848 |
-
lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2849 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2850 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 2851 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2852 |
class Compare>
|
| 2853 |
bool
|
| 2854 |
-
lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 2855 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 2856 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 2857 |
Compare comp);
|
| 2858 |
|
| 2859 |
namespace ranges {
|
|
@@ -2869,10 +3957,25 @@ namespace std {
|
|
| 2869 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 2870 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 2871 |
constexpr bool
|
| 2872 |
lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
|
| 2873 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2874 |
}
|
| 2875 |
|
| 2876 |
// [alg.three.way], three-way comparison algorithms
|
| 2877 |
template<class InputIterator1, class InputIterator2, class Cmp>
|
| 2878 |
constexpr auto
|
|
@@ -3130,10 +4233,17 @@ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 3130 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3131 |
constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});
|
| 3132 |
template<input_range R, class Proj = identity,
|
| 3133 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3134 |
constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3135 |
```
|
| 3136 |
|
| 3137 |
Let E be:
|
| 3138 |
|
| 3139 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
@@ -3159,10 +4269,17 @@ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 3159 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3160 |
constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});
|
| 3161 |
template<input_range R, class Proj = identity,
|
| 3162 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3163 |
constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3164 |
```
|
| 3165 |
|
| 3166 |
Let E be:
|
| 3167 |
|
| 3168 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
@@ -3188,10 +4305,17 @@ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 3188 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3189 |
constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});
|
| 3190 |
template<input_range R, class Proj = identity,
|
| 3191 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3192 |
constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3193 |
```
|
| 3194 |
|
| 3195 |
Let E be:
|
| 3196 |
|
| 3197 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
@@ -3205,20 +4329,36 @@ Let E be:
|
|
| 3205 |
any projection.
|
| 3206 |
|
| 3207 |
### Contains <a id="alg.contains">[[alg.contains]]</a>
|
| 3208 |
|
| 3209 |
``` cpp
|
| 3210 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 3211 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 3212 |
constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});
|
| 3213 |
-
template<input_range R, class
|
| 3214 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 3215 |
constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
|
| 3216 |
```
|
| 3217 |
|
| 3218 |
*Returns:* `ranges::find(std::move(first), last, value, proj) != last`.
|
| 3219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3220 |
``` cpp
|
| 3221 |
template<forward_iterator I1, sentinel_for<I1> S1,
|
| 3222 |
forward_iterator I2, sentinel_for<I2> S2,
|
| 3223 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 3224 |
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
|
@@ -3230,11 +4370,36 @@ template<forward_range R1, forward_range R2,
|
|
| 3230 |
constexpr bool ranges::contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
|
| 3231 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3232 |
```
|
| 3233 |
|
| 3234 |
*Returns:*
|
| 3235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3236 |
|
| 3237 |
### For each <a id="alg.foreach">[[alg.foreach]]</a>
|
| 3238 |
|
| 3239 |
``` cpp
|
| 3240 |
template<class InputIterator, class Function>
|
|
@@ -3314,10 +4479,43 @@ the range \[`first`, `last`), starting from `first` and proceeding to
|
|
| 3314 |
*Remarks:* If `f` returns a result, the result is ignored.
|
| 3315 |
|
| 3316 |
[*Note 6*: The overloads in namespace `ranges` require `Fun` to model
|
| 3317 |
`copy_constructible`. — *end note*]
|
| 3318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3319 |
``` cpp
|
| 3320 |
template<class InputIterator, class Size, class Function>
|
| 3321 |
constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
|
| 3322 |
```
|
| 3323 |
|
|
@@ -3325,17 +4523,17 @@ template<class InputIterator, class Size, class Function>
|
|
| 3325 |
type [[conv.integral]], [[class.conv]].
|
| 3326 |
|
| 3327 |
*Preconditions:* `n >= 0` is `true`. `Function` meets the
|
| 3328 |
*Cpp17MoveConstructible* requirements.
|
| 3329 |
|
| 3330 |
-
[*Note
|
| 3331 |
*Cpp17CopyConstructible*. — *end note*]
|
| 3332 |
|
| 3333 |
*Effects:* Applies `f` to the result of dereferencing every iterator in
|
| 3334 |
the range \[`first`, `first + n`) in order.
|
| 3335 |
|
| 3336 |
-
[*Note
|
| 3337 |
iterator, `f` can apply non-constant functions through the dereferenced
|
| 3338 |
iterator. — *end note*]
|
| 3339 |
|
| 3340 |
*Returns:* `first + n`.
|
| 3341 |
|
|
@@ -3354,11 +4552,11 @@ type [[conv.integral]], [[class.conv]].
|
|
| 3354 |
*Cpp17CopyConstructible* requirements.
|
| 3355 |
|
| 3356 |
*Effects:* Applies `f` to the result of dereferencing every iterator in
|
| 3357 |
the range \[`first`, `first + n`).
|
| 3358 |
|
| 3359 |
-
[*Note
|
| 3360 |
iterator, `f` can apply non-constant functions through the dereferenced
|
| 3361 |
iterator. — *end note*]
|
| 3362 |
|
| 3363 |
*Returns:* `first + n`.
|
| 3364 |
|
|
@@ -3377,27 +4575,56 @@ template<input_iterator I, class Proj = identity,
|
|
| 3377 |
*Preconditions:* `n >= 0` is `true`.
|
| 3378 |
|
| 3379 |
*Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
|
| 3380 |
the range \[`first`, `first + n`) in order.
|
| 3381 |
|
| 3382 |
-
[*Note
|
| 3383 |
`f` can apply non-constant functions. — *end note*]
|
| 3384 |
|
| 3385 |
*Returns:* `{first + n, std::move(f)}`.
|
| 3386 |
|
| 3387 |
*Remarks:* If `f` returns a result, the result is ignored.
|
| 3388 |
|
| 3389 |
-
[*Note
|
| 3390 |
`copy_constructible`. — *end note*]
|
| 3391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3392 |
### Find <a id="alg.find">[[alg.find]]</a>
|
| 3393 |
|
| 3394 |
``` cpp
|
| 3395 |
-
template<class InputIterator, class T>
|
| 3396 |
constexpr InputIterator find(InputIterator first, InputIterator last,
|
| 3397 |
const T& value);
|
| 3398 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 3399 |
ForwardIterator find(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
|
| 3400 |
const T& value);
|
| 3401 |
|
| 3402 |
template<class InputIterator, class Predicate>
|
| 3403 |
constexpr InputIterator find_if(InputIterator first, InputIterator last,
|
|
@@ -3412,31 +4639,58 @@ template<class InputIterator, class Predicate>
|
|
| 3412 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 3413 |
ForwardIterator find_if_not(ExecutionPolicy&& exec,
|
| 3414 |
ForwardIterator first, ForwardIterator last,
|
| 3415 |
Predicate pred);
|
| 3416 |
|
| 3417 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 3418 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 3419 |
constexpr I ranges::find(I first, S last, const T& value, Proj proj = {});
|
| 3420 |
-
template<input_range R, class
|
| 3421 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 3422 |
constexpr borrowed_iterator_t<R>
|
| 3423 |
ranges::find(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3424 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3425 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3426 |
constexpr I ranges::find_if(I first, S last, Pred pred, Proj proj = {});
|
| 3427 |
template<input_range R, class Proj = identity,
|
| 3428 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3429 |
constexpr borrowed_iterator_t<R>
|
| 3430 |
ranges::find_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3431 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3432 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3433 |
constexpr I ranges::find_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 3434 |
template<input_range R, class Proj = identity,
|
| 3435 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3436 |
constexpr borrowed_iterator_t<R>
|
| 3437 |
ranges::find_if_not(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3438 |
```
|
| 3439 |
|
| 3440 |
Let E be:
|
| 3441 |
|
| 3442 |
- `*i == value` for `find`;
|
|
@@ -3453,28 +4707,58 @@ which E is `true`. Returns `last` if no such iterator is found.
|
|
| 3453 |
predicate and any projection.
|
| 3454 |
|
| 3455 |
### Find last <a id="alg.find.last">[[alg.find.last]]</a>
|
| 3456 |
|
| 3457 |
``` cpp
|
| 3458 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 3459 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 3460 |
constexpr subrange<I> ranges::find_last(I first, S last, const T& value, Proj proj = {});
|
| 3461 |
-
template<forward_range R, class
|
|
|
|
| 3462 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 3463 |
constexpr borrowed_subrange_t<R> ranges::find_last(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3464 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3465 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3466 |
constexpr subrange<I> ranges::find_last_if(I first, S last, Pred pred, Proj proj = {});
|
| 3467 |
template<forward_range R, class Proj = identity,
|
| 3468 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3469 |
constexpr borrowed_subrange_t<R> ranges::find_last_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3470 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3471 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3472 |
constexpr subrange<I> ranges::find_last_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 3473 |
template<forward_range R, class Proj = identity,
|
| 3474 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3475 |
constexpr borrowed_subrange_t<R> ranges::find_last_if_not(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3476 |
```
|
| 3477 |
|
| 3478 |
Let E be:
|
| 3479 |
|
| 3480 |
- `bool(invoke(proj, *i) == value)` for `ranges::find_last`;
|
|
@@ -3526,10 +4810,24 @@ template<forward_range R1, forward_range R2,
|
|
| 3526 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 3527 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 3528 |
constexpr borrowed_subrange_t<R1>
|
| 3529 |
ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
|
| 3530 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3531 |
```
|
| 3532 |
|
| 3533 |
Let:
|
| 3534 |
|
| 3535 |
- `pred` be `equal_to{}` for the overloads with no parameter `pred`;
|
|
@@ -3553,11 +4851,11 @@ Let:
|
|
| 3553 |
|
| 3554 |
*Complexity:* At most
|
| 3555 |
`(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`
|
| 3556 |
applications of the corresponding predicate and any projections.
|
| 3557 |
|
| 3558 |
-
### Find first <a id="alg.find.first.of">[[alg.find.first.of]]</a>
|
| 3559 |
|
| 3560 |
``` cpp
|
| 3561 |
template<class InputIterator, class ForwardIterator>
|
| 3562 |
constexpr InputIterator
|
| 3563 |
find_first_of(InputIterator first1, InputIterator last1,
|
|
@@ -3593,10 +4891,23 @@ template<input_range R1, forward_range R2,
|
|
| 3593 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 3594 |
constexpr borrowed_iterator_t<R1>
|
| 3595 |
ranges::find_first_of(R1&& r1, R2&& r2,
|
| 3596 |
Pred pred = {},
|
| 3597 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3598 |
```
|
| 3599 |
|
| 3600 |
Let E be:
|
| 3601 |
|
| 3602 |
- `*i == *j` for the overloads with no parameter `pred`;
|
|
@@ -3610,12 +4921,12 @@ Let E be:
|
|
| 3610 |
*Returns:* The first iterator `i` in the range \[`first1`, `last1`) such
|
| 3611 |
that for some iterator `j` in the range \[`first2`, `last2`) E holds.
|
| 3612 |
Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
|
| 3613 |
is found.
|
| 3614 |
|
| 3615 |
-
*Complexity:* At most `(last1-first1) * (last2-first2)` applications
|
| 3616 |
-
the corresponding predicate and any projections.
|
| 3617 |
|
| 3618 |
### Adjacent find <a id="alg.adjacent.find">[[alg.adjacent.find]]</a>
|
| 3619 |
|
| 3620 |
``` cpp
|
| 3621 |
template<class ForwardIterator>
|
|
@@ -3642,10 +4953,21 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 3642 |
constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});
|
| 3643 |
template<forward_range R, class Proj = identity,
|
| 3644 |
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 3645 |
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 3646 |
constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3647 |
```
|
| 3648 |
|
| 3649 |
Let E be:
|
| 3650 |
|
| 3651 |
- `*i == *(i + 1)` for the overloads with no parameter `pred`;
|
|
@@ -3656,25 +4978,25 @@ Let E be:
|
|
| 3656 |
|
| 3657 |
*Returns:* The first iterator `i` such that both `i` and `i + 1` are in
|
| 3658 |
the range \[`first`, `last`) for which E holds. Returns `last` if no
|
| 3659 |
such iterator is found.
|
| 3660 |
|
| 3661 |
-
*Complexity:* For the
|
| 3662 |
$$\min(\texttt{(i - first) + 1}, \ \texttt{(last - first) - 1})$$
|
| 3663 |
applications of the corresponding predicate, where `i` is
|
| 3664 |
-
`adjacent_find`’s return value. For the
|
| 3665 |
-
|
| 3666 |
-
|
| 3667 |
-
projection.
|
| 3668 |
|
| 3669 |
### Count <a id="alg.count">[[alg.count]]</a>
|
| 3670 |
|
| 3671 |
``` cpp
|
| 3672 |
-
template<class InputIterator, class T>
|
| 3673 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 3674 |
count(InputIterator first, InputIterator last, const T& value);
|
| 3675 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 3676 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 3677 |
count(ExecutionPolicy&& exec,
|
| 3678 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 3679 |
|
| 3680 |
template<class InputIterator, class Predicate>
|
|
@@ -3683,26 +5005,48 @@ template<class InputIterator, class Predicate>
|
|
| 3683 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 3684 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 3685 |
count_if(ExecutionPolicy&& exec,
|
| 3686 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 3687 |
|
| 3688 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 3689 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 3690 |
constexpr iter_difference_t<I>
|
| 3691 |
ranges::count(I first, S last, const T& value, Proj proj = {});
|
| 3692 |
-
template<input_range R, class
|
| 3693 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 3694 |
constexpr range_difference_t<R>
|
| 3695 |
ranges::count(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3696 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3697 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3698 |
constexpr iter_difference_t<I>
|
| 3699 |
ranges::count_if(I first, S last, Pred pred, Proj proj = {});
|
| 3700 |
template<input_range R, class Proj = identity,
|
| 3701 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3702 |
constexpr range_difference_t<R>
|
| 3703 |
ranges::count_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3704 |
```
|
| 3705 |
|
| 3706 |
Let E be:
|
| 3707 |
|
| 3708 |
- `*i == value` for the overloads with no parameter `pred` or `proj`;
|
|
@@ -3717,11 +5061,11 @@ Let E be:
|
|
| 3717 |
`last`) for which E holds.
|
| 3718 |
|
| 3719 |
*Complexity:* Exactly `last - first` applications of the corresponding
|
| 3720 |
predicate and any projection.
|
| 3721 |
|
| 3722 |
-
### Mismatch <a id="mismatch">[[mismatch]]</a>
|
| 3723 |
|
| 3724 |
``` cpp
|
| 3725 |
template<class InputIterator1, class InputIterator2>
|
| 3726 |
constexpr pair<InputIterator1, InputIterator2>
|
| 3727 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -3778,14 +5122,28 @@ template<input_range R1, input_range R2,
|
|
| 3778 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 3779 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 3780 |
constexpr ranges::mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 3781 |
ranges::mismatch(R1&& r1, R2&& r2, Pred pred = {},
|
| 3782 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3783 |
```
|
| 3784 |
|
| 3785 |
-
Let `last2` be `first2 + (last1 - first1)` for the overloads
|
| 3786 |
-
|
| 3787 |
|
| 3788 |
Let E be:
|
| 3789 |
|
| 3790 |
- `!(*(first1 + n) == *(first2 + n))` for the overloads with no
|
| 3791 |
parameter `pred`;
|
|
@@ -3852,16 +5210,28 @@ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for
|
|
| 3852 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to,
|
| 3853 |
class Proj1 = identity, class Proj2 = identity>
|
| 3854 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 3855 |
constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
|
| 3856 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3857 |
```
|
| 3858 |
|
| 3859 |
Let:
|
| 3860 |
|
| 3861 |
-
- `last2` be `first2 + (last1 - first1)` for the overloads
|
| 3862 |
-
|
| 3863 |
- `pred` be `equal_to{}` for the overloads with no parameter `pred`;
|
| 3864 |
- E be:
|
| 3865 |
- `pred(*i, *(first2 + (i - first1)))` for the overloads with no
|
| 3866 |
parameter `proj1`;
|
| 3867 |
- `invoke(pred, invoke(proj1, *i), invoke(proj2, *(first2 + (i - first1))))`
|
|
@@ -3877,24 +5247,20 @@ Otherwise return `true` if E holds for every iterator `i` in the range
|
|
| 3877 |
*Cpp17RandomAccessIterator* requirements [[random.access.iterators]]
|
| 3878 |
and `last1 - first1 != last2 - first2` for the overloads in namespace
|
| 3879 |
`std`;
|
| 3880 |
- the types of `first1`, `last1`, `first2`, and `last2` pairwise model
|
| 3881 |
`sized_sentinel_for` [[iterator.concept.sizedsentinel]] and
|
| 3882 |
-
`last1 - first1 != last2 - first2` for the first
|
| 3883 |
-
`ranges`,
|
| 3884 |
- `R1` and `R2` each model `sized_range` and
|
| 3885 |
-
`ranges::distance(r1) != ranges::distance(r2)` for the second
|
| 3886 |
-
in namespace `ranges`,
|
| 3887 |
|
| 3888 |
then no applications of the corresponding predicate and each projection;
|
| 3889 |
-
otherwise,
|
| 3890 |
-
|
| 3891 |
-
|
| 3892 |
-
min(`last1 - first1`, `last2 - first2`) applications of the
|
| 3893 |
-
corresponding predicate and any projections.
|
| 3894 |
-
- For the overloads with an `ExecutionPolicy`, 𝑂(min(`last1 - first1`,
|
| 3895 |
-
`last2 - first2`)) applications of the corresponding predicate.
|
| 3896 |
|
| 3897 |
### Is permutation <a id="alg.is.permutation">[[alg.is.permutation]]</a>
|
| 3898 |
|
| 3899 |
``` cpp
|
| 3900 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
@@ -3958,11 +5324,11 @@ Otherwise return `true` if there exists a permutation of the elements in
|
|
| 3958 |
the range \[`first2`, `last2`), bounded by \[`pfirst`, `plast`), such
|
| 3959 |
that `ranges::equal(first1, last1, pfirst, plast, pred, proj1, proj2)`
|
| 3960 |
returns `true`; otherwise, returns `false`.
|
| 3961 |
|
| 3962 |
*Complexity:* No applications of the corresponding predicate and
|
| 3963 |
-
projections if
|
| 3964 |
|
| 3965 |
- for the first overload,
|
| 3966 |
- `S1` and `I1` model `sized_sentinel_for<S1, I1>`,
|
| 3967 |
- `S2` and `I2` model `sized_sentinel_for<S2, I2>`, and
|
| 3968 |
- `last1 - first1 != last2 - first2`;
|
|
@@ -4002,12 +5368,13 @@ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
|
| 4002 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 4003 |
BinaryPredicate pred);
|
| 4004 |
```
|
| 4005 |
|
| 4006 |
*Returns:* The first iterator `i` in the range \[`first1`,
|
| 4007 |
-
`last1 - (last2-first2)`
|
| 4008 |
-
less than `last2 - first2` the following corresponding conditions
|
|
|
|
| 4009 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 4010 |
Returns `first1` if \[`first2`, `last2`) is empty, otherwise returns
|
| 4011 |
`last1` if no such iterator is found.
|
| 4012 |
|
| 4013 |
*Complexity:* At most `(last1 - first1) * (last2 - first2)` applications
|
|
@@ -4025,16 +5392,30 @@ template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
|
|
| 4025 |
class Proj1 = identity, class Proj2 = identity>
|
| 4026 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4027 |
constexpr borrowed_subrange_t<R1>
|
| 4028 |
ranges::search(R1&& r1, R2&& r2, Pred pred = {},
|
| 4029 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4030 |
```
|
| 4031 |
|
| 4032 |
*Returns:*
|
| 4033 |
|
| 4034 |
- `{i, i + (last2 - first2)}`, where `i` is the first iterator in the
|
| 4035 |
-
range \[`first1`, `last1 - (last2 - first2)`
|
| 4036 |
non-negative integer `n` less than `last2 - first2` the condition
|
| 4037 |
``` cpp
|
| 4038 |
bool(invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n))))
|
| 4039 |
```
|
| 4040 |
|
|
@@ -4043,27 +5424,29 @@ template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
|
|
| 4043 |
|
| 4044 |
*Complexity:* At most `(last1 - first1) * (last2 - first2)` applications
|
| 4045 |
of the corresponding predicate and projections.
|
| 4046 |
|
| 4047 |
``` cpp
|
| 4048 |
-
template<class ForwardIterator, class Size, class T>
|
| 4049 |
constexpr ForwardIterator
|
| 4050 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 4051 |
Size count, const T& value);
|
| 4052 |
-
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
|
|
|
| 4053 |
ForwardIterator
|
| 4054 |
search_n(ExecutionPolicy&& exec,
|
| 4055 |
ForwardIterator first, ForwardIterator last,
|
| 4056 |
Size count, const T& value);
|
| 4057 |
|
| 4058 |
-
template<class ForwardIterator, class Size, class T,
|
| 4059 |
class BinaryPredicate>
|
| 4060 |
constexpr ForwardIterator
|
| 4061 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 4062 |
Size count, const T& value,
|
| 4063 |
BinaryPredicate pred);
|
| 4064 |
-
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
|
|
|
| 4065 |
class BinaryPredicate>
|
| 4066 |
ForwardIterator
|
| 4067 |
search_n(ExecutionPolicy&& exec,
|
| 4068 |
ForwardIterator first, ForwardIterator last,
|
| 4069 |
Size count, const T& value,
|
|
@@ -4071,36 +5454,53 @@ template<class ExecutionPolicy, class ForwardIterator, class Size, class T,
|
|
| 4071 |
```
|
| 4072 |
|
| 4073 |
*Mandates:* The type `Size` is convertible to an integral
|
| 4074 |
type [[conv.integral]], [[class.conv]].
|
| 4075 |
|
| 4076 |
-
*
|
| 4077 |
-
|
| 4078 |
-
|
| 4079 |
-
|
| 4080 |
-
|
|
|
|
|
|
|
| 4081 |
|
| 4082 |
*Complexity:* At most `last - first` applications of the corresponding
|
| 4083 |
predicate.
|
| 4084 |
|
| 4085 |
``` cpp
|
| 4086 |
-
template<forward_iterator I, sentinel_for<I> S,
|
| 4087 |
-
class Pred = ranges::equal_to, class Proj = identity
|
|
|
|
| 4088 |
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 4089 |
constexpr subrange<I>
|
| 4090 |
ranges::search_n(I first, S last, iter_difference_t<I> count,
|
| 4091 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 4092 |
-
template<forward_range R, class
|
| 4093 |
-
class Proj = identity>
|
| 4094 |
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 4095 |
constexpr borrowed_subrange_t<R>
|
| 4096 |
ranges::search_n(R&& r, range_difference_t<R> count,
|
| 4097 |
const T& value, Pred pred = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4098 |
```
|
| 4099 |
|
| 4100 |
*Returns:* `{i, i + count}` where `i` is the first iterator in the range
|
| 4101 |
-
\[`first`, `last - count`
|
| 4102 |
less than `count`, the following condition holds:
|
| 4103 |
`invoke(pred, invoke(proj, *(i + n)), value)`. Returns `{last, last}` if
|
| 4104 |
no such iterator is found.
|
| 4105 |
|
| 4106 |
*Complexity:* At most `last - first` applications of the corresponding
|
|
@@ -4137,10 +5537,32 @@ template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Pr
|
|
| 4137 |
``` cpp
|
| 4138 |
ranges::mismatch(std::move(first1), last1, std::move(first2), last2,
|
| 4139 |
pred, proj1, proj2).in2 == last2
|
| 4140 |
```
|
| 4141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4142 |
### Ends with <a id="alg.ends.with">[[alg.ends.with]]</a>
|
| 4143 |
|
| 4144 |
``` cpp
|
| 4145 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 4146 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
|
@@ -4151,17 +5573,35 @@ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for
|
|
| 4151 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4152 |
```
|
| 4153 |
|
| 4154 |
Let `N1` be `last1 - first1` and `N2` be `last2 - first2`.
|
| 4155 |
|
| 4156 |
-
*Returns:* `false` if `N1` < `N2`, otherwise
|
| 4157 |
|
| 4158 |
``` cpp
|
| 4159 |
ranges::equal(std::move(first1) + (N1 - N2), last1, std::move(first2), last2,
|
| 4160 |
pred, proj1, proj2)
|
| 4161 |
```
|
| 4162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4163 |
``` cpp
|
| 4164 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
|
| 4165 |
class Proj2 = identity>
|
| 4166 |
requires (forward_range<R1> || sized_range<R1>) &&
|
| 4167 |
(forward_range<R2> || sized_range<R2>) &&
|
|
@@ -4170,22 +5610,44 @@ template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Pr
|
|
| 4170 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4171 |
```
|
| 4172 |
|
| 4173 |
Let `N1` be `ranges::distance(r1)` and `N2` be `ranges::distance(r2)`.
|
| 4174 |
|
| 4175 |
-
*Returns:* `false` if `N1` < `N2`, otherwise
|
| 4176 |
|
| 4177 |
``` cpp
|
| 4178 |
-
ranges::equal(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4179 |
```
|
| 4180 |
|
| 4181 |
### Fold <a id="alg.fold">[[alg.fold]]</a>
|
| 4182 |
|
| 4183 |
``` cpp
|
| 4184 |
-
template<input_iterator I, sentinel_for<I> S, class T
|
|
|
|
| 4185 |
constexpr auto ranges::fold_left(I first, S last, T init, F f);
|
| 4186 |
-
template<input_range R, class T
|
|
|
|
| 4187 |
constexpr auto ranges::fold_left(R&& r, T init, F f);
|
| 4188 |
```
|
| 4189 |
|
| 4190 |
*Returns:*
|
| 4191 |
|
|
@@ -4208,14 +5670,14 @@ template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterat
|
|
| 4208 |
``` cpp
|
| 4209 |
ranges::fold_left_first_with_iter(std::move(first), last, f).value
|
| 4210 |
```
|
| 4211 |
|
| 4212 |
``` cpp
|
| 4213 |
-
template<bidirectional_iterator I, sentinel_for<I> S, class T,
|
| 4214 |
indirectly-binary-right-foldable<T, I> F>
|
| 4215 |
constexpr auto ranges::fold_right(I first, S last, T init, F f);
|
| 4216 |
-
template<bidirectional_range R, class T,
|
| 4217 |
indirectly-binary-right-foldable<T, iterator_t<R>> F>
|
| 4218 |
constexpr auto ranges::fold_right(R&& r, T init, F f);
|
| 4219 |
```
|
| 4220 |
|
| 4221 |
*Effects:* Equivalent to:
|
|
@@ -4254,14 +5716,15 @@ I tail = ranges::prev(ranges::next(first, std::move(last)));
|
|
| 4254 |
return optional<U>(in_place,
|
| 4255 |
ranges::fold_right(std::move(first), tail, iter_value_t<I>(*tail), std::move(f)));
|
| 4256 |
```
|
| 4257 |
|
| 4258 |
``` cpp
|
| 4259 |
-
template<input_iterator I, sentinel_for<I> S, class T,
|
| 4260 |
indirectly-binary-left-foldable<T, I> F>
|
| 4261 |
constexpr see below ranges::fold_left_with_iter(I first, S last, T init, F f);
|
| 4262 |
-
template<input_range R, class T
|
|
|
|
| 4263 |
constexpr see below ranges::fold_left_with_iter(R&& r, T init, F f);
|
| 4264 |
```
|
| 4265 |
|
| 4266 |
Let `U` be `decay_t<invoke_result_t<F&, T, iter_reference_t<I>>>`.
|
| 4267 |
|
|
@@ -4347,25 +5810,43 @@ range \[`result`, `result + `N) starting from `first` and proceeding to
|
|
| 4347 |
|
| 4348 |
*Complexity:* Exactly N assignments.
|
| 4349 |
|
| 4350 |
``` cpp
|
| 4351 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 4352 |
-
ForwardIterator2 copy(ExecutionPolicy&&
|
| 4353 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 4354 |
ForwardIterator2 result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4355 |
```
|
| 4356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4357 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 4358 |
-
`result +
|
| 4359 |
|
| 4360 |
-
*Effects:* Copies elements in the range \[`first`, `
|
| 4361 |
-
range \[`result`, `result +
|
| 4362 |
-
|
| 4363 |
|
| 4364 |
-
*Returns:*
|
| 4365 |
|
| 4366 |
-
|
|
|
|
|
|
|
|
|
|
| 4367 |
|
| 4368 |
``` cpp
|
| 4369 |
template<class InputIterator, class Size, class OutputIterator>
|
| 4370 |
constexpr OutputIterator copy_n(InputIterator first, Size n,
|
| 4371 |
OutputIterator result);
|
|
@@ -4376,13 +5857,24 @@ template<class ExecutionPolicy, class ForwardIterator1, class Size, class Forwar
|
|
| 4376 |
|
| 4377 |
template<input_iterator I, weakly_incrementable O>
|
| 4378 |
requires indirectly_copyable<I, O>
|
| 4379 |
constexpr ranges::copy_n_result<I, O>
|
| 4380 |
ranges::copy_n(I first, iter_difference_t<I> n, O result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4381 |
```
|
| 4382 |
|
| 4383 |
-
Let
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4384 |
|
| 4385 |
*Mandates:* The type `Size` is convertible to an integral
|
| 4386 |
type [[conv.integral]], [[class.conv]].
|
| 4387 |
|
| 4388 |
*Effects:* For each non-negative integer i < N, performs
|
|
@@ -4413,38 +5905,66 @@ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj
|
|
| 4413 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 4414 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4415 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 4416 |
constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
|
| 4417 |
ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4418 |
```
|
| 4419 |
|
| 4420 |
-
Let E be:
|
| 4421 |
|
| 4422 |
- `bool(pred(*i))` for the overloads in namespace `std`;
|
| 4423 |
- `bool(invoke(pred, invoke(proj, *i)))` for the overloads in namespace
|
| 4424 |
-
`ranges`
|
| 4425 |
|
| 4426 |
-
|
| 4427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4428 |
|
| 4429 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 4430 |
-
`result +
|
| 4431 |
|
| 4432 |
-
[*Note 1*: For the overload
|
| 4433 |
-
performance cost if
|
| 4434 |
-
not
|
| 4435 |
-
([[cpp17.moveconstructible]])
|
|
|
|
|
|
|
|
|
|
| 4436 |
|
| 4437 |
-
*Effects:* Copies
|
| 4438 |
-
the range \[`first`, `last`) for which E is `true`
|
|
|
|
| 4439 |
|
| 4440 |
*Returns:*
|
| 4441 |
|
| 4442 |
- `result + `N for the overloads in namespace `std`.
|
| 4443 |
-
- `{last, result + `N`}` for the overloads in namespace `ranges`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4444 |
|
| 4445 |
-
*Complexity:*
|
| 4446 |
predicate and any projection.
|
| 4447 |
|
| 4448 |
*Remarks:* Stable [[algorithm.stable]].
|
| 4449 |
|
| 4450 |
``` cpp
|
|
@@ -4497,11 +6017,11 @@ template<input_range R, weakly_incrementable O>
|
|
| 4497 |
requires indirectly_movable<iterator_t<R>, O>
|
| 4498 |
constexpr ranges::move_result<borrowed_iterator_t<R>, O>
|
| 4499 |
ranges::move(R&& r, O result);
|
| 4500 |
```
|
| 4501 |
|
| 4502 |
-
Let E be
|
| 4503 |
|
| 4504 |
- `std::move(*(first + `n`))` for the overload in namespace `std`;
|
| 4505 |
- `ranges::iter_move(first + `n`)` for the overloads in namespace
|
| 4506 |
`ranges`.
|
| 4507 |
|
|
@@ -4510,36 +6030,58 @@ Let N be `last - first`.
|
|
| 4510 |
*Preconditions:* `result` is not in the range \[`first`, `last`).
|
| 4511 |
|
| 4512 |
*Effects:* Moves elements in the range \[`first`, `last`) into the range
|
| 4513 |
\[`result`, `result + `N) starting from `first` and proceeding to
|
| 4514 |
`last`. For each non-negative integer n < N, performs
|
| 4515 |
-
`*(result + `n`) = `E.
|
| 4516 |
|
| 4517 |
*Returns:*
|
| 4518 |
|
| 4519 |
- `result + `N for the overload in namespace `std`.
|
| 4520 |
- `{last, result + `N`}` for the overloads in namespace `ranges`.
|
| 4521 |
|
| 4522 |
*Complexity:* Exactly N assignments.
|
| 4523 |
|
| 4524 |
``` cpp
|
| 4525 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 4526 |
-
ForwardIterator2 move(ExecutionPolicy&&
|
| 4527 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 4528 |
ForwardIterator2 result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4529 |
```
|
| 4530 |
|
| 4531 |
-
Let
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4532 |
|
| 4533 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 4534 |
`result + `N) do not overlap.
|
| 4535 |
|
| 4536 |
-
*Effects:* Moves elements in the range \[`first`, `
|
| 4537 |
-
\[`result`, `result + `N). For each non-negative integer n < N,
|
| 4538 |
-
`*(result + `n`) =
|
| 4539 |
|
| 4540 |
-
*Returns:*
|
|
|
|
|
|
|
|
|
|
| 4541 |
|
| 4542 |
*Complexity:* Exactly N assignments.
|
| 4543 |
|
| 4544 |
``` cpp
|
| 4545 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
|
@@ -4555,11 +6097,11 @@ template<bidirectional_range R, bidirectional_iterator I>
|
|
| 4555 |
requires indirectly_movable<iterator_t<R>, I>
|
| 4556 |
constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
|
| 4557 |
ranges::move_backward(R&& r, I result);
|
| 4558 |
```
|
| 4559 |
|
| 4560 |
-
Let E be
|
| 4561 |
|
| 4562 |
- `std::move(*(last - `n`))` for the overload in namespace `std`;
|
| 4563 |
- `ranges::iter_move(last - `n`)` for the overloads in namespace
|
| 4564 |
`ranges`.
|
| 4565 |
|
|
@@ -4569,11 +6111,11 @@ Let N be `last - first`.
|
|
| 4569 |
|
| 4570 |
*Effects:* Moves elements in the range \[`first`, `last`) into the range
|
| 4571 |
\[`result - `N, `result`) starting from `last - 1` and proceeding to
|
| 4572 |
`first`.[^3]
|
| 4573 |
|
| 4574 |
-
For each positive integer n ≤ N, performs `*(result - `n`) = `E.
|
| 4575 |
|
| 4576 |
*Returns:*
|
| 4577 |
|
| 4578 |
- `result - `N for the overload in namespace `std`.
|
| 4579 |
- `{last, result - `N`}` for the overloads in namespace `ranges`.
|
|
@@ -4599,16 +6141,26 @@ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for
|
|
| 4599 |
ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
|
| 4600 |
template<input_range R1, input_range R2>
|
| 4601 |
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 4602 |
constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 4603 |
ranges::swap_ranges(R1&& r1, R2&& r2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4604 |
```
|
| 4605 |
|
| 4606 |
Let:
|
| 4607 |
|
| 4608 |
-
- `last2` be `first2 + (last1 - first1)` for the overloads
|
| 4609 |
-
parameter named `last2`;
|
| 4610 |
- M be min(`last1 - first1`, `last2 - first2`).
|
| 4611 |
|
| 4612 |
*Preconditions:* The two ranges \[`first1`, `last1`) and \[`first2`,
|
| 4613 |
`last2`) do not overlap. For the overloads in namespace `std`,
|
| 4614 |
`*(first1 + `n`)` is swappable with [[swappable.requirements]]
|
|
@@ -4676,10 +6228,25 @@ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
|
| 4676 |
template<input_range R, weakly_incrementable O, copy_constructible F,
|
| 4677 |
class Proj = identity>
|
| 4678 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 4679 |
constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
|
| 4680 |
ranges::transform(R&& r, O result, F op, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4681 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 4682 |
weakly_incrementable O, copy_constructible F, class Proj1 = identity,
|
| 4683 |
class Proj2 = identity>
|
| 4684 |
requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
|
| 4685 |
projected<I2, Proj2>>>
|
|
@@ -4691,104 +6258,165 @@ template<input_range R1, input_range R2, weakly_incrementable O,
|
|
| 4691 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 4692 |
projected<iterator_t<R2>, Proj2>>>
|
| 4693 |
constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 4694 |
ranges::transform(R1&& r1, R2&& r2, O result,
|
| 4695 |
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4696 |
```
|
| 4697 |
|
| 4698 |
Let:
|
| 4699 |
|
| 4700 |
-
- `last2` be `first2 + (last1 - first1)` for the overloads
|
| 4701 |
-
parameter `first2` but no parameter `last2`;
|
| 4702 |
-
-
|
| 4703 |
min(`last1 - first1`, `last2 - first2`) for binary transforms;
|
| 4704 |
-
-
|
|
|
|
|
|
|
|
|
|
| 4705 |
- `op(*(first1 + (i - result)))` for unary transforms defined in
|
| 4706 |
namespace `std`;
|
| 4707 |
- `binary_op(*(first1 + (i - result)), *(first2 + (i - result)))` for
|
| 4708 |
binary transforms defined in namespace `std`;
|
| 4709 |
- `invoke(op, invoke(proj, *(first1 + (i - result))))` for unary
|
| 4710 |
transforms defined in namespace `ranges`;
|
| 4711 |
- `invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,*(first2 + (i - result))))`
|
| 4712 |
for binary transforms defined in namespace `ranges`.
|
| 4713 |
|
| 4714 |
-
*Preconditions:* `op` and `binary_op`
|
| 4715 |
-
|
|
|
|
|
|
|
| 4716 |
|
| 4717 |
- \[`first1`, `first1 + `N\],
|
| 4718 |
- \[`first2`, `first2 + `N\], and
|
| 4719 |
- \[`result`, `result + `N\].[^4]
|
| 4720 |
|
| 4721 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 4722 |
-
`result + `N) a new corresponding value equal to E.
|
| 4723 |
|
| 4724 |
*Returns:*
|
| 4725 |
|
| 4726 |
- `result + `N for the overloads defined in namespace `std`.
|
| 4727 |
- `{first1 + `N`, result + `N`}` for unary transforms defined in
|
| 4728 |
namespace `ranges`.
|
| 4729 |
- `{first1 + `N`, first2 + `N`, result + `N`}` for binary transforms
|
| 4730 |
defined in namespace `ranges`.
|
| 4731 |
|
| 4732 |
*Complexity:* Exactly N applications of `op` or `binary_op`, and any
|
| 4733 |
-
projections. This requirement also applies to the
|
| 4734 |
-
|
| 4735 |
|
| 4736 |
*Remarks:* `result` may be equal to `first1` or `first2`.
|
| 4737 |
|
| 4738 |
### Replace <a id="alg.replace">[[alg.replace]]</a>
|
| 4739 |
|
| 4740 |
``` cpp
|
| 4741 |
-
template<class ForwardIterator, class T>
|
| 4742 |
constexpr void replace(ForwardIterator first, ForwardIterator last,
|
| 4743 |
const T& old_value, const T& new_value);
|
| 4744 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 4745 |
void replace(ExecutionPolicy&& exec,
|
| 4746 |
ForwardIterator first, ForwardIterator last,
|
| 4747 |
const T& old_value, const T& new_value);
|
| 4748 |
|
| 4749 |
-
template<class ForwardIterator, class Predicate,
|
|
|
|
| 4750 |
constexpr void replace_if(ForwardIterator first, ForwardIterator last,
|
| 4751 |
Predicate pred, const T& new_value);
|
| 4752 |
-
template<class ExecutionPolicy, class ForwardIterator, class Predicate,
|
|
|
|
| 4753 |
void replace_if(ExecutionPolicy&& exec,
|
| 4754 |
ForwardIterator first, ForwardIterator last,
|
| 4755 |
Predicate pred, const T& new_value);
|
| 4756 |
|
| 4757 |
-
template<input_iterator I, sentinel_for<I> S, class
|
|
|
|
| 4758 |
requires indirectly_writable<I, const T2&> &&
|
| 4759 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 4760 |
constexpr I
|
| 4761 |
ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 4762 |
-
template<input_range R, class
|
|
|
|
| 4763 |
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 4764 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
|
| 4765 |
constexpr borrowed_iterator_t<R>
|
| 4766 |
ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 4767 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4768 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4769 |
requires indirectly_writable<I, const T&>
|
| 4770 |
constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
|
| 4771 |
-
template<input_range R, class
|
| 4772 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4773 |
requires indirectly_writable<iterator_t<R>, const T&>
|
| 4774 |
constexpr borrowed_iterator_t<R>
|
| 4775 |
ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4776 |
```
|
| 4777 |
|
| 4778 |
-
Let E be
|
| 4779 |
|
| 4780 |
- `bool(*i == old_value)` for `replace`;
|
| 4781 |
- `bool(pred(*i))` for `replace_if`;
|
| 4782 |
- `bool(invoke(proj, *i) == old_value)` for `ranges::replace`;
|
| 4783 |
- `bool(invoke(pred, invoke(proj, *i)))` for `ranges::replace_if`.
|
| 4784 |
|
| 4785 |
*Mandates:* `new_value` is writable [[iterator.requirements.general]] to
|
| 4786 |
`first`.
|
| 4787 |
|
| 4788 |
*Effects:* Substitutes elements referred by the iterator `i` in the
|
| 4789 |
-
range \[`first`, `last`) with `new_value`, when E is `true`.
|
| 4790 |
|
| 4791 |
*Returns:* `last` for the overloads in namespace `ranges`.
|
| 4792 |
|
| 4793 |
*Complexity:* Exactly `last - first` applications of the corresponding
|
| 4794 |
predicate and any projection.
|
|
@@ -4817,90 +6445,150 @@ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
|
| 4817 |
replace_copy_if(ExecutionPolicy&& exec,
|
| 4818 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 4819 |
ForwardIterator2 result,
|
| 4820 |
Predicate pred, const T& new_value);
|
| 4821 |
|
| 4822 |
-
template<input_iterator I, sentinel_for<I> S, class
|
| 4823 |
-
class Proj = identity>
|
| 4824 |
requires indirectly_copyable<I, O> &&
|
| 4825 |
-
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
|
|
|
| 4826 |
constexpr ranges::replace_copy_result<I, O>
|
| 4827 |
ranges::replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
|
| 4828 |
Proj proj = {});
|
| 4829 |
-
template<input_range R, class
|
| 4830 |
-
class Proj =
|
| 4831 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 4832 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
|
|
|
|
| 4833 |
constexpr ranges::replace_copy_result<borrowed_iterator_t<R>, O>
|
| 4834 |
ranges::replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
|
| 4835 |
Proj proj = {});
|
| 4836 |
|
| 4837 |
-
template<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4838 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4839 |
-
requires indirectly_copyable<I, O>
|
| 4840 |
constexpr ranges::replace_copy_if_result<I, O>
|
| 4841 |
ranges::replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
|
| 4842 |
Proj proj = {});
|
| 4843 |
-
template<input_range R, class
|
| 4844 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4845 |
-
requires indirectly_copyable<iterator_t<R>, O>
|
| 4846 |
constexpr ranges::replace_copy_if_result<borrowed_iterator_t<R>, O>
|
| 4847 |
ranges::replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
|
| 4848 |
Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4849 |
```
|
| 4850 |
|
| 4851 |
-
Let E be
|
| 4852 |
|
| 4853 |
- `bool(*(first + (i - result)) == old_value)` for `replace_copy`;
|
| 4854 |
- `bool(pred(*(first + (i - result))))` for `replace_copy_if`;
|
| 4855 |
- `bool(invoke(proj, *(first + (i - result))) == old_value)` for
|
| 4856 |
`ranges::replace_copy`;
|
| 4857 |
- `bool(invoke(pred, invoke(proj, *(first + (i - result)))))` for
|
| 4858 |
`ranges::replace_copy_if`.
|
| 4859 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4860 |
*Mandates:* The results of the expressions `*first` and `new_value` are
|
| 4861 |
writable [[iterator.requirements.general]] to `result`.
|
| 4862 |
|
| 4863 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 4864 |
-
`result +
|
| 4865 |
|
| 4866 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 4867 |
-
`result +
|
| 4868 |
|
| 4869 |
-
- `new_value` if E is `true` or
|
| 4870 |
- `*(first + (i - result))` otherwise.
|
| 4871 |
|
| 4872 |
*Returns:*
|
| 4873 |
|
| 4874 |
-
- `result +
|
| 4875 |
-
- `{
|
| 4876 |
-
`ranges`.
|
| 4877 |
|
| 4878 |
-
*Complexity:* Exactly
|
| 4879 |
-
|
| 4880 |
|
| 4881 |
### Fill <a id="alg.fill">[[alg.fill]]</a>
|
| 4882 |
|
| 4883 |
``` cpp
|
| 4884 |
-
template<class ForwardIterator, class T>
|
| 4885 |
constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value);
|
| 4886 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 4887 |
void fill(ExecutionPolicy&& exec,
|
| 4888 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 4889 |
|
| 4890 |
-
template<class OutputIterator, class Size, class T>
|
| 4891 |
constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value);
|
| 4892 |
-
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
|
|
|
| 4893 |
ForwardIterator fill_n(ExecutionPolicy&& exec,
|
| 4894 |
ForwardIterator first, Size n, const T& value);
|
| 4895 |
|
| 4896 |
-
template<class
|
|
|
|
| 4897 |
constexpr O ranges::fill(O first, S last, const T& value);
|
| 4898 |
-
template<class
|
|
|
|
| 4899 |
constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);
|
| 4900 |
-
template<class
|
|
|
|
| 4901 |
constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4902 |
```
|
| 4903 |
|
| 4904 |
Let N be max(0, `n`) for the `fill_n` algorithms, and `last - first` for
|
| 4905 |
the `fill` algorithms.
|
| 4906 |
|
|
@@ -4940,10 +6628,21 @@ template<class R, copy_constructible F>
|
|
| 4940 |
requires invocable<F&> && output_range<R, invoke_result_t<F&>>
|
| 4941 |
constexpr borrowed_iterator_t<R> ranges::generate(R&& r, F gen);
|
| 4942 |
template<input_or_output_iterator O, copy_constructible F>
|
| 4943 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 4944 |
constexpr O ranges::generate_n(O first, iter_difference_t<O> n, F gen);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4945 |
```
|
| 4946 |
|
| 4947 |
Let N be max(0, `n`) for the `generate_n` algorithms, and `last - first`
|
| 4948 |
for the `generate` algorithms.
|
| 4949 |
|
|
@@ -4955,17 +6654,21 @@ through each iterator in the range \[`first`, `first + `N).
|
|
| 4955 |
|
| 4956 |
*Returns:* `first + `N.
|
| 4957 |
|
| 4958 |
*Complexity:* Exactly N evaluations of `gen()` and assignments.
|
| 4959 |
|
|
|
|
|
|
|
|
|
|
| 4960 |
### Remove <a id="alg.remove">[[alg.remove]]</a>
|
| 4961 |
|
| 4962 |
``` cpp
|
| 4963 |
-
template<class ForwardIterator, class T>
|
| 4964 |
constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last,
|
| 4965 |
const T& value);
|
| 4966 |
-
template<class ExecutionPolicy, class ForwardIterator,
|
|
|
|
| 4967 |
ForwardIterator remove(ExecutionPolicy&& exec,
|
| 4968 |
ForwardIterator first, ForwardIterator last,
|
| 4969 |
const T& value);
|
| 4970 |
|
| 4971 |
template<class ForwardIterator, class Predicate>
|
|
@@ -4974,26 +6677,52 @@ template<class ForwardIterator, class Predicate>
|
|
| 4974 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 4975 |
ForwardIterator remove_if(ExecutionPolicy&& exec,
|
| 4976 |
ForwardIterator first, ForwardIterator last,
|
| 4977 |
Predicate pred);
|
| 4978 |
|
| 4979 |
-
template<permutable I, sentinel_for<I> S, class
|
|
|
|
| 4980 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4981 |
constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});
|
| 4982 |
-
template<forward_range R, class
|
|
|
|
| 4983 |
requires permutable<iterator_t<R>> &&
|
| 4984 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4985 |
constexpr borrowed_subrange_t<R>
|
| 4986 |
ranges::remove(R&& r, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4987 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 4988 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4989 |
constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});
|
| 4990 |
template<forward_range R, class Proj = identity,
|
| 4991 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4992 |
requires permutable<iterator_t<R>>
|
| 4993 |
constexpr borrowed_subrange_t<R>
|
| 4994 |
ranges::remove_if(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4995 |
```
|
| 4996 |
|
| 4997 |
Let E be
|
| 4998 |
|
| 4999 |
- `bool(*i == value)` for `remove`;
|
|
@@ -5022,16 +6751,17 @@ predicate and any projection.
|
|
| 5022 |
the returned value, has a valid but unspecified state, because the
|
| 5023 |
algorithms can eliminate elements by moving from elements that were
|
| 5024 |
originally in that range. — *end note*]
|
| 5025 |
|
| 5026 |
``` cpp
|
| 5027 |
-
template<class InputIterator, class OutputIterator,
|
|
|
|
| 5028 |
constexpr OutputIterator
|
| 5029 |
remove_copy(InputIterator first, InputIterator last,
|
| 5030 |
OutputIterator result, const T& value);
|
| 5031 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 5032 |
-
class T>
|
| 5033 |
ForwardIterator2
|
| 5034 |
remove_copy(ExecutionPolicy&& exec,
|
| 5035 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 5036 |
ForwardIterator2 result, const T& value);
|
| 5037 |
|
|
@@ -5044,63 +6774,109 @@ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
|
| 5044 |
ForwardIterator2
|
| 5045 |
remove_copy_if(ExecutionPolicy&& exec,
|
| 5046 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 5047 |
ForwardIterator2 result, Predicate pred);
|
| 5048 |
|
| 5049 |
-
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 5050 |
-
class Proj = identity>
|
| 5051 |
requires indirectly_copyable<I, O> &&
|
| 5052 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 5053 |
constexpr ranges::remove_copy_result<I, O>
|
| 5054 |
ranges::remove_copy(I first, S last, O result, const T& value, Proj proj = {});
|
| 5055 |
-
template<input_range R, weakly_incrementable O, class
|
|
|
|
| 5056 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 5057 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 5058 |
constexpr ranges::remove_copy_result<borrowed_iterator_t<R>, O>
|
| 5059 |
ranges::remove_copy(R&& r, O result, const T& value, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5060 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 5061 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 5062 |
requires indirectly_copyable<I, O>
|
| 5063 |
constexpr ranges::remove_copy_if_result<I, O>
|
| 5064 |
ranges::remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});
|
| 5065 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 5066 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 5067 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 5068 |
constexpr ranges::remove_copy_if_result<borrowed_iterator_t<R>, O>
|
| 5069 |
ranges::remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5070 |
```
|
| 5071 |
|
| 5072 |
-
Let E be
|
| 5073 |
|
| 5074 |
- `bool(*i == value)` for `remove_copy`;
|
| 5075 |
- `bool(pred(*i))` for `remove_copy_if`;
|
| 5076 |
- `bool(invoke(proj, *i) == value)` for `ranges::remove_copy`;
|
| 5077 |
- `bool(invoke(pred, invoke(proj, *i)))` for `ranges::remove_copy_if`.
|
| 5078 |
|
| 5079 |
-
Let
|
| 5080 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5081 |
|
| 5082 |
*Mandates:* `*first` is writable [[iterator.requirements.general]] to
|
| 5083 |
`result`.
|
| 5084 |
|
| 5085 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 5086 |
-
`result +
|
| 5087 |
|
| 5088 |
-
[*Note 2*: For the overloads
|
| 5089 |
-
a performance cost if
|
| 5090 |
-
does not meet the
|
| 5091 |
-
([[cpp17.moveconstructible]]) requirements.
|
|
|
|
|
|
|
|
|
|
| 5092 |
|
| 5093 |
-
*Effects:* Copies
|
| 5094 |
-
the range \[`first`, `last`) for which E is `false`
|
|
|
|
| 5095 |
|
| 5096 |
*Returns:*
|
| 5097 |
|
| 5098 |
- `result + `N, for the algorithms in namespace `std`.
|
| 5099 |
-
- `{last, result + `N`}`, for the algorithms in namespace `ranges`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5100 |
|
| 5101 |
-
*Complexity:*
|
| 5102 |
predicate and any projection.
|
| 5103 |
|
| 5104 |
*Remarks:* Stable [[algorithm.stable]].
|
| 5105 |
|
| 5106 |
### Unique <a id="alg.unique">[[alg.unique]]</a>
|
|
@@ -5126,10 +6902,20 @@ template<permutable I, sentinel_for<I> S, class Proj = identity,
|
|
| 5126 |
template<forward_range R, class Proj = identity,
|
| 5127 |
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 5128 |
requires permutable<iterator_t<R>>
|
| 5129 |
constexpr borrowed_subrange_t<R>
|
| 5130 |
ranges::unique(R&& r, C comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5131 |
```
|
| 5132 |
|
| 5133 |
Let `pred` be `equal_to{}` for the overloads with no parameter `pred`,
|
| 5134 |
and let E be
|
| 5135 |
|
|
@@ -5191,52 +6977,83 @@ template<input_range R, weakly_incrementable O, class Proj = identity,
|
|
| 5191 |
(forward_iterator<iterator_t<R>> ||
|
| 5192 |
(input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
|
| 5193 |
indirectly_copyable_storable<iterator_t<R>, O>)
|
| 5194 |
constexpr ranges::unique_copy_result<borrowed_iterator_t<R>, O>
|
| 5195 |
ranges::unique_copy(R&& r, O result, C comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5196 |
```
|
| 5197 |
|
| 5198 |
Let `pred` be `equal_to{}` for the overloads in namespace `std` with no
|
| 5199 |
-
parameter `pred`, and let E be
|
| 5200 |
|
| 5201 |
- `bool(pred(*i, *(i - 1)))` for the overloads in namespace `std`;
|
| 5202 |
- `bool(invoke(comp, invoke(proj, *i), invoke(proj, *(i - 1))))` for the
|
| 5203 |
overloads in namespace `ranges`.
|
| 5204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5205 |
*Mandates:* `*first` is writable [[iterator.requirements.general]] to
|
| 5206 |
`result`.
|
| 5207 |
|
| 5208 |
*Preconditions:*
|
| 5209 |
|
| 5210 |
-
- The ranges \[`first`, `last`) and \[`result`, `result+
|
| 5211 |
-
|
| 5212 |
- For the overloads in namespace `std`:
|
| 5213 |
- The comparison function is an equivalence relation.
|
| 5214 |
- For the overloads with no `ExecutionPolicy`, let `T` be the value
|
| 5215 |
type of `InputIterator`. If `InputIterator` models
|
| 5216 |
`forward_iterator` [[iterator.concept.forward]], then there are no
|
| 5217 |
additional requirements for `T`. Otherwise, if `OutputIterator`
|
| 5218 |
meets the *Cpp17ForwardIterator* requirements and its value type is
|
| 5219 |
the same as `T`, then `T` meets the *Cpp17CopyAssignable*
|
| 5220 |
([[cpp17.copyassignable]]) requirements. Otherwise, `T` meets both
|
| 5221 |
the *Cpp17CopyConstructible* ([[cpp17.copyconstructible]]) and
|
| 5222 |
-
*Cpp17CopyAssignable* requirements.
|
| 5223 |
-
with an `ExecutionPolicy`, there might be a performance cost if the
|
| 5224 |
-
value type of `ForwardIterator1` does not meet both the
|
| 5225 |
-
*Cpp17CopyConstructible* and *Cpp17CopyAssignable*
|
| 5226 |
-
requirements. — *end note*]
|
| 5227 |
|
| 5228 |
-
*
|
| 5229 |
-
|
| 5230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5231 |
|
| 5232 |
*Returns:*
|
| 5233 |
|
| 5234 |
- `result + `N for the overloads in namespace `std`.
|
| 5235 |
-
- `{last, result + `N`}` for the overloads in namespace `ranges`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5236 |
|
| 5237 |
-
*Complexity:*
|
| 5238 |
corresponding predicate and no more than twice as many applications of
|
| 5239 |
any projection.
|
| 5240 |
|
| 5241 |
### Reverse <a id="alg.reverse">[[alg.reverse]]</a>
|
| 5242 |
|
|
@@ -5251,10 +7068,17 @@ template<bidirectional_iterator I, sentinel_for<I> S>
|
|
| 5251 |
requires permutable<I>
|
| 5252 |
constexpr I ranges::reverse(I first, S last);
|
| 5253 |
template<bidirectional_range R>
|
| 5254 |
requires permutable<iterator_t<R>>
|
| 5255 |
constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5256 |
```
|
| 5257 |
|
| 5258 |
*Preconditions:* For the overloads in namespace `std`,
|
| 5259 |
`BidirectionalIterator` meets the *Cpp17ValueSwappable*
|
| 5260 |
requirements [[swappable.requirements]].
|
|
@@ -5304,10 +7128,38 @@ following assignment takes place:
|
|
| 5304 |
- `result + `N for the overloads in namespace `std`.
|
| 5305 |
- `{last, result + `N`}` for the overloads in namespace `ranges`.
|
| 5306 |
|
| 5307 |
*Complexity:* Exactly N assignments.
|
| 5308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5309 |
### Rotate <a id="alg.rotate">[[alg.rotate]]</a>
|
| 5310 |
|
| 5311 |
``` cpp
|
| 5312 |
template<class ForwardIterator>
|
| 5313 |
constexpr ForwardIterator
|
|
@@ -5317,10 +7169,13 @@ template<class ExecutionPolicy, class ForwardIterator>
|
|
| 5317 |
rotate(ExecutionPolicy&& exec,
|
| 5318 |
ForwardIterator first, ForwardIterator middle, ForwardIterator last);
|
| 5319 |
|
| 5320 |
template<permutable I, sentinel_for<I> S>
|
| 5321 |
constexpr subrange<I> ranges::rotate(I first, I middle, S last);
|
|
|
|
|
|
|
|
|
|
| 5322 |
```
|
| 5323 |
|
| 5324 |
*Preconditions:* \[`first`, `middle`) and \[`middle`, `last`) are valid
|
| 5325 |
ranges. For the overloads in namespace `std`, `ForwardIterator` meets
|
| 5326 |
the *Cpp17ValueSwappable* requirements [[swappable.requirements]], and
|
|
@@ -5349,10 +7204,22 @@ template<forward_range R>
|
|
| 5349 |
```
|
| 5350 |
|
| 5351 |
*Effects:* Equivalent to:
|
| 5352 |
`return ranges::rotate(ranges::begin(r), middle, ranges::end(r));`
|
| 5353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5354 |
``` cpp
|
| 5355 |
template<class ForwardIterator, class OutputIterator>
|
| 5356 |
constexpr OutputIterator
|
| 5357 |
rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last,
|
| 5358 |
OutputIterator result);
|
|
@@ -5384,10 +7251,38 @@ following assignment takes place:
|
|
| 5384 |
- `result + `N for the overloads in namespace `std`.
|
| 5385 |
- `{last, result + `N`}` for the overload in namespace `ranges`.
|
| 5386 |
|
| 5387 |
*Complexity:* Exactly N assignments.
|
| 5388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5389 |
``` cpp
|
| 5390 |
template<forward_range R, weakly_incrementable O>
|
| 5391 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 5392 |
constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
|
| 5393 |
ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);
|
|
@@ -5397,10 +7292,24 @@ template<forward_range R, weakly_incrementable O>
|
|
| 5397 |
|
| 5398 |
``` cpp
|
| 5399 |
return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), std::move(result));
|
| 5400 |
```
|
| 5401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5402 |
### Sample <a id="alg.random.sample">[[alg.random.sample]]</a>
|
| 5403 |
|
| 5404 |
``` cpp
|
| 5405 |
template<class PopulationIterator, class SampleIterator,
|
| 5406 |
class Distance, class UniformRandomBitGenerator>
|
|
@@ -5509,26 +7418,34 @@ template<class ExecutionPolicy, class ForwardIterator>
|
|
| 5509 |
|
| 5510 |
template<permutable I, sentinel_for<I> S>
|
| 5511 |
constexpr subrange<I> ranges::shift_left(I first, S last, iter_difference_t<I> n);
|
| 5512 |
template<forward_range R>
|
| 5513 |
requires permutable<iterator_t<R>>
|
| 5514 |
-
constexpr borrowed_subrange_t<R> ranges::shift_left(R&& r, range_difference_t<R> n)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5515 |
```
|
| 5516 |
|
| 5517 |
*Preconditions:* `n >= 0` is `true`. For the overloads in namespace
|
| 5518 |
`std`, the type of `*first` meets the *Cpp17MoveAssignable*
|
| 5519 |
requirements.
|
| 5520 |
|
| 5521 |
*Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
|
| 5522 |
moves the element from position `first + n + i` into position
|
| 5523 |
`first + i` for each non-negative integer `i < (last - first) - n`. For
|
| 5524 |
-
the
|
| 5525 |
-
|
| 5526 |
-
`i = (last - first) - n - 1`.
|
| 5527 |
|
| 5528 |
*Returns:* Let *NEW_LAST* be `first + (last - first - n)` if
|
| 5529 |
-
`n < last - first`, otherwise `first`.
|
| 5530 |
|
| 5531 |
- *NEW_LAST* for the overloads in namespace `std`.
|
| 5532 |
- `{first, `*`NEW_LAST`*`}` for the overloads in namespace `ranges`.
|
| 5533 |
|
| 5534 |
*Complexity:* At most `(last - first) - n` assignments.
|
|
@@ -5546,10 +7463,19 @@ template<class ExecutionPolicy, class ForwardIterator>
|
|
| 5546 |
template<permutable I, sentinel_for<I> S>
|
| 5547 |
constexpr subrange<I> ranges::shift_right(I first, S last, iter_difference_t<I> n);
|
| 5548 |
template<forward_range R>
|
| 5549 |
requires permutable<iterator_t<R>>
|
| 5550 |
constexpr borrowed_subrange_t<R> ranges::shift_right(R&& r, range_difference_t<R> n);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5551 |
```
|
| 5552 |
|
| 5553 |
*Preconditions:* `n >= 0` is `true`. For the overloads in namespace
|
| 5554 |
`std`, the type of `*first` meets the *Cpp17MoveAssignable*
|
| 5555 |
requirements, and `ForwardIterator` meets the
|
|
@@ -5558,20 +7484,19 @@ the *Cpp17ValueSwappable* requirements.
|
|
| 5558 |
|
| 5559 |
*Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
|
| 5560 |
moves the element from position `first + i` into position
|
| 5561 |
`first + n + i` for each non-negative integer `i < (last - first) - n`.
|
| 5562 |
Does so in order starting from `i = (last - first) - n - 1` and
|
| 5563 |
-
proceeding to `i = 0` if
|
| 5564 |
|
| 5565 |
-
- for the overload in namespace `std`
|
| 5566 |
-
|
| 5567 |
-
|
| 5568 |
-
|
| 5569 |
-
`bidirectional_iterator`.
|
| 5570 |
|
| 5571 |
*Returns:* Let *NEW_FIRST* be `first + n` if `n < last - first`,
|
| 5572 |
-
otherwise `last`.
|
| 5573 |
|
| 5574 |
- *NEW_FIRST* for the overloads in namespace `std`.
|
| 5575 |
- `{`*`NEW_FIRST`*`, last}` for the overloads in namespace `ranges`.
|
| 5576 |
|
| 5577 |
*Complexity:* At most `(last - first) - n` assignments or swaps.
|
|
@@ -5672,10 +7597,19 @@ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
| 5672 |
ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 5673 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 5674 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 5675 |
constexpr borrowed_iterator_t<R>
|
| 5676 |
ranges::sort(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5677 |
```
|
| 5678 |
|
| 5679 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 5680 |
no parameters by those names.
|
| 5681 |
|
|
@@ -5695,31 +7629,41 @@ projections.
|
|
| 5695 |
|
| 5696 |
#### `stable_sort` <a id="stable.sort">[[stable.sort]]</a>
|
| 5697 |
|
| 5698 |
``` cpp
|
| 5699 |
template<class RandomAccessIterator>
|
| 5700 |
-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
|
| 5701 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 5702 |
void stable_sort(ExecutionPolicy&& exec,
|
| 5703 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 5704 |
|
| 5705 |
template<class RandomAccessIterator, class Compare>
|
| 5706 |
-
void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
|
| 5707 |
Compare comp);
|
| 5708 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 5709 |
void stable_sort(ExecutionPolicy&& exec,
|
| 5710 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 5711 |
Compare comp);
|
| 5712 |
|
| 5713 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 5714 |
class Proj = identity>
|
| 5715 |
requires sortable<I, Comp, Proj>
|
| 5716 |
-
I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 5717 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 5718 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 5719 |
-
borrowed_iterator_t<R>
|
| 5720 |
ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5721 |
```
|
| 5722 |
|
| 5723 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 5724 |
no parameters by those names.
|
| 5725 |
|
|
@@ -5769,10 +7713,14 @@ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
|
| 5769 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 5770 |
class Proj = identity>
|
| 5771 |
requires sortable<I, Comp, Proj>
|
| 5772 |
constexpr I
|
| 5773 |
ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5774 |
```
|
| 5775 |
|
| 5776 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 5777 |
no parameters by those names.
|
| 5778 |
|
|
@@ -5804,10 +7752,26 @@ template<random_access_range R, class Comp = ranges::less, class Proj = identity
|
|
| 5804 |
|
| 5805 |
``` cpp
|
| 5806 |
return ranges::partial_sort(ranges::begin(r), middle, ranges::end(r), comp, proj);
|
| 5807 |
```
|
| 5808 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5809 |
#### `partial_sort_copy` <a id="partial.sort.copy">[[partial.sort.copy]]</a>
|
| 5810 |
|
| 5811 |
``` cpp
|
| 5812 |
template<class InputIterator, class RandomAccessIterator>
|
| 5813 |
constexpr RandomAccessIterator
|
|
@@ -5851,10 +7815,29 @@ template<input_range R1, random_access_range R2, class Comp = ranges::less,
|
|
| 5851 |
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 5852 |
projected<iterator_t<R2>, Proj2>>
|
| 5853 |
constexpr ranges::partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 5854 |
ranges::partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
|
| 5855 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5856 |
```
|
| 5857 |
|
| 5858 |
Let N be min(`last - first`, `result_last - result_first`). Let `comp`
|
| 5859 |
be `less{}`, and `proj1` and `proj2` be `identity{}` for the overloads
|
| 5860 |
with no parameters by those names.
|
|
@@ -5951,10 +7934,26 @@ template<forward_range R, class Proj = identity,
|
|
| 5951 |
```
|
| 5952 |
|
| 5953 |
*Effects:* Equivalent to:
|
| 5954 |
`return ranges::is_sorted_until(first, last, comp, proj) == last;`
|
| 5955 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5956 |
``` cpp
|
| 5957 |
template<class ForwardIterator>
|
| 5958 |
constexpr ForwardIterator
|
| 5959 |
is_sorted_until(ForwardIterator first, ForwardIterator last);
|
| 5960 |
template<class ExecutionPolicy, class ForwardIterator>
|
|
@@ -5977,10 +7976,20 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 5977 |
constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 5978 |
template<forward_range R, class Proj = identity,
|
| 5979 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 5980 |
constexpr borrowed_iterator_t<R>
|
| 5981 |
ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5982 |
```
|
| 5983 |
|
| 5984 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 5985 |
no parameters by those names.
|
| 5986 |
|
|
@@ -6011,10 +8020,14 @@ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
|
| 6011 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 6012 |
class Proj = identity>
|
| 6013 |
requires sortable<I, Comp, Proj>
|
| 6014 |
constexpr I
|
| 6015 |
ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6016 |
```
|
| 6017 |
|
| 6018 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 6019 |
no parameters by those names.
|
| 6020 |
|
|
@@ -6032,13 +8045,13 @@ Also for every iterator `i` in the range \[`first`, `nth`) and every
|
|
| 6032 |
iterator `j` in the range \[`nth`, `last`) it holds that:
|
| 6033 |
`bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))` is `false`.
|
| 6034 |
|
| 6035 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 6036 |
|
| 6037 |
-
*Complexity:* For the
|
| 6038 |
-
average. For the
|
| 6039 |
-
|
| 6040 |
|
| 6041 |
``` cpp
|
| 6042 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 6043 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 6044 |
constexpr borrowed_iterator_t<R>
|
|
@@ -6049,10 +8062,25 @@ template<random_access_range R, class Comp = ranges::less, class Proj = identity
|
|
| 6049 |
|
| 6050 |
``` cpp
|
| 6051 |
return ranges::nth_element(ranges::begin(r), nth, ranges::end(r), comp, proj);
|
| 6052 |
```
|
| 6053 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6054 |
### Binary search <a id="alg.binary.search">[[alg.binary.search]]</a>
|
| 6055 |
|
| 6056 |
#### General <a id="alg.binary.search.general">[[alg.binary.search.general]]</a>
|
| 6057 |
|
| 6058 |
All of the algorithms in [[alg.binary.search]] are versions of binary
|
|
@@ -6066,25 +8094,28 @@ through the data structure. For non-random access iterators they execute
|
|
| 6066 |
a linear number of steps.
|
| 6067 |
|
| 6068 |
#### `lower_bound` <a id="lower.bound">[[lower.bound]]</a>
|
| 6069 |
|
| 6070 |
``` cpp
|
| 6071 |
-
template<class ForwardIterator, class T>
|
| 6072 |
constexpr ForwardIterator
|
| 6073 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 6074 |
const T& value);
|
| 6075 |
|
| 6076 |
-
template<class ForwardIterator, class T
|
|
|
|
| 6077 |
constexpr ForwardIterator
|
| 6078 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 6079 |
const T& value, Compare comp);
|
| 6080 |
|
| 6081 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 6082 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 6083 |
constexpr I ranges::lower_bound(I first, S last, const T& value, Comp comp = {},
|
| 6084 |
Proj proj = {});
|
| 6085 |
-
template<forward_range R, class
|
|
|
|
| 6086 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 6087 |
ranges::less>
|
| 6088 |
constexpr borrowed_iterator_t<R>
|
| 6089 |
ranges::lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 6090 |
```
|
|
@@ -6104,24 +8135,27 @@ such that for every iterator `j` in the range \[`first`, `i`),
|
|
| 6104 |
projections.
|
| 6105 |
|
| 6106 |
#### `upper_bound` <a id="upper.bound">[[upper.bound]]</a>
|
| 6107 |
|
| 6108 |
``` cpp
|
| 6109 |
-
template<class ForwardIterator, class T>
|
| 6110 |
constexpr ForwardIterator
|
| 6111 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 6112 |
const T& value);
|
| 6113 |
|
| 6114 |
-
template<class ForwardIterator, class T
|
|
|
|
| 6115 |
constexpr ForwardIterator
|
| 6116 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 6117 |
const T& value, Compare comp);
|
| 6118 |
|
| 6119 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 6120 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 6121 |
constexpr I ranges::upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 6122 |
-
template<forward_range R, class
|
|
|
|
| 6123 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 6124 |
ranges::less>
|
| 6125 |
constexpr borrowed_iterator_t<R>
|
| 6126 |
ranges::upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 6127 |
```
|
|
@@ -6141,26 +8175,29 @@ such that for every iterator `j` in the range \[`first`, `i`),
|
|
| 6141 |
projections.
|
| 6142 |
|
| 6143 |
#### `equal_range` <a id="equal.range">[[equal.range]]</a>
|
| 6144 |
|
| 6145 |
``` cpp
|
| 6146 |
-
template<class ForwardIterator, class T>
|
| 6147 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 6148 |
equal_range(ForwardIterator first,
|
| 6149 |
ForwardIterator last, const T& value);
|
| 6150 |
|
| 6151 |
-
template<class ForwardIterator, class T
|
|
|
|
| 6152 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 6153 |
equal_range(ForwardIterator first,
|
| 6154 |
ForwardIterator last, const T& value,
|
| 6155 |
Compare comp);
|
| 6156 |
|
| 6157 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 6158 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 6159 |
constexpr subrange<I>
|
| 6160 |
ranges::equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 6161 |
-
template<forward_range R, class
|
|
|
|
| 6162 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 6163 |
ranges::less>
|
| 6164 |
constexpr borrowed_subrange_t<R>
|
| 6165 |
ranges::equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 6166 |
```
|
|
@@ -6170,11 +8207,11 @@ parameters by those names.
|
|
| 6170 |
|
| 6171 |
*Preconditions:* The elements `e` of \[`first`, `last`) are partitioned
|
| 6172 |
with respect to the expressions
|
| 6173 |
`bool(invoke(comp, invoke(proj, e), value))` and
|
| 6174 |
`!bool(invoke(comp, value, invoke(proj, e)))`. Also, for all elements
|
| 6175 |
-
`e` of
|
| 6176 |
`!bool(comp(value, e))` for the overloads in namespace `std`.
|
| 6177 |
|
| 6178 |
*Returns:*
|
| 6179 |
|
| 6180 |
- For the overloads in namespace `std`:
|
|
@@ -6192,25 +8229,28 @@ with respect to the expressions
|
|
| 6192 |
projections.
|
| 6193 |
|
| 6194 |
#### `binary_search` <a id="binary.search">[[binary.search]]</a>
|
| 6195 |
|
| 6196 |
``` cpp
|
| 6197 |
-
template<class ForwardIterator, class T>
|
| 6198 |
constexpr bool
|
| 6199 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 6200 |
const T& value);
|
| 6201 |
|
| 6202 |
-
template<class ForwardIterator, class T
|
|
|
|
| 6203 |
constexpr bool
|
| 6204 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 6205 |
const T& value, Compare comp);
|
| 6206 |
|
| 6207 |
-
template<forward_iterator I, sentinel_for<I> S, class
|
|
|
|
| 6208 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 6209 |
constexpr bool ranges::binary_search(I first, S last, const T& value, Comp comp = {},
|
| 6210 |
Proj proj = {});
|
| 6211 |
-
template<forward_range R, class
|
|
|
|
| 6212 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 6213 |
ranges::less>
|
| 6214 |
constexpr bool ranges::binary_search(R&& r, const T& value, Comp comp = {},
|
| 6215 |
Proj proj = {});
|
| 6216 |
```
|
|
@@ -6220,11 +8260,11 @@ parameters by those names.
|
|
| 6220 |
|
| 6221 |
*Preconditions:* The elements `e` of \[`first`, `last`) are partitioned
|
| 6222 |
with respect to the expressions
|
| 6223 |
`bool(invoke(comp, invoke(proj, e), value))` and
|
| 6224 |
`!bool(invoke(comp, value, invoke(proj, e)))`. Also, for all elements
|
| 6225 |
-
`e` of
|
| 6226 |
`!bool(comp(value, e))` for the overloads in namespace `std`.
|
| 6227 |
|
| 6228 |
*Returns:* `true` if and only if for some iterator `i` in the range
|
| 6229 |
\[`first`, `last`),
|
| 6230 |
`!bool(invoke(comp, invoke(proj, *i), value)) && !bool(invoke(comp, value, invoke(proj, *i)))`
|
|
@@ -6246,10 +8286,17 @@ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 6246 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6247 |
constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});
|
| 6248 |
template<input_range R, class Proj = identity,
|
| 6249 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6250 |
constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6251 |
```
|
| 6252 |
|
| 6253 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 6254 |
`proj`.
|
| 6255 |
|
|
@@ -6264,22 +8311,29 @@ are partitioned with respect to the expression
|
|
| 6264 |
template<class ForwardIterator, class Predicate>
|
| 6265 |
constexpr ForwardIterator
|
| 6266 |
partition(ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 6267 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 6268 |
ForwardIterator
|
| 6269 |
-
partition(ExecutionPolicy&& exec,
|
| 6270 |
-
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 6271 |
|
| 6272 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 6273 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6274 |
constexpr subrange<I>
|
| 6275 |
ranges::partition(I first, S last, Pred pred, Proj proj = {});
|
| 6276 |
template<forward_range R, class Proj = identity,
|
| 6277 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6278 |
requires permutable<iterator_t<R>>
|
| 6279 |
constexpr borrowed_subrange_t<R>
|
| 6280 |
ranges::partition(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6281 |
```
|
| 6282 |
|
| 6283 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 6284 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 6285 |
|
|
@@ -6296,35 +8350,47 @@ iterator `j` in \[`first`, `i`) and `false` for every iterator `j` in
|
|
| 6296 |
- `i` for the overloads in namespace `std`.
|
| 6297 |
- `{i, last}` for the overloads in namespace `ranges`.
|
| 6298 |
|
| 6299 |
*Complexity:* Let N = `last - first`:
|
| 6300 |
|
| 6301 |
-
- For the
|
| 6302 |
the predicate and projection. At most N / 2 swaps if the type of
|
| 6303 |
`first` meets the *Cpp17BidirectionalIterator* requirements for the
|
| 6304 |
overloads in namespace `std` or models `bidirectional_iterator` for
|
| 6305 |
the overloads in namespace `ranges`, and at most N swaps otherwise.
|
| 6306 |
-
- For the
|
| 6307 |
applications of the predicate.
|
| 6308 |
|
| 6309 |
``` cpp
|
| 6310 |
template<class BidirectionalIterator, class Predicate>
|
| 6311 |
BidirectionalIterator
|
| 6312 |
-
stable_partition(BidirectionalIterator first, BidirectionalIterator last,
|
|
|
|
| 6313 |
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
|
| 6314 |
BidirectionalIterator
|
| 6315 |
stable_partition(ExecutionPolicy&& exec,
|
| 6316 |
BidirectionalIterator first, BidirectionalIterator last, Predicate pred);
|
| 6317 |
|
| 6318 |
template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 6319 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6320 |
requires permutable<I>
|
| 6321 |
-
subrange<I> ranges::stable_partition(I first, S last, Pred pred, Proj proj = {});
|
| 6322 |
template<bidirectional_range R, class Proj = identity,
|
| 6323 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6324 |
requires permutable<iterator_t<R>>
|
| 6325 |
-
borrowed_subrange_t<R> ranges::stable_partition(R&& r, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6326 |
```
|
| 6327 |
|
| 6328 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 6329 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 6330 |
|
|
@@ -6345,14 +8411,14 @@ range \[`i`, `last`), E(`*j`) is `false`. Returns:
|
|
| 6345 |
- `i` for the overloads in namespace `std`.
|
| 6346 |
- `{i, last}` for the overloads in namespace `ranges`.
|
| 6347 |
|
| 6348 |
*Complexity:* Let N = `last - first`:
|
| 6349 |
|
| 6350 |
-
- For the
|
| 6351 |
-
|
| 6352 |
applications of the predicate and projection.
|
| 6353 |
-
- For the
|
| 6354 |
applications of the predicate.
|
| 6355 |
|
| 6356 |
``` cpp
|
| 6357 |
template<class InputIterator, class OutputIterator1, class OutputIterator2, class Predicate>
|
| 6358 |
constexpr pair<OutputIterator1, OutputIterator2>
|
|
@@ -6376,37 +8442,80 @@ template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
|
|
| 6376 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6377 |
requires indirectly_copyable<iterator_t<R>, O1> &&
|
| 6378 |
indirectly_copyable<iterator_t<R>, O2>
|
| 6379 |
constexpr ranges::partition_copy_result<borrowed_iterator_t<R>, O1, O2>
|
| 6380 |
ranges::partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6381 |
```
|
| 6382 |
|
| 6383 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 6384 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 6385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6386 |
*Mandates:* For the overloads in namespace `std`, the expression
|
| 6387 |
`*first` is writable [[iterator.requirements.general]] to `out_true` and
|
| 6388 |
`out_false`.
|
| 6389 |
|
| 6390 |
*Preconditions:* The input range and output ranges do not overlap.
|
| 6391 |
|
| 6392 |
-
[*Note 1*: For the overload
|
| 6393 |
-
performance cost if `first`’s value type does not meet
|
| 6394 |
-
*Cpp17CopyConstructible* requirements.
|
|
|
|
|
|
|
| 6395 |
|
| 6396 |
-
*Effects:* For each iterator `i` in \[`first`, `
|
| 6397 |
-
the output range
|
| 6398 |
-
the output range
|
| 6399 |
|
| 6400 |
-
*Returns:* Let `o1` be the
|
| 6401 |
-
`out_true`, and `o2`
|
| 6402 |
-
`out_false`
|
|
|
|
| 6403 |
|
| 6404 |
- `{o1, o2}` for the overloads in namespace `std`.
|
| 6405 |
-
- `{
|
| 6406 |
|
| 6407 |
-
*Complexity:*
|
| 6408 |
|
| 6409 |
``` cpp
|
| 6410 |
template<class ForwardIterator, class Predicate>
|
| 6411 |
constexpr ForwardIterator
|
| 6412 |
partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
|
|
@@ -6474,56 +8583,87 @@ template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ra
|
|
| 6474 |
class Proj1 = identity, class Proj2 = identity>
|
| 6475 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 6476 |
constexpr ranges::merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 6477 |
ranges::merge(R1&& r1, R2&& r2, O result,
|
| 6478 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6479 |
```
|
| 6480 |
|
| 6481 |
-
Let
|
| 6482 |
-
|
| 6483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6484 |
|
| 6485 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 6486 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 6487 |
respectively. The resulting range does not overlap with either of the
|
| 6488 |
original ranges.
|
| 6489 |
|
| 6490 |
-
*Effects:* Copies
|
| 6491 |
-
|
| 6492 |
-
`
|
| 6493 |
-
|
| 6494 |
-
|
| 6495 |
-
|
| 6496 |
-
|
| 6497 |
-
`bool(invoke(comp, invoke(proj2, e2), invoke(proj1, e1)))` is `true`.
|
| 6498 |
|
| 6499 |
*Returns:*
|
| 6500 |
|
| 6501 |
-
- `
|
| 6502 |
-
- `{
|
|
|
|
| 6503 |
|
| 6504 |
*Complexity:*
|
| 6505 |
|
| 6506 |
-
- For the
|
| 6507 |
and applications of each projection.
|
| 6508 |
-
- For the
|
|
|
|
| 6509 |
|
| 6510 |
*Remarks:* Stable [[algorithm.stable]].
|
| 6511 |
|
| 6512 |
``` cpp
|
| 6513 |
template<class BidirectionalIterator>
|
| 6514 |
-
void inplace_merge(BidirectionalIterator first,
|
| 6515 |
BidirectionalIterator middle,
|
| 6516 |
BidirectionalIterator last);
|
| 6517 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 6518 |
void inplace_merge(ExecutionPolicy&& exec,
|
| 6519 |
BidirectionalIterator first,
|
| 6520 |
BidirectionalIterator middle,
|
| 6521 |
BidirectionalIterator last);
|
| 6522 |
|
| 6523 |
template<class BidirectionalIterator, class Compare>
|
| 6524 |
-
void inplace_merge(BidirectionalIterator first,
|
| 6525 |
BidirectionalIterator middle,
|
| 6526 |
BidirectionalIterator last, Compare comp);
|
| 6527 |
template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
|
| 6528 |
void inplace_merge(ExecutionPolicy&& exec,
|
| 6529 |
BidirectionalIterator first,
|
|
@@ -6531,11 +8671,15 @@ template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
|
|
| 6531 |
BidirectionalIterator last, Compare comp);
|
| 6532 |
|
| 6533 |
template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 6534 |
class Proj = identity>
|
| 6535 |
requires sortable<I, Comp, Proj>
|
| 6536 |
-
I ranges::inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6537 |
```
|
| 6538 |
|
| 6539 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 6540 |
no parameters by those names.
|
| 6541 |
|
|
@@ -6553,31 +8697,47 @@ and `proj`.
|
|
| 6553 |
|
| 6554 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 6555 |
|
| 6556 |
*Complexity:* Let N = `last - first`:
|
| 6557 |
|
| 6558 |
-
- For the
|
| 6559 |
-
memory is available,
|
| 6560 |
- Otherwise, 𝑂(N log N) comparisons.
|
| 6561 |
|
| 6562 |
In either case, twice as many projections as comparisons.
|
| 6563 |
|
| 6564 |
*Remarks:* Stable [[algorithm.stable]].
|
| 6565 |
|
| 6566 |
``` cpp
|
| 6567 |
template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
|
| 6568 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 6569 |
-
borrowed_iterator_t<R>
|
| 6570 |
ranges::inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});
|
| 6571 |
```
|
| 6572 |
|
| 6573 |
*Effects:* Equivalent to:
|
| 6574 |
|
| 6575 |
``` cpp
|
| 6576 |
return ranges::inplace_merge(ranges::begin(r), middle, ranges::end(r), comp, proj);
|
| 6577 |
```
|
| 6578 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6579 |
### Set operations on sorted structures <a id="alg.set.operations">[[alg.set.operations]]</a>
|
| 6580 |
|
| 6581 |
#### General <a id="alg.set.operations.general">[[alg.set.operations.general]]</a>
|
| 6582 |
|
| 6583 |
Subclause [[alg.set.operations]] defines all the basic set operations on
|
|
@@ -6618,10 +8778,24 @@ template<input_range R1, input_range R2, class Proj1 = identity,
|
|
| 6618 |
class Proj2 = identity,
|
| 6619 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 6620 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 6621 |
constexpr bool ranges::includes(R1&& r1, R2&& r2, Comp comp = {},
|
| 6622 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6623 |
```
|
| 6624 |
|
| 6625 |
Let `comp` be `less{}`, `proj1` be `identity{}`, and `proj2` be
|
| 6626 |
`identity{}`, for the overloads with no parameters by those names.
|
| 6627 |
|
|
@@ -6679,29 +8853,58 @@ template<input_range R1, input_range R2, weakly_incrementable O,
|
|
| 6679 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 6680 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 6681 |
constexpr ranges::set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 6682 |
ranges::set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 6683 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6684 |
```
|
| 6685 |
|
| 6686 |
-
Let
|
| 6687 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6688 |
|
| 6689 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 6690 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 6691 |
respectively. The resulting range does not overlap with either of the
|
| 6692 |
original ranges.
|
| 6693 |
|
| 6694 |
-
*Effects:* Constructs a sorted union of
|
| 6695 |
-
|
| 6696 |
-
|
| 6697 |
|
| 6698 |
-
*Returns:*
|
| 6699 |
-
Returns
|
| 6700 |
|
| 6701 |
- `result_last` for the overloads in namespace `std`.
|
| 6702 |
-
- `{last1, last2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6703 |
|
| 6704 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 6705 |
comparisons and applications of each projection.
|
| 6706 |
|
| 6707 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
@@ -6753,29 +8956,58 @@ template<input_range R1, input_range R2, weakly_incrementable O,
|
|
| 6753 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 6754 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 6755 |
constexpr ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 6756 |
ranges::set_intersection(R1&& r1, R2&& r2, O result,
|
| 6757 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6758 |
```
|
| 6759 |
|
| 6760 |
-
Let
|
| 6761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6762 |
|
| 6763 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 6764 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 6765 |
respectively. The resulting range does not overlap with either of the
|
| 6766 |
original ranges.
|
| 6767 |
|
| 6768 |
-
*Effects:* Constructs a sorted intersection of
|
| 6769 |
ranges; that is, the set of elements that are present in both of the
|
| 6770 |
ranges.
|
| 6771 |
|
| 6772 |
-
*Returns:*
|
| 6773 |
-
Returns
|
| 6774 |
|
| 6775 |
- `result_last` for the overloads in namespace `std`.
|
| 6776 |
-
- `{last1, last2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6777 |
|
| 6778 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 6779 |
comparisons and applications of each projection.
|
| 6780 |
|
| 6781 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
@@ -6825,29 +9057,56 @@ template<input_range R1, input_range R2, weakly_incrementable O,
|
|
| 6825 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 6826 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 6827 |
constexpr ranges::set_difference_result<borrowed_iterator_t<R1>, O>
|
| 6828 |
ranges::set_difference(R1&& r1, R2&& r2, O result,
|
| 6829 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6830 |
```
|
| 6831 |
|
| 6832 |
-
Let
|
| 6833 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6834 |
|
| 6835 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 6836 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 6837 |
respectively. The resulting range does not overlap with either of the
|
| 6838 |
original ranges.
|
| 6839 |
|
| 6840 |
-
*Effects:* Copies
|
| 6841 |
-
|
| 6842 |
-
|
| 6843 |
|
| 6844 |
-
*Returns:*
|
| 6845 |
-
Returns
|
| 6846 |
|
| 6847 |
- `result_last` for the overloads in namespace `std`.
|
| 6848 |
-
- `{last1,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6849 |
|
| 6850 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 6851 |
comparisons and applications of each projection.
|
| 6852 |
|
| 6853 |
*Remarks:* If \[`first1`, `last1`) contains m elements that are
|
|
@@ -6899,31 +9158,62 @@ template<input_range R1, input_range R2, weakly_incrementable O,
|
|
| 6899 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 6900 |
constexpr ranges::set_symmetric_difference_result<borrowed_iterator_t<R1>,
|
| 6901 |
borrowed_iterator_t<R2>, O>
|
| 6902 |
ranges::set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 6903 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6904 |
```
|
| 6905 |
|
| 6906 |
-
Let
|
| 6907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6908 |
|
| 6909 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 6910 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 6911 |
respectively. The resulting range does not overlap with either of the
|
| 6912 |
original ranges.
|
| 6913 |
|
| 6914 |
*Effects:* Copies the elements of the range \[`first1`, `last1`) that
|
| 6915 |
are not present in the range \[`first2`, `last2`), and the elements of
|
| 6916 |
the range \[`first2`, `last2`) that are not present in the range
|
| 6917 |
-
\[`first1`, `last1`) to the range
|
| 6918 |
-
the constructed range are sorted.
|
| 6919 |
|
| 6920 |
-
*Returns:*
|
| 6921 |
-
Returns
|
| 6922 |
|
| 6923 |
- `result_last` for the overloads in namespace `std`.
|
| 6924 |
-
- `{last1, last2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6925 |
|
| 6926 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 6927 |
comparisons and applications of each projection.
|
| 6928 |
|
| 6929 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
@@ -7162,10 +9452,26 @@ template<random_access_range R, class Proj = identity,
|
|
| 7162 |
```
|
| 7163 |
|
| 7164 |
*Effects:* Equivalent to:
|
| 7165 |
`return ranges::is_heap_until(first, last, comp, proj) == last;`
|
| 7166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7167 |
``` cpp
|
| 7168 |
template<class RandomAccessIterator>
|
| 7169 |
constexpr RandomAccessIterator
|
| 7170 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
|
| 7171 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
|
@@ -7188,10 +9494,19 @@ template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 7188 |
constexpr I ranges::is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7189 |
template<random_access_range R, class Proj = identity,
|
| 7190 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7191 |
constexpr borrowed_iterator_t<R>
|
| 7192 |
ranges::is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7193 |
```
|
| 7194 |
|
| 7195 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7196 |
no parameters by those names.
|
| 7197 |
|
|
@@ -7237,10 +9552,15 @@ template<copyable T, class Proj = identity,
|
|
| 7237 |
template<input_range R, class Proj = identity,
|
| 7238 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7239 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 7240 |
constexpr range_value_t<R>
|
| 7241 |
ranges::min(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7242 |
```
|
| 7243 |
|
| 7244 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 7245 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 7246 |
For the first form, `T` meets the *Cpp17LessThanComparable* requirements
|
|
@@ -7290,10 +9610,15 @@ template<copyable T, class Proj = identity,
|
|
| 7290 |
template<input_range R, class Proj = identity,
|
| 7291 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7292 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 7293 |
constexpr range_value_t<R>
|
| 7294 |
ranges::max(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7295 |
```
|
| 7296 |
|
| 7297 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 7298 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 7299 |
For the first form, `T` meets the *Cpp17LessThanComparable* requirements
|
|
@@ -7344,10 +9669,15 @@ template<copyable T, class Proj = identity,
|
|
| 7344 |
template<input_range R, class Proj = identity,
|
| 7345 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7346 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 7347 |
constexpr ranges::minmax_result<range_value_t<R>>
|
| 7348 |
ranges::minmax(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7349 |
```
|
| 7350 |
|
| 7351 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 7352 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 7353 |
For the first form, type `T` meets the *Cpp17LessThanComparable*
|
|
@@ -7384,10 +9714,20 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 7384 |
constexpr I ranges::min_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7385 |
template<forward_range R, class Proj = identity,
|
| 7386 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7387 |
constexpr borrowed_iterator_t<R>
|
| 7388 |
ranges::min_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7389 |
```
|
| 7390 |
|
| 7391 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7392 |
no parameters by those names.
|
| 7393 |
|
|
@@ -7423,10 +9763,20 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 7423 |
constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7424 |
template<forward_range R, class Proj = identity,
|
| 7425 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7426 |
constexpr borrowed_iterator_t<R>
|
| 7427 |
ranges::max_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7428 |
```
|
| 7429 |
|
| 7430 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7431 |
no parameters by those names.
|
| 7432 |
|
|
@@ -7465,10 +9815,20 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
| 7465 |
ranges::minmax_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7466 |
template<forward_range R, class Proj = identity,
|
| 7467 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7468 |
constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
|
| 7469 |
ranges::minmax_element(R&& r, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7470 |
```
|
| 7471 |
|
| 7472 |
*Returns:* `{first, first}` if \[`first`, `last`) is empty, otherwise
|
| 7473 |
`{m, M}`, where `m` is the first iterator in \[`first`, `last`) such
|
| 7474 |
that no iterator in the range refers to a smaller element, and where `M`
|
|
@@ -7551,10 +9911,24 @@ template<input_range R1, input_range R2, class Proj1 = identity,
|
|
| 7551 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 7552 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 7553 |
constexpr bool
|
| 7554 |
ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
|
| 7555 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7556 |
```
|
| 7557 |
|
| 7558 |
*Returns:* `true` if and only if the sequence of elements defined by the
|
| 7559 |
range \[`first1`, `last1`) is lexicographically less than the sequence
|
| 7560 |
of elements defined by the range \[`first2`, `last2`).
|
|
@@ -7713,10 +10087,11 @@ otherwise `false`. Returns:
|
|
| 7713 |
*Complexity:* At most `(last - first) / 2` swaps.
|
| 7714 |
|
| 7715 |
## Header `<numeric>` synopsis <a id="numeric.ops.overview">[[numeric.ops.overview]]</a>
|
| 7716 |
|
| 7717 |
``` cpp
|
|
|
|
| 7718 |
namespace std {
|
| 7719 |
// [accumulate], accumulate
|
| 7720 |
template<class InputIterator, class T>
|
| 7721 |
constexpr T accumulate(InputIterator first, InputIterator last, T init);
|
| 7722 |
template<class InputIterator, class T, class BinaryOperation>
|
|
@@ -7732,17 +10107,17 @@ namespace std {
|
|
| 7732 |
template<class InputIterator, class T, class BinaryOperation>
|
| 7733 |
constexpr T reduce(InputIterator first, InputIterator last, T init,
|
| 7734 |
BinaryOperation binary_op);
|
| 7735 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 7736 |
typename iterator_traits<ForwardIterator>::value_type
|
| 7737 |
-
reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7738 |
ForwardIterator first, ForwardIterator last);
|
| 7739 |
template<class ExecutionPolicy, class ForwardIterator, class T>
|
| 7740 |
-
T reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7741 |
ForwardIterator first, ForwardIterator last, T init);
|
| 7742 |
template<class ExecutionPolicy, class ForwardIterator, class T, class BinaryOperation>
|
| 7743 |
-
T reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7744 |
ForwardIterator first, ForwardIterator last, T init, BinaryOperation binary_op);
|
| 7745 |
|
| 7746 |
// [inner.product], inner product
|
| 7747 |
template<class InputIterator1, class InputIterator2, class T>
|
| 7748 |
constexpr T inner_product(InputIterator1 first1, InputIterator1 last1,
|
|
@@ -7766,23 +10141,23 @@ namespace std {
|
|
| 7766 |
class BinaryOperation, class UnaryOperation>
|
| 7767 |
constexpr T transform_reduce(InputIterator first, InputIterator last, T init,
|
| 7768 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 7769 |
template<class ExecutionPolicy,
|
| 7770 |
class ForwardIterator1, class ForwardIterator2, class T>
|
| 7771 |
-
T transform_reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7772 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 7773 |
ForwardIterator2 first2, T init);
|
| 7774 |
template<class ExecutionPolicy,
|
| 7775 |
class ForwardIterator1, class ForwardIterator2, class T,
|
| 7776 |
class BinaryOperation1, class BinaryOperation2>
|
| 7777 |
-
T transform_reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7778 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 7779 |
ForwardIterator2 first2, T init,
|
| 7780 |
BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
|
| 7781 |
template<class ExecutionPolicy, class ForwardIterator, class T,
|
| 7782 |
class BinaryOperation, class UnaryOperation>
|
| 7783 |
-
T transform_reduce(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7784 |
ForwardIterator first, ForwardIterator last, T init,
|
| 7785 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 7786 |
|
| 7787 |
// [partial.sum], partial sum
|
| 7788 |
template<class InputIterator, class OutputIterator>
|
|
@@ -7803,17 +10178,17 @@ namespace std {
|
|
| 7803 |
constexpr OutputIterator
|
| 7804 |
exclusive_scan(InputIterator first, InputIterator last,
|
| 7805 |
OutputIterator result, T init, BinaryOperation binary_op);
|
| 7806 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
|
| 7807 |
ForwardIterator2
|
| 7808 |
-
exclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7809 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7810 |
ForwardIterator2 result, T init);
|
| 7811 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T,
|
| 7812 |
class BinaryOperation>
|
| 7813 |
ForwardIterator2
|
| 7814 |
-
exclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7815 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7816 |
ForwardIterator2 result, T init, BinaryOperation binary_op);
|
| 7817 |
|
| 7818 |
// [inclusive.scan], inclusive scan
|
| 7819 |
template<class InputIterator, class OutputIterator>
|
|
@@ -7828,23 +10203,23 @@ namespace std {
|
|
| 7828 |
constexpr OutputIterator
|
| 7829 |
inclusive_scan(InputIterator first, InputIterator last,
|
| 7830 |
OutputIterator result, BinaryOperation binary_op, T init);
|
| 7831 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 7832 |
ForwardIterator2
|
| 7833 |
-
inclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7834 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7835 |
ForwardIterator2 result);
|
| 7836 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 7837 |
class BinaryOperation>
|
| 7838 |
ForwardIterator2
|
| 7839 |
-
inclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7840 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7841 |
ForwardIterator2 result, BinaryOperation binary_op);
|
| 7842 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 7843 |
class BinaryOperation, class T>
|
| 7844 |
ForwardIterator2
|
| 7845 |
-
inclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7846 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7847 |
ForwardIterator2 result, BinaryOperation binary_op, T init);
|
| 7848 |
|
| 7849 |
// [transform.exclusive.scan], transform exclusive scan
|
| 7850 |
template<class InputIterator, class OutputIterator, class T,
|
|
@@ -7854,11 +10229,11 @@ namespace std {
|
|
| 7854 |
OutputIterator result, T init,
|
| 7855 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 7856 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T,
|
| 7857 |
class BinaryOperation, class UnaryOperation>
|
| 7858 |
ForwardIterator2
|
| 7859 |
-
transform_exclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7860 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7861 |
ForwardIterator2 result, T init,
|
| 7862 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 7863 |
|
| 7864 |
// [transform.inclusive.scan], transform inclusive scan
|
|
@@ -7875,18 +10250,18 @@ namespace std {
|
|
| 7875 |
OutputIterator result,
|
| 7876 |
BinaryOperation binary_op, UnaryOperation unary_op, T init);
|
| 7877 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 7878 |
class BinaryOperation, class UnaryOperation>
|
| 7879 |
ForwardIterator2
|
| 7880 |
-
transform_inclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7881 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7882 |
ForwardIterator2 result, BinaryOperation binary_op,
|
| 7883 |
UnaryOperation unary_op);
|
| 7884 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 7885 |
class BinaryOperation, class UnaryOperation, class T>
|
| 7886 |
ForwardIterator2
|
| 7887 |
-
transform_inclusive_scan(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7888 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7889 |
ForwardIterator2 result,
|
| 7890 |
BinaryOperation binary_op, UnaryOperation unary_op, T init);
|
| 7891 |
|
| 7892 |
// [adjacent.difference], adjacent difference
|
|
@@ -7898,17 +10273,17 @@ namespace std {
|
|
| 7898 |
constexpr OutputIterator
|
| 7899 |
adjacent_difference(InputIterator first, InputIterator last,
|
| 7900 |
OutputIterator result, BinaryOperation binary_op);
|
| 7901 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 7902 |
ForwardIterator2
|
| 7903 |
-
adjacent_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7904 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7905 |
ForwardIterator2 result);
|
| 7906 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 7907 |
class BinaryOperation>
|
| 7908 |
ForwardIterator2
|
| 7909 |
-
adjacent_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 7910 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 7911 |
ForwardIterator2 result, BinaryOperation binary_op);
|
| 7912 |
|
| 7913 |
// [numeric.iota], iota
|
| 7914 |
template<class ForwardIterator, class T>
|
|
@@ -7937,10 +10312,22 @@ namespace std {
|
|
| 7937 |
// [numeric.ops.midpoint], midpoint
|
| 7938 |
template<class T>
|
| 7939 |
constexpr T midpoint(T a, T b) noexcept;
|
| 7940 |
template<class T>
|
| 7941 |
constexpr T* midpoint(T* a, T* b);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7942 |
}
|
| 7943 |
```
|
| 7944 |
|
| 7945 |
## Generalized numeric operations <a id="numeric.ops">[[numeric.ops]]</a>
|
| 7946 |
|
|
@@ -7950,20 +10337,20 @@ namespace std {
|
|
| 7950 |
specify requirements throughout [[numeric.ops]] is
|
| 7951 |
intentional. — *end note*]
|
| 7952 |
|
| 7953 |
### Definitions <a id="numerics.defns">[[numerics.defns]]</a>
|
| 7954 |
|
| 7955 |
-
Define `GENERALIZED_NONCOMMUTATIVE_SUM(op, a1,
|
| 7956 |
|
| 7957 |
- `a1` when `N` is `1`, otherwise
|
| 7958 |
-
- `op(GENERALIZED_NONCOMMUTATIVE_SUM(op, a1,
|
| 7959 |
-
`\phantom{op(}GENERALIZED_NONCOMMUTATIVE_SUM(op, aM,
|
| 7960 |
-
|
| 7961 |
|
| 7962 |
-
Define `GENERALIZED_SUM(op, a1,
|
| 7963 |
-
`GENERALIZED_NONCOMMUTATIVE_SUM(op, b1,
|
| 7964 |
-
|
| 7965 |
|
| 7966 |
### Accumulate <a id="accumulate">[[accumulate]]</a>
|
| 7967 |
|
| 7968 |
``` cpp
|
| 7969 |
template<class InputIterator, class T>
|
|
@@ -8060,11 +10447,11 @@ are convertible to `T`.
|
|
| 8060 |
- `T` meets the *Cpp17MoveConstructible* ([[cpp17.moveconstructible]])
|
| 8061 |
requirements.
|
| 8062 |
- `binary_op` neither invalidates iterators or subranges, nor modifies
|
| 8063 |
elements in the range \[`first`, `last`\].
|
| 8064 |
|
| 8065 |
-
*Returns:* *GENERALIZED_SUM*(binary_op, init, \*i,
|
| 8066 |
\[`first`, `last`).
|
| 8067 |
|
| 8068 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
| 8069 |
|
| 8070 |
[*Note 1*: The difference between `reduce` and `accumulate` is that
|
|
@@ -8168,11 +10555,11 @@ are convertible to `T`.
|
|
| 8168 |
`first2 + (last1 - first1)`\].
|
| 8169 |
|
| 8170 |
*Returns:*
|
| 8171 |
|
| 8172 |
``` cpp
|
| 8173 |
-
GENERALIZED_SUM(binary_op1, init, binary_op2(*i, *(first2 + (i - first1))),
|
| 8174 |
```
|
| 8175 |
|
| 8176 |
for every iterator `i` in \[`first1`, `last1`).
|
| 8177 |
|
| 8178 |
*Complexity:* 𝑂(`last1 - first1`) applications each of `binary_op1` and
|
|
@@ -8208,11 +10595,11 @@ are convertible to `T`.
|
|
| 8208 |
elements in the range \[`first`, `last`\].
|
| 8209 |
|
| 8210 |
*Returns:*
|
| 8211 |
|
| 8212 |
``` cpp
|
| 8213 |
-
GENERALIZED_SUM(binary_op, init, unary_op(*i),
|
| 8214 |
```
|
| 8215 |
|
| 8216 |
for every iterator `i` in \[`first`, `last`).
|
| 8217 |
|
| 8218 |
*Complexity:* 𝑂(`last - first`) applications each of `unary_op` and
|
|
@@ -8320,11 +10707,11 @@ are convertible to `T`.
|
|
| 8320 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 8321 |
through `result + K` the value of:
|
| 8322 |
|
| 8323 |
``` cpp
|
| 8324 |
GENERALIZED_NONCOMMUTATIVE_SUM(
|
| 8325 |
-
binary_op, init, *(first + 0), *(first + 1),
|
| 8326 |
```
|
| 8327 |
|
| 8328 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 8329 |
|
| 8330 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
|
@@ -8411,15 +10798,14 @@ convertible to `U`.
|
|
| 8411 |
|
| 8412 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 8413 |
through `result + K` the value of
|
| 8414 |
|
| 8415 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 8416 |
-
binary_op, init, \*(first + 0), \*(first + 1),
|
| 8417 |
-
K))
|
| 8418 |
if `init` is provided, or
|
| 8419 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 8420 |
-
binary_op, \*(first + 0), \*(first + 1),
|
| 8421 |
otherwise.
|
| 8422 |
|
| 8423 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 8424 |
|
| 8425 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
|
@@ -8470,11 +10856,11 @@ are convertible to `T`.
|
|
| 8470 |
through `result + K` the value of:
|
| 8471 |
|
| 8472 |
``` cpp
|
| 8473 |
GENERALIZED_NONCOMMUTATIVE_SUM(
|
| 8474 |
binary_op, init,
|
| 8475 |
-
unary_op(*(first + 0)), unary_op(*(first + 1)),
|
| 8476 |
```
|
| 8477 |
|
| 8478 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 8479 |
|
| 8480 |
*Complexity:* 𝑂(`last - first`) applications each of `unary_op` and
|
|
@@ -8547,16 +10933,16 @@ are convertible to `T`; otherwise,
|
|
| 8547 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 8548 |
through `result + K` the value of
|
| 8549 |
|
| 8550 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 8551 |
binary_op, init,
|
| 8552 |
-
unary_op(\*(first + 0)), unary_op(\*(first + 1)),
|
| 8553 |
unary_op(\*(first + K)))
|
| 8554 |
if `init` is provided, or
|
| 8555 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 8556 |
binary_op,
|
| 8557 |
-
unary_op(\*(first + 0)), unary_op(\*(first + 1)),
|
| 8558 |
unary_op(\*(first + K)))
|
| 8559 |
otherwise.
|
| 8560 |
|
| 8561 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 8562 |
|
|
@@ -8626,12 +11012,12 @@ every iterator `i` in \[`first + 1`, `last`) in order, creates an object
|
|
| 8626 |
`val` whose type is `T`, initializes it with `*i`, computes
|
| 8627 |
`binary_op(val, std::move(acc))`, assigns the result to
|
| 8628 |
`*(result + (i - first))`, and move assigns from `val` to `acc`.
|
| 8629 |
|
| 8630 |
For the overloads with an `ExecutionPolicy` and a non-empty range,
|
| 8631 |
-
performs `*result = *first`. Then, for every `d` in
|
| 8632 |
-
`
|
| 8633 |
`*(result + d) = binary_op(*(first + d), *(first + (d - 1)))`.
|
| 8634 |
|
| 8635 |
*Returns:* `result + (last - first)`.
|
| 8636 |
|
| 8637 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
|
@@ -8750,10 +11136,86 @@ considered to be equivalent to a pointer to a hypothetical array element
|
|
| 8750 |
n for this purpose. — *end note*]
|
| 8751 |
|
| 8752 |
*Returns:* A pointer to array element $i+\frac{j-i}{2}$ of `x`, where
|
| 8753 |
the result of the division is truncated towards zero.
|
| 8754 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8755 |
## Specialized `<memory>` algorithms <a id="specialized.algorithms">[[specialized.algorithms]]</a>
|
| 8756 |
|
| 8757 |
### General <a id="specialized.algorithms.general">[[specialized.algorithms.general]]</a>
|
| 8758 |
|
| 8759 |
The contents specified in [[specialized.algorithms]] are declared in the
|
|
@@ -8762,18 +11224,31 @@ header `<memory>`.
|
|
| 8762 |
Unless otherwise specified, if an exception is thrown in the following
|
| 8763 |
algorithms, objects constructed by a placement *new-expression*
|
| 8764 |
[[expr.new]] are destroyed in an unspecified order before allowing the
|
| 8765 |
exception to propagate.
|
| 8766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8767 |
Some algorithms specified in [[specialized.algorithms]] make use of the
|
| 8768 |
-
exposition-only function
|
| 8769 |
|
| 8770 |
``` cpp
|
| 8771 |
template<class T>
|
| 8772 |
constexpr void* voidify(T& obj) noexcept {
|
| 8773 |
return addressof(obj);
|
| 8774 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8775 |
```
|
| 8776 |
|
| 8777 |
### Special memory concepts <a id="special.mem.concepts">[[special.mem.concepts]]</a>
|
| 8778 |
|
| 8779 |
Some algorithms in this subclause are constrained with the following
|
|
@@ -8806,10 +11281,25 @@ assignment, or comparisons between valid values of type `I` and `S`.
|
|
| 8806 |
|
| 8807 |
[*Note 2*: This concept allows some `sentinel_for`
|
| 8808 |
[[iterator.concept.sentinel]] operations to throw
|
| 8809 |
exceptions. — *end note*]
|
| 8810 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8811 |
``` cpp
|
| 8812 |
template<class R>
|
| 8813 |
concept nothrow-input-range = // exposition only
|
| 8814 |
range<R> &&
|
| 8815 |
nothrow-input-iterator<iterator_t<R>> &&
|
|
@@ -8826,44 +11316,97 @@ concept nothrow-forward-iterator = // exposition only
|
|
| 8826 |
nothrow-input-iterator<I> &&
|
| 8827 |
forward_iterator<I> &&
|
| 8828 |
nothrow-sentinel-for<I, I>;
|
| 8829 |
```
|
| 8830 |
|
| 8831 |
-
[*Note
|
| 8832 |
[[iterator.concept.forward]] operations to throw
|
| 8833 |
exceptions. — *end note*]
|
| 8834 |
|
| 8835 |
``` cpp
|
| 8836 |
template<class R>
|
| 8837 |
concept nothrow-forward-range = // exposition only
|
| 8838 |
nothrow-input-range<R> &&
|
| 8839 |
nothrow-forward-iterator<iterator_t<R>>;
|
| 8840 |
```
|
| 8841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8842 |
### `uninitialized_default_construct` <a id="uninitialized.construct.default">[[uninitialized.construct.default]]</a>
|
| 8843 |
|
| 8844 |
``` cpp
|
| 8845 |
template<class NoThrowForwardIterator>
|
| 8846 |
-
void uninitialized_default_construct(NoThrowForwardIterator first,
|
|
|
|
| 8847 |
```
|
| 8848 |
|
| 8849 |
*Effects:* Equivalent to:
|
| 8850 |
|
| 8851 |
``` cpp
|
| 8852 |
for (; first != last; ++first)
|
| 8853 |
-
::new (voidify(*first))
|
| 8854 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type;
|
| 8855 |
```
|
| 8856 |
|
| 8857 |
``` cpp
|
| 8858 |
namespace ranges {
|
| 8859 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 8860 |
requires default_initializable<iter_value_t<I>>
|
| 8861 |
-
I uninitialized_default_construct(I first, S last);
|
| 8862 |
template<nothrow-forward-range R>
|
| 8863 |
requires default_initializable<range_value_t<R>>
|
| 8864 |
-
borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
|
| 8865 |
}
|
| 8866 |
```
|
| 8867 |
|
| 8868 |
*Effects:* Equivalent to:
|
| 8869 |
|
|
@@ -8873,27 +11416,27 @@ for (; first != last; ++first)
|
|
| 8873 |
return first;
|
| 8874 |
```
|
| 8875 |
|
| 8876 |
``` cpp
|
| 8877 |
template<class NoThrowForwardIterator, class Size>
|
| 8878 |
-
|
|
|
|
| 8879 |
```
|
| 8880 |
|
| 8881 |
*Effects:* Equivalent to:
|
| 8882 |
|
| 8883 |
``` cpp
|
| 8884 |
for (; n > 0; (void)++first, --n)
|
| 8885 |
-
::new (voidify(*first))
|
| 8886 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type;
|
| 8887 |
return first;
|
| 8888 |
```
|
| 8889 |
|
| 8890 |
``` cpp
|
| 8891 |
namespace ranges {
|
| 8892 |
template<nothrow-forward-iterator I>
|
| 8893 |
requires default_initializable<iter_value_t<I>>
|
| 8894 |
-
I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
|
| 8895 |
}
|
| 8896 |
```
|
| 8897 |
|
| 8898 |
*Effects:* Equivalent to:
|
| 8899 |
|
|
@@ -8904,29 +11447,29 @@ return uninitialized_default_construct(counted_iterator(first, n),
|
|
| 8904 |
|
| 8905 |
### `uninitialized_value_construct` <a id="uninitialized.construct.value">[[uninitialized.construct.value]]</a>
|
| 8906 |
|
| 8907 |
``` cpp
|
| 8908 |
template<class NoThrowForwardIterator>
|
| 8909 |
-
void uninitialized_value_construct(NoThrowForwardIterator first,
|
|
|
|
| 8910 |
```
|
| 8911 |
|
| 8912 |
*Effects:* Equivalent to:
|
| 8913 |
|
| 8914 |
``` cpp
|
| 8915 |
for (; first != last; ++first)
|
| 8916 |
-
::new (voidify(*first))
|
| 8917 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type();
|
| 8918 |
```
|
| 8919 |
|
| 8920 |
``` cpp
|
| 8921 |
namespace ranges {
|
| 8922 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 8923 |
requires default_initializable<iter_value_t<I>>
|
| 8924 |
-
I uninitialized_value_construct(I first, S last);
|
| 8925 |
template<nothrow-forward-range R>
|
| 8926 |
requires default_initializable<range_value_t<R>>
|
| 8927 |
-
borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
|
| 8928 |
}
|
| 8929 |
```
|
| 8930 |
|
| 8931 |
*Effects:* Equivalent to:
|
| 8932 |
|
|
@@ -8936,27 +11479,27 @@ for (; first != last; ++first)
|
|
| 8936 |
return first;
|
| 8937 |
```
|
| 8938 |
|
| 8939 |
``` cpp
|
| 8940 |
template<class NoThrowForwardIterator, class Size>
|
| 8941 |
-
|
|
|
|
| 8942 |
```
|
| 8943 |
|
| 8944 |
*Effects:* Equivalent to:
|
| 8945 |
|
| 8946 |
``` cpp
|
| 8947 |
for (; n > 0; (void)++first, --n)
|
| 8948 |
-
::new (voidify(*first))
|
| 8949 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type();
|
| 8950 |
return first;
|
| 8951 |
```
|
| 8952 |
|
| 8953 |
``` cpp
|
| 8954 |
namespace ranges {
|
| 8955 |
template<nothrow-forward-iterator I>
|
| 8956 |
requires default_initializable<iter_value_t<I>>
|
| 8957 |
-
I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
|
| 8958 |
}
|
| 8959 |
```
|
| 8960 |
|
| 8961 |
*Effects:* Equivalent to:
|
| 8962 |
|
|
@@ -8967,37 +11510,36 @@ return uninitialized_value_construct(counted_iterator(first, n),
|
|
| 8967 |
|
| 8968 |
### `uninitialized_copy` <a id="uninitialized.copy">[[uninitialized.copy]]</a>
|
| 8969 |
|
| 8970 |
``` cpp
|
| 8971 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 8972 |
-
NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
|
| 8973 |
NoThrowForwardIterator result);
|
| 8974 |
```
|
| 8975 |
|
| 8976 |
*Preconditions:* `result`+\[0, `(last - first)`) does not overlap with
|
| 8977 |
\[`first`, `last`).
|
| 8978 |
|
| 8979 |
*Effects:* Equivalent to:
|
| 8980 |
|
| 8981 |
``` cpp
|
| 8982 |
for (; first != last; ++result, (void)++first)
|
| 8983 |
-
::new (voidify(*result))
|
| 8984 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type(*first);
|
| 8985 |
```
|
| 8986 |
|
| 8987 |
*Returns:* `result`.
|
| 8988 |
|
| 8989 |
``` cpp
|
| 8990 |
namespace ranges {
|
| 8991 |
template<input_iterator I, sentinel_for<I> S1,
|
| 8992 |
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 8993 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 8994 |
-
uninitialized_copy_result<I, O>
|
| 8995 |
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
|
| 8996 |
template<input_range IR, nothrow-forward-range OR>
|
| 8997 |
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
|
| 8998 |
-
uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 8999 |
uninitialized_copy(IR&& in_range, OR&& out_range);
|
| 9000 |
}
|
| 9001 |
```
|
| 9002 |
|
| 9003 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
|
|
@@ -9011,32 +11553,31 @@ for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst)
|
|
| 9011 |
return {std::move(ifirst), ofirst};
|
| 9012 |
```
|
| 9013 |
|
| 9014 |
``` cpp
|
| 9015 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 9016 |
-
NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
|
| 9017 |
NoThrowForwardIterator result);
|
| 9018 |
```
|
| 9019 |
|
| 9020 |
*Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
|
| 9021 |
`n`).
|
| 9022 |
|
| 9023 |
*Effects:* Equivalent to:
|
| 9024 |
|
| 9025 |
``` cpp
|
| 9026 |
for (; n > 0; ++result, (void)++first, --n)
|
| 9027 |
-
::new (voidify(*result))
|
| 9028 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type(*first);
|
| 9029 |
```
|
| 9030 |
|
| 9031 |
*Returns:* `result`.
|
| 9032 |
|
| 9033 |
``` cpp
|
| 9034 |
namespace ranges {
|
| 9035 |
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 9036 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 9037 |
-
uninitialized_copy_n_result<I, O>
|
| 9038 |
uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
|
| 9039 |
}
|
| 9040 |
```
|
| 9041 |
|
| 9042 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with
|
|
@@ -9052,11 +11593,11 @@ return {std::move(t.in).base(), t.out};
|
|
| 9052 |
|
| 9053 |
### `uninitialized_move` <a id="uninitialized.move">[[uninitialized.move]]</a>
|
| 9054 |
|
| 9055 |
``` cpp
|
| 9056 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 9057 |
-
NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last,
|
| 9058 |
NoThrowForwardIterator result);
|
| 9059 |
```
|
| 9060 |
|
| 9061 |
*Preconditions:* `result`+\[0, `(last - first)`) does not overlap with
|
| 9062 |
\[`first`, `last`).
|
|
@@ -9064,24 +11605,24 @@ template<class InputIterator, class NoThrowForwardIterator>
|
|
| 9064 |
*Effects:* Equivalent to:
|
| 9065 |
|
| 9066 |
``` cpp
|
| 9067 |
for (; first != last; (void)++result, ++first)
|
| 9068 |
::new (voidify(*result))
|
| 9069 |
-
|
| 9070 |
return result;
|
| 9071 |
```
|
| 9072 |
|
| 9073 |
``` cpp
|
| 9074 |
namespace ranges {
|
| 9075 |
template<input_iterator I, sentinel_for<I> S1,
|
| 9076 |
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 9077 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 9078 |
-
uninitialized_move_result<I, O>
|
| 9079 |
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
|
| 9080 |
template<input_range IR, nothrow-forward-range OR>
|
| 9081 |
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
|
| 9082 |
-
uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 9083 |
uninitialized_move(IR&& in_range, OR&& out_range);
|
| 9084 |
}
|
| 9085 |
```
|
| 9086 |
|
| 9087 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
|
|
@@ -9100,11 +11641,11 @@ return {std::move(ifirst), ofirst};
|
|
| 9100 |
\[`ifirst`, `ilast`) are left in a valid, but unspecified
|
| 9101 |
state. — *end note*]
|
| 9102 |
|
| 9103 |
``` cpp
|
| 9104 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 9105 |
-
pair<InputIterator, NoThrowForwardIterator>
|
| 9106 |
uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
|
| 9107 |
```
|
| 9108 |
|
| 9109 |
*Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
|
| 9110 |
`n`).
|
|
@@ -9112,19 +11653,19 @@ template<class InputIterator, class Size, class NoThrowForwardIterator>
|
|
| 9112 |
*Effects:* Equivalent to:
|
| 9113 |
|
| 9114 |
``` cpp
|
| 9115 |
for (; n > 0; ++result, (void)++first, --n)
|
| 9116 |
::new (voidify(*result))
|
| 9117 |
-
|
| 9118 |
return {first, result};
|
| 9119 |
```
|
| 9120 |
|
| 9121 |
``` cpp
|
| 9122 |
namespace ranges {
|
| 9123 |
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 9124 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 9125 |
-
uninitialized_move_n_result<I, O>
|
| 9126 |
uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
|
| 9127 |
}
|
| 9128 |
```
|
| 9129 |
|
| 9130 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with
|
|
@@ -9144,29 +11685,29 @@ state. — *end note*]
|
|
| 9144 |
|
| 9145 |
### `uninitialized_fill` <a id="uninitialized.fill">[[uninitialized.fill]]</a>
|
| 9146 |
|
| 9147 |
``` cpp
|
| 9148 |
template<class NoThrowForwardIterator, class T>
|
| 9149 |
-
void uninitialized_fill(NoThrowForwardIterator first,
|
|
|
|
| 9150 |
```
|
| 9151 |
|
| 9152 |
*Effects:* Equivalent to:
|
| 9153 |
|
| 9154 |
``` cpp
|
| 9155 |
for (; first != last; ++first)
|
| 9156 |
-
::new (voidify(*first))
|
| 9157 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type(x);
|
| 9158 |
```
|
| 9159 |
|
| 9160 |
``` cpp
|
| 9161 |
namespace ranges {
|
| 9162 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S, class T>
|
| 9163 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 9164 |
-
I uninitialized_fill(I first, S last, const T& x);
|
| 9165 |
template<nothrow-forward-range R, class T>
|
| 9166 |
requires constructible_from<range_value_t<R>, const T&>
|
| 9167 |
-
borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
|
| 9168 |
}
|
| 9169 |
```
|
| 9170 |
|
| 9171 |
*Effects:* Equivalent to:
|
| 9172 |
|
|
@@ -9176,27 +11717,27 @@ for (; first != last; ++first)
|
|
| 9176 |
return first;
|
| 9177 |
```
|
| 9178 |
|
| 9179 |
``` cpp
|
| 9180 |
template<class NoThrowForwardIterator, class Size, class T>
|
| 9181 |
-
|
|
|
|
| 9182 |
```
|
| 9183 |
|
| 9184 |
*Effects:* Equivalent to:
|
| 9185 |
|
| 9186 |
``` cpp
|
| 9187 |
for (; n--; ++first)
|
| 9188 |
-
::new (voidify(*first))
|
| 9189 |
-
typename iterator_traits<NoThrowForwardIterator>::value_type(x);
|
| 9190 |
return first;
|
| 9191 |
```
|
| 9192 |
|
| 9193 |
``` cpp
|
| 9194 |
namespace ranges {
|
| 9195 |
template<nothrow-forward-iterator I, class T>
|
| 9196 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 9197 |
-
I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
|
| 9198 |
}
|
| 9199 |
```
|
| 9200 |
|
| 9201 |
*Effects:* Equivalent to:
|
| 9202 |
|
|
@@ -9214,17 +11755,22 @@ namespace ranges {
|
|
| 9214 |
template<class T, class... Args>
|
| 9215 |
constexpr T* construct_at(T* location, Args&&... args);
|
| 9216 |
}
|
| 9217 |
```
|
| 9218 |
|
| 9219 |
-
*Constraints:* The expression
|
| 9220 |
`::new (declval<void*>()) T(declval<Args>()...)` is well-formed when
|
| 9221 |
treated as an unevaluated operand [[term.unevaluated.operand]].
|
| 9222 |
|
|
|
|
|
|
|
| 9223 |
*Effects:* Equivalent to:
|
| 9224 |
|
| 9225 |
``` cpp
|
|
|
|
|
|
|
|
|
|
| 9226 |
return ::new (voidify(*location)) T(std::forward<Args>(args)...);
|
| 9227 |
```
|
| 9228 |
|
| 9229 |
### `destroy` <a id="specialized.destroy">[[specialized.destroy]]</a>
|
| 9230 |
|
|
@@ -9299,19 +11845,121 @@ namespace ranges {
|
|
| 9299 |
|
| 9300 |
``` cpp
|
| 9301 |
return destroy(counted_iterator(std::move(first), n), default_sentinel).base();
|
| 9302 |
```
|
| 9303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9304 |
## C library algorithms <a id="alg.c.library">[[alg.c.library]]</a>
|
| 9305 |
|
| 9306 |
[*Note 1*: The header `<cstdlib>` declares the functions described in
|
| 9307 |
this subclause. — *end note*]
|
| 9308 |
|
| 9309 |
``` cpp
|
| 9310 |
-
void* bsearch(const void* key,
|
| 9311 |
c-compare-pred* compar);
|
| 9312 |
-
void* bsearch(const void* key,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9313 |
compare-pred* compar);
|
| 9314 |
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
|
| 9315 |
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
|
| 9316 |
```
|
| 9317 |
|
|
@@ -9322,11 +11970,11 @@ void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
|
|
| 9322 |
standard library.
|
| 9323 |
|
| 9324 |
*Throws:* Any exception thrown by `compar`
|
| 9325 |
[[res.on.exception.handling]].
|
| 9326 |
|
| 9327 |
-
See also: ISO C 7.
|
| 9328 |
|
| 9329 |
<!-- Link reference definitions -->
|
| 9330 |
[accumulate]: #accumulate
|
| 9331 |
[adjacent.difference]: #adjacent.difference
|
| 9332 |
[alg.adjacent.find]: #alg.adjacent.find
|
|
@@ -9346,24 +11994,29 @@ See also: ISO C 7.22.5
|
|
| 9346 |
[alg.find.end]: #alg.find.end
|
| 9347 |
[alg.find.first.of]: #alg.find.first.of
|
| 9348 |
[alg.find.last]: #alg.find.last
|
| 9349 |
[alg.fold]: #alg.fold
|
| 9350 |
[alg.foreach]: #alg.foreach
|
|
|
|
| 9351 |
[alg.generate]: #alg.generate
|
| 9352 |
[alg.heap.operations]: #alg.heap.operations
|
| 9353 |
[alg.heap.operations.general]: #alg.heap.operations.general
|
| 9354 |
[alg.is.permutation]: #alg.is.permutation
|
| 9355 |
[alg.lex.comparison]: #alg.lex.comparison
|
| 9356 |
[alg.merge]: #alg.merge
|
| 9357 |
[alg.min.max]: #alg.min.max
|
|
|
|
| 9358 |
[alg.modifying.operations]: #alg.modifying.operations
|
| 9359 |
[alg.move]: #alg.move
|
| 9360 |
[alg.none.of]: #alg.none.of
|
| 9361 |
[alg.nonmodifying]: #alg.nonmodifying
|
| 9362 |
[alg.nth.element]: #alg.nth.element
|
| 9363 |
[alg.partitions]: #alg.partitions
|
| 9364 |
[alg.permutation.generators]: #alg.permutation.generators
|
|
|
|
|
|
|
|
|
|
| 9365 |
[alg.random.sample]: #alg.random.sample
|
| 9366 |
[alg.random.shuffle]: #alg.random.shuffle
|
| 9367 |
[alg.remove]: #alg.remove
|
| 9368 |
[alg.replace]: #alg.replace
|
| 9369 |
[alg.reverse]: #alg.reverse
|
|
@@ -9391,13 +12044,14 @@ See also: ISO C 7.22.5
|
|
| 9391 |
[algorithms.parallel.overloads]: #algorithms.parallel.overloads
|
| 9392 |
[algorithms.parallel.user]: #algorithms.parallel.user
|
| 9393 |
[algorithms.requirements]: #algorithms.requirements
|
| 9394 |
[algorithms.results]: #algorithms.results
|
| 9395 |
[algorithms.summary]: #algorithms.summary
|
|
|
|
| 9396 |
[basic.compound]: basic.md#basic.compound
|
| 9397 |
-
[basic.
|
| 9398 |
-
[basic.
|
| 9399 |
[bidirectional.iterators]: iterators.md#bidirectional.iterators
|
| 9400 |
[binary.search]: #binary.search
|
| 9401 |
[class.conv]: class.md#class.conv
|
| 9402 |
[concept.booleantestable]: concepts.md#concept.booleantestable
|
| 9403 |
[containers]: containers.md#containers
|
|
@@ -9406,21 +12060,30 @@ See also: ISO C 7.22.5
|
|
| 9406 |
[cpp17.copyconstructible]: #cpp17.copyconstructible
|
| 9407 |
[cpp17.lessthancomparable]: #cpp17.lessthancomparable
|
| 9408 |
[cpp17.moveassignable]: #cpp17.moveassignable
|
| 9409 |
[cpp17.moveconstructible]: #cpp17.moveconstructible
|
| 9410 |
[equal.range]: #equal.range
|
|
|
|
| 9411 |
[exclusive.scan]: #exclusive.scan
|
| 9412 |
-
[execpol]:
|
| 9413 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9414 |
[expr.new]: expr.md#expr.new
|
| 9415 |
[forward.iterators]: iterators.md#forward.iterators
|
| 9416 |
[function.objects]: utilities.md#function.objects
|
| 9417 |
[includes]: #includes
|
| 9418 |
[inclusive.scan]: #inclusive.scan
|
| 9419 |
[inner.product]: #inner.product
|
| 9420 |
[input.iterators]: iterators.md#input.iterators
|
| 9421 |
[intro.execution]: basic.md#intro.execution
|
|
|
|
| 9422 |
[intro.progress]: basic.md#intro.progress
|
| 9423 |
[is.heap]: #is.heap
|
| 9424 |
[is.sorted]: #is.sorted
|
| 9425 |
[iterator.concept.bidir]: iterators.md#iterator.concept.bidir
|
| 9426 |
[iterator.concept.forward]: iterators.md#iterator.concept.forward
|
|
@@ -9430,19 +12093,21 @@ See also: ISO C 7.22.5
|
|
| 9430 |
[iterator.concept.sizedsentinel]: iterators.md#iterator.concept.sizedsentinel
|
| 9431 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 9432 |
[iterator.requirements.general]: iterators.md#iterator.requirements.general
|
| 9433 |
[lower.bound]: #lower.bound
|
| 9434 |
[make.heap]: #make.heap
|
| 9435 |
-
[mismatch]: #mismatch
|
| 9436 |
[multiset]: containers.md#multiset
|
| 9437 |
[numeric.iota]: #numeric.iota
|
| 9438 |
[numeric.ops]: #numeric.ops
|
| 9439 |
[numeric.ops.gcd]: #numeric.ops.gcd
|
| 9440 |
[numeric.ops.general]: #numeric.ops.general
|
| 9441 |
[numeric.ops.lcm]: #numeric.ops.lcm
|
| 9442 |
[numeric.ops.midpoint]: #numeric.ops.midpoint
|
| 9443 |
[numeric.ops.overview]: #numeric.ops.overview
|
|
|
|
|
|
|
|
|
|
| 9444 |
[numerics.defns]: #numerics.defns
|
| 9445 |
[output.iterators]: iterators.md#output.iterators
|
| 9446 |
[partial.sort]: #partial.sort
|
| 9447 |
[partial.sort.copy]: #partial.sort.copy
|
| 9448 |
[partial.sum]: #partial.sum
|
|
@@ -9465,11 +12130,10 @@ See also: ISO C 7.22.5
|
|
| 9465 |
[specialized.algorithms.general]: #specialized.algorithms.general
|
| 9466 |
[specialized.construct]: #specialized.construct
|
| 9467 |
[specialized.destroy]: #specialized.destroy
|
| 9468 |
[stable.sort]: #stable.sort
|
| 9469 |
[swappable.requirements]: library.md#swappable.requirements
|
| 9470 |
-
[temp.func.order]: temp.md#temp.func.order
|
| 9471 |
[term.unevaluated.operand]: expr.md#term.unevaluated.operand
|
| 9472 |
[thread.jthread.class]: thread.md#thread.jthread.class
|
| 9473 |
[thread.thread.class]: thread.md#thread.thread.class
|
| 9474 |
[transform.exclusive.scan]: #transform.exclusive.scan
|
| 9475 |
[transform.inclusive.scan]: #transform.inclusive.scan
|
|
|
|
| 5 |
This Clause describes components that C++ programs may use to perform
|
| 6 |
algorithmic operations on containers [[containers]] and other sequences.
|
| 7 |
|
| 8 |
The following subclauses describe components for non-modifying sequence
|
| 9 |
operations, mutating sequence operations, sorting and related
|
| 10 |
+
operations, and algorithms from the C library, as summarized in
|
| 11 |
[[algorithms.summary]].
|
| 12 |
|
| 13 |
**Table: Algorithms library summary** <a id="algorithms.summary">[algorithms.summary]</a>
|
| 14 |
|
| 15 |
| Subclause | | Header |
|
| 16 |
| ---------------------------- | --------------------------------- | ------------- |
|
| 17 |
| [[algorithms.requirements]] | Algorithms requirements | |
|
| 18 |
+
| [[algorithms.parallel]] | Parallel algorithms | `<execution>` |
|
| 19 |
| [[algorithms.results]] | Algorithm result types | `<algorithm>` |
|
| 20 |
| [[alg.nonmodifying]] | Non-modifying sequence operations | |
|
| 21 |
| [[alg.modifying.operations]] | Mutating sequence operations | |
|
| 22 |
| [[alg.sorting]] | Sorting and related operations | |
|
| 23 |
| [[numeric.ops]] | Generalized numeric operations | `<numeric>` |
|
| 24 |
| [[specialized.algorithms]] | Specialized `<memory>` algorithms | `<memory>` |
|
| 25 |
+
| [[alg.rand]] | Specialized `<random>` algorithms | `<random>` |
|
| 26 |
| [[alg.c.library]] | C library algorithms | `<cstdlib>` |
|
| 27 |
|
| 28 |
|
| 29 |
## Algorithms requirements <a id="algorithms.requirements">[[algorithms.requirements]]</a>
|
| 30 |
|
|
|
|
| 32 |
of data structures and are parameterized by iterator types. Because of
|
| 33 |
this, they can work with program-defined data structures, as long as
|
| 34 |
these data structures have iterator types satisfying the assumptions on
|
| 35 |
the algorithms.
|
| 36 |
|
| 37 |
+
The entities defined in the `std::ranges` namespace in this Clause and
|
| 38 |
+
specified as function templates are algorithm function objects
|
| 39 |
+
[[alg.func.obj]].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
For purposes of determining the existence of data races, algorithms
|
| 42 |
shall not modify objects referenced through an iterator argument unless
|
| 43 |
the specification requires such modification.
|
| 44 |
|
|
|
|
| 167 |
iter_difference_t<decltype(b)> n = 0;
|
| 168 |
for (auto tmp = b; tmp != a; ++tmp) --n;
|
| 169 |
return n;
|
| 170 |
```
|
| 171 |
|
| 172 |
+
For each iterator `i` and sentinel `s` produced from a range `r`, the
|
| 173 |
+
semantics of `s - i` has the same type, value, and value category as
|
| 174 |
+
`ranges::distance(i, s)`.
|
| 175 |
+
|
| 176 |
+
[*Note 3*: The implementation can use `ranges::distance(r)` when that
|
| 177 |
+
produces the same value as `ranges::distance(i, s)`. This can be more
|
| 178 |
+
efficient for sized ranges. — *end note*]
|
| 179 |
+
|
| 180 |
In the description of the algorithms, given an iterator `a` whose
|
| 181 |
difference type is `D`, and an expression `n` of integer-like type other
|
| 182 |
than cv `D`, the semantics of `a + n` and `a - n` are, respectively,
|
| 183 |
those of `a + D(n)` and `a - D(n)`.
|
| 184 |
|
|
|
|
| 186 |
denoting the end of a range \[`i`, `s`) is sometimes returned where an
|
| 187 |
iterator is expected. In these cases, the semantics are as if the
|
| 188 |
sentinel is converted into an iterator using `ranges::next(i, s)`.
|
| 189 |
|
| 190 |
Overloads of algorithms that take `range` arguments [[range.range]]
|
| 191 |
+
behave as if they are implemented by dispatching to the overload in
|
| 192 |
+
namespace `ranges` that takes separate iterator and sentinel arguments,
|
| 193 |
+
where for each range argument `r`
|
| 194 |
+
|
| 195 |
+
- a corresponding iterator argument is initialized with
|
| 196 |
+
`ranges::begin(r)` and
|
| 197 |
+
- a corresponding sentinel argument is initialized with
|
| 198 |
+
`ranges::end(r)`, or
|
| 199 |
+
`ranges::next(ranges::{}begin(r), ranges::end(r))` if the type of `r`
|
| 200 |
+
models `forward_range` and computing `ranges::next` meets the
|
| 201 |
+
specified complexity requirements.
|
| 202 |
|
| 203 |
The well-formedness and behavior of a call to an algorithm with an
|
| 204 |
explicitly-specified template argument list is unspecified, except where
|
| 205 |
explicitly stated otherwise.
|
| 206 |
|
| 207 |
+
[*Note 4*: Consequently, an implementation can declare an algorithm
|
| 208 |
with different template parameters than those presented. — *end note*]
|
| 209 |
|
| 210 |
## Parallel algorithms <a id="algorithms.parallel">[[algorithms.parallel]]</a>
|
| 211 |
|
| 212 |
### Preamble <a id="algorithms.parallel.defns">[[algorithms.parallel.defns]]</a>
|
|
|
|
| 214 |
Subclause [[algorithms.parallel]] describes components that C++ programs
|
| 215 |
may use to perform operations on containers and other sequences in
|
| 216 |
parallel.
|
| 217 |
|
| 218 |
A *parallel algorithm* is a function template listed in this document
|
| 219 |
+
with a template parameter named `ExecutionPolicy` or constrained by the
|
| 220 |
+
following exposition-only concept:
|
| 221 |
|
| 222 |
+
``` cpp
|
| 223 |
+
template<class Ep>
|
| 224 |
+
concept execution-policy = is_execution_policy_v<remove_cvref_t<Ep>>; // exposition only
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
Such a template parameter is termed an
|
| 228 |
+
*execution policy template parameter*.
|
| 229 |
+
|
| 230 |
+
A parallel algorithm accesses objects indirectly accessible via its
|
| 231 |
arguments by invoking the following functions:
|
| 232 |
|
| 233 |
+
- All operations of the categories of the iterators, sentinels, or
|
| 234 |
+
`mdspan` types that the algorithm is instantiated with.
|
| 235 |
- Operations on those sequence elements that are required by its
|
| 236 |
specification.
|
| 237 |
+
- User-provided invocable objects to be applied during the execution of
|
| 238 |
the algorithm, if required by the specification.
|
| 239 |
+
- Operations on those invocable objects required by the specification.
|
| 240 |
\[*Note 1*: See [[algorithms.requirements]]. — *end note*]
|
| 241 |
|
| 242 |
These functions are herein called *element access functions*.
|
| 243 |
|
| 244 |
[*Example 1*:
|
|
|
|
| 255 |
— *end example*]
|
| 256 |
|
| 257 |
A standard library function is *vectorization-unsafe* if it is specified
|
| 258 |
to synchronize with another function invocation, or another function
|
| 259 |
invocation is specified to synchronize with it, and if it is not a
|
| 260 |
+
memory allocation or deallocation function or lock-free atomic
|
| 261 |
+
modify-write operation [[atomics.order]].
|
| 262 |
|
| 263 |
[*Note 2*: Implementations must ensure that internal synchronization
|
| 264 |
inside standard library functions does not prevent forward progress when
|
| 265 |
those functions are executed by threads of execution with weakly
|
| 266 |
parallel forward progress guarantees. — *end note*]
|
|
|
|
| 286 |
|
| 287 |
— *end example*]
|
| 288 |
|
| 289 |
### Requirements on user-provided function objects <a id="algorithms.parallel.user">[[algorithms.parallel.user]]</a>
|
| 290 |
|
| 291 |
+
Unless otherwise specified, invocable objects passed into parallel
|
| 292 |
+
algorithms as objects of a type denoted by a template parameter named
|
| 293 |
+
`Predicate`, `BinaryPredicate`, `Compare`, `UnaryOperation`,
|
| 294 |
+
`BinaryOperation`, `BinaryOperation1`, `BinaryOperation2`,
|
| 295 |
+
`BinaryDivideOp`, or constrained by a concept that subsumes
|
| 296 |
+
`regular_invocable` and the operators used by the analogous overloads to
|
| 297 |
these parallel algorithms that are formed by an invocation with the
|
| 298 |
specified default predicate or operation (where applicable) shall not
|
| 299 |
directly or indirectly modify objects via their arguments, nor shall
|
| 300 |
they rely on the identity of the provided objects.
|
| 301 |
|
| 302 |
### Effect of execution policies on algorithm execution <a id="algorithms.parallel.exec">[[algorithms.parallel.exec]]</a>
|
| 303 |
|
| 304 |
+
An execution policy template parameter describes the manner in which the
|
| 305 |
+
execution of a parallel algorithm may be parallelized and the manner in
|
| 306 |
+
which it applies the element access functions.
|
|
|
|
| 307 |
|
| 308 |
If an object is modified by an element access function, the algorithm
|
| 309 |
will perform no other unsynchronized accesses to that object. The
|
| 310 |
modifying element access functions are those which are specified as
|
| 311 |
modifying the object.
|
|
|
|
| 477 |
resources are required for parallelization and none are available, the
|
| 478 |
algorithm throws a `bad_alloc` exception.
|
| 479 |
|
| 480 |
During the execution of a parallel algorithm, if the invocation of an
|
| 481 |
element access function exits via an uncaught exception, the behavior is
|
| 482 |
+
determined by the execution policy.
|
| 483 |
|
| 484 |
+
### Parallel algorithm overloads <a id="algorithms.parallel.overloads">[[algorithms.parallel.overloads]]</a>
|
| 485 |
|
| 486 |
Parallel algorithms are algorithm overloads. Each parallel algorithm
|
| 487 |
+
overload has an additional function parameter P of type `T&&` as the
|
| 488 |
+
first function parameter, where `T` is the execution policy template
|
| 489 |
+
parameter.
|
|
|
|
| 490 |
|
| 491 |
[*Note 1*: Not all algorithms have parallel algorithm
|
| 492 |
overloads. — *end note*]
|
| 493 |
|
| 494 |
+
Unless otherwise specified, the semantics of calling a parallel
|
| 495 |
+
algorithm overload are identical to calling the corresponding algorithm
|
| 496 |
+
overload without the parameter P, using all but the first argument.
|
| 497 |
|
| 498 |
+
Unless otherwise specified, the complexity requirements of a parallel
|
| 499 |
+
algorithm overload are relaxed from the complexity requirements of the
|
| 500 |
+
corresponding overload without the parameter P as follows: when the
|
| 501 |
+
guarantee says “at most *expr*” or “exactly *expr*” and does not specify
|
| 502 |
+
the number of assignments or swaps, and *expr* is not already expressed
|
| 503 |
+
with 𝑂() notation, the complexity of the algorithm shall be
|
| 504 |
𝑂(\placeholder{expr}).
|
| 505 |
|
| 506 |
+
A parallel algorithm with a template parameter named `ExecutionPolicy`
|
| 507 |
+
shall not participate in overload resolution unless that template
|
| 508 |
+
parameter satisfies `execution-policy`.
|
| 509 |
+
|
| 510 |
+
### Execution policies <a id="execpol">[[execpol]]</a>
|
| 511 |
+
|
| 512 |
+
#### General <a id="execpol.general">[[execpol.general]]</a>
|
| 513 |
+
|
| 514 |
+
Subclause [[execpol]] describes classes that are *execution policy*
|
| 515 |
+
types. An object of an execution policy type indicates the kinds of
|
| 516 |
+
parallelism allowed in the execution of an algorithm and expresses the
|
| 517 |
+
consequent requirements on the element access functions. Execution
|
| 518 |
+
policy types are declared in header `<execution>`.
|
| 519 |
+
|
| 520 |
+
[*Example 1*:
|
| 521 |
+
|
| 522 |
+
``` cpp
|
| 523 |
+
using namespace std;
|
| 524 |
+
vector<int> v = ...;
|
| 525 |
+
|
| 526 |
+
// standard sequential sort
|
| 527 |
+
sort(v.begin(), v.end());
|
| 528 |
+
|
| 529 |
+
// explicitly sequential sort
|
| 530 |
+
sort(execution::seq, v.begin(), v.end());
|
| 531 |
+
|
| 532 |
+
// permitting parallel execution
|
| 533 |
+
sort(execution::par, v.begin(), v.end());
|
| 534 |
+
|
| 535 |
+
// permitting vectorization as well
|
| 536 |
+
sort(execution::par_unseq, v.begin(), v.end());
|
| 537 |
+
```
|
| 538 |
+
|
| 539 |
+
— *end example*]
|
| 540 |
+
|
| 541 |
+
[*Note 1*: Implementations can provide additional execution policies to
|
| 542 |
+
those described in this document as extensions to address parallel
|
| 543 |
+
architectures that require idiosyncratic parameters for efficient
|
| 544 |
+
execution. — *end note*]
|
| 545 |
+
|
| 546 |
+
#### Execution policy type trait <a id="execpol.type">[[execpol.type]]</a>
|
| 547 |
+
|
| 548 |
+
``` cpp
|
| 549 |
+
template<class T> struct is_execution_policy;
|
| 550 |
+
```
|
| 551 |
+
|
| 552 |
+
`is_execution_policy` can be used to detect execution policies for the
|
| 553 |
+
purpose of excluding function signatures from otherwise ambiguous
|
| 554 |
+
overload resolution participation.
|
| 555 |
+
|
| 556 |
+
`is_execution_policy<T>` is a *Cpp17UnaryTypeTrait* with a base
|
| 557 |
+
characteristic of `true_type` if `T` is the type of a standard or
|
| 558 |
+
*implementation-defined* execution policy, otherwise `false_type`.
|
| 559 |
+
|
| 560 |
+
[*Note 1*: This provision reserves the privilege of creating
|
| 561 |
+
non-standard execution policies to the library
|
| 562 |
+
implementation. — *end note*]
|
| 563 |
+
|
| 564 |
+
The behavior of a program that adds specializations for
|
| 565 |
+
`is_execution_policy` is undefined.
|
| 566 |
+
|
| 567 |
+
#### Sequenced execution policy <a id="execpol.seq">[[execpol.seq]]</a>
|
| 568 |
+
|
| 569 |
+
``` cpp
|
| 570 |
+
class execution::sequenced_policy { unspecified };
|
| 571 |
+
```
|
| 572 |
+
|
| 573 |
+
The class `execution::sequenced_policy` is an execution policy type used
|
| 574 |
+
as a unique type to disambiguate parallel algorithm overloading and
|
| 575 |
+
require that a parallel algorithm’s execution may not be parallelized.
|
| 576 |
+
|
| 577 |
+
During the execution of a parallel algorithm with the
|
| 578 |
+
`execution::sequenced_policy` policy, if the invocation of an element
|
| 579 |
+
access function exits via an exception, `terminate` is
|
| 580 |
+
invoked [[except.terminate]].
|
| 581 |
+
|
| 582 |
+
#### Parallel execution policy <a id="execpol.par">[[execpol.par]]</a>
|
| 583 |
+
|
| 584 |
+
``` cpp
|
| 585 |
+
class execution::parallel_policy { unspecified };
|
| 586 |
+
```
|
| 587 |
+
|
| 588 |
+
The class `execution::parallel_policy` is an execution policy type used
|
| 589 |
+
as a unique type to disambiguate parallel algorithm overloading and
|
| 590 |
+
indicate that a parallel algorithm’s execution may be parallelized.
|
| 591 |
+
|
| 592 |
+
During the execution of a parallel algorithm with the
|
| 593 |
+
`execution::parallel_policy` policy, if the invocation of an element
|
| 594 |
+
access function exits via an exception, `terminate` is
|
| 595 |
+
invoked [[except.terminate]].
|
| 596 |
+
|
| 597 |
+
#### Parallel and unsequenced execution policy <a id="execpol.parunseq">[[execpol.parunseq]]</a>
|
| 598 |
+
|
| 599 |
+
``` cpp
|
| 600 |
+
class execution::parallel_unsequenced_policy { unspecified };
|
| 601 |
+
```
|
| 602 |
+
|
| 603 |
+
The class `execution::parallel_unsequenced_policy` is an execution
|
| 604 |
+
policy type used as a unique type to disambiguate parallel algorithm
|
| 605 |
+
overloading and indicate that a parallel algorithm’s execution may be
|
| 606 |
+
parallelized and vectorized.
|
| 607 |
+
|
| 608 |
+
During the execution of a parallel algorithm with the
|
| 609 |
+
`execution::parallel_unsequenced_policy` policy, if the invocation of an
|
| 610 |
+
element access function exits via an exception, `terminate` is
|
| 611 |
+
invoked [[except.terminate]].
|
| 612 |
+
|
| 613 |
+
#### Unsequenced execution policy <a id="execpol.unseq">[[execpol.unseq]]</a>
|
| 614 |
+
|
| 615 |
+
``` cpp
|
| 616 |
+
class execution::unsequenced_policy { unspecified };
|
| 617 |
+
```
|
| 618 |
+
|
| 619 |
+
The class `unsequenced_policy` is an execution policy type used as a
|
| 620 |
+
unique type to disambiguate parallel algorithm overloading and indicate
|
| 621 |
+
that a parallel algorithm’s execution may be vectorized, e.g., executed
|
| 622 |
+
on a single thread using instructions that operate on multiple data
|
| 623 |
+
items.
|
| 624 |
+
|
| 625 |
+
During the execution of a parallel algorithm with the
|
| 626 |
+
`execution::unsequenced_policy` policy, if the invocation of an element
|
| 627 |
+
access function exits via an exception, `terminate` is
|
| 628 |
+
invoked [[except.terminate]].
|
| 629 |
+
|
| 630 |
+
#### Execution policy objects <a id="execpol.objects">[[execpol.objects]]</a>
|
| 631 |
+
|
| 632 |
+
``` cpp
|
| 633 |
+
inline constexpr execution::sequenced_policy execution::seq{ unspecified };
|
| 634 |
+
inline constexpr execution::parallel_policy execution::par{ unspecified };
|
| 635 |
+
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ unspecified };
|
| 636 |
+
inline constexpr execution::unsequenced_policy execution::unseq{ unspecified };
|
| 637 |
+
```
|
| 638 |
+
|
| 639 |
+
The header `<execution>` declares global objects associated with each
|
| 640 |
+
type of execution policy.
|
| 641 |
|
| 642 |
## Header `<algorithm>` synopsis <a id="algorithm.syn">[[algorithm.syn]]</a>
|
| 643 |
|
| 644 |
``` cpp
|
| 645 |
+
// mostly freestanding
|
| 646 |
#include <initializer_list> // see [initializer.list.syn]
|
| 647 |
|
| 648 |
namespace std {
|
| 649 |
namespace ranges {
|
| 650 |
// [algorithms.results], algorithm result types
|
|
|
|
| 679 |
// [alg.nonmodifying], non-modifying sequence operations
|
| 680 |
// [alg.all.of], all of
|
| 681 |
template<class InputIterator, class Predicate>
|
| 682 |
constexpr bool all_of(InputIterator first, InputIterator last, Predicate pred);
|
| 683 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 684 |
+
bool all_of(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 685 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 686 |
|
| 687 |
namespace ranges {
|
| 688 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 689 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 690 |
constexpr bool all_of(I first, S last, Pred pred, Proj proj = {});
|
| 691 |
template<input_range R, class Proj = identity,
|
| 692 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 693 |
constexpr bool all_of(R&& r, Pred pred, Proj proj = {});
|
| 694 |
+
|
| 695 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 696 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 697 |
+
bool all_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 698 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 699 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 700 |
+
bool all_of(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 701 |
}
|
| 702 |
|
| 703 |
// [alg.any.of], any of
|
| 704 |
template<class InputIterator, class Predicate>
|
| 705 |
constexpr bool any_of(InputIterator first, InputIterator last, Predicate pred);
|
| 706 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 707 |
+
bool any_of(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 708 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 709 |
|
| 710 |
namespace ranges {
|
| 711 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 712 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 713 |
constexpr bool any_of(I first, S last, Pred pred, Proj proj = {});
|
| 714 |
template<input_range R, class Proj = identity,
|
| 715 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 716 |
constexpr bool any_of(R&& r, Pred pred, Proj proj = {});
|
| 717 |
+
|
| 718 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 719 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 720 |
+
bool any_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 721 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 722 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 723 |
+
bool any_of(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 724 |
}
|
| 725 |
|
| 726 |
// [alg.none.of], none of
|
| 727 |
template<class InputIterator, class Predicate>
|
| 728 |
constexpr bool none_of(InputIterator first, InputIterator last, Predicate pred);
|
| 729 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 730 |
+
bool none_of(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 731 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 732 |
|
| 733 |
namespace ranges {
|
| 734 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 735 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 736 |
constexpr bool none_of(I first, S last, Pred pred, Proj proj = {});
|
| 737 |
template<input_range R, class Proj = identity,
|
| 738 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 739 |
constexpr bool none_of(R&& r, Pred pred, Proj proj = {});
|
| 740 |
+
|
| 741 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 742 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 743 |
+
bool none_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 744 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 745 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 746 |
+
bool none_of(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 747 |
}
|
| 748 |
|
| 749 |
// [alg.contains], contains
|
| 750 |
namespace ranges {
|
| 751 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 752 |
+
class T = projected_value_t<I, Proj>>
|
| 753 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 754 |
constexpr bool contains(I first, S last, const T& value, Proj proj = {});
|
| 755 |
+
template<input_range R, class Proj = identity,
|
| 756 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 757 |
requires
|
| 758 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 759 |
constexpr bool contains(R&& r, const T& value, Proj proj = {});
|
| 760 |
|
| 761 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 762 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 763 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 764 |
+
bool contains(Ep&& exec, I first, S last, const T& value,
|
| 765 |
+
Proj proj = {}); // freestanding-deleted
|
| 766 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 767 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 768 |
+
requires
|
| 769 |
+
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 770 |
+
bool contains(Ep&& exec, R&& r, const T& value, Proj proj = {}); // freestanding-deleted
|
| 771 |
+
|
| 772 |
template<forward_iterator I1, sentinel_for<I1> S1,
|
| 773 |
forward_iterator I2, sentinel_for<I2> S2,
|
| 774 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 775 |
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 776 |
constexpr bool contains_subrange(I1 first1, S1 last1, I2 first2, S2 last2,
|
|
|
|
| 778 |
template<forward_range R1, forward_range R2,
|
| 779 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 780 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 781 |
constexpr bool contains_subrange(R1&& r1, R2&& r2,
|
| 782 |
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 783 |
+
|
| 784 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 785 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 786 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 787 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 788 |
+
bool contains_subrange(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 789 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 790 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 791 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 792 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 793 |
+
bool contains_subrange(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {},
|
| 794 |
+
Proj2 proj2 = {}); // freestanding-deleted
|
| 795 |
}
|
| 796 |
|
| 797 |
// [alg.foreach], for each
|
| 798 |
template<class InputIterator, class Function>
|
| 799 |
constexpr Function for_each(InputIterator first, InputIterator last, Function f);
|
| 800 |
template<class ExecutionPolicy, class ForwardIterator, class Function>
|
| 801 |
+
void for_each(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 802 |
ForwardIterator first, ForwardIterator last, Function f);
|
| 803 |
|
| 804 |
namespace ranges {
|
| 805 |
template<class I, class F>
|
| 806 |
using for_each_result = in_fun_result<I, F>;
|
|
|
|
| 811 |
for_each(I first, S last, Fun f, Proj proj = {});
|
| 812 |
template<input_range R, class Proj = identity,
|
| 813 |
indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
|
| 814 |
constexpr for_each_result<borrowed_iterator_t<R>, Fun>
|
| 815 |
for_each(R&& r, Fun f, Proj proj = {});
|
| 816 |
+
|
| 817 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 818 |
+
class Proj = identity,
|
| 819 |
+
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 820 |
+
I for_each(Ep&& exec, I first, S last, Fun f, Proj proj = {}); // freestanding-deleted
|
| 821 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 822 |
+
indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
|
| 823 |
+
borrowed_iterator_t<R>
|
| 824 |
+
for_each(Ep&& exec, R&& r, Fun f, Proj proj = {}); // freestanding-deleted
|
| 825 |
}
|
| 826 |
|
| 827 |
template<class InputIterator, class Size, class Function>
|
| 828 |
constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
|
| 829 |
template<class ExecutionPolicy, class ForwardIterator, class Size, class Function>
|
| 830 |
+
ForwardIterator for_each_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 831 |
ForwardIterator first, Size n, Function f);
|
| 832 |
|
| 833 |
namespace ranges {
|
| 834 |
template<class I, class F>
|
| 835 |
using for_each_n_result = in_fun_result<I, F>;
|
| 836 |
|
| 837 |
template<input_iterator I, class Proj = identity,
|
| 838 |
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 839 |
constexpr for_each_n_result<I, Fun>
|
| 840 |
for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {});
|
| 841 |
+
|
| 842 |
+
template<execution-policy Ep, random_access_iterator I, class Proj = identity,
|
| 843 |
+
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 844 |
+
I for_each_n(Ep&& exec, I first, iter_difference_t<I> n, Fun f,
|
| 845 |
+
Proj proj = {}); // freestanding-deleted
|
| 846 |
}
|
| 847 |
|
| 848 |
// [alg.find], find
|
| 849 |
+
template<class InputIterator, class T = iterator_traits<InputIterator>::value_type>
|
| 850 |
constexpr InputIterator find(InputIterator first, InputIterator last,
|
| 851 |
const T& value);
|
| 852 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 853 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 854 |
+
ForwardIterator find(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 855 |
ForwardIterator first, ForwardIterator last,
|
| 856 |
const T& value);
|
| 857 |
template<class InputIterator, class Predicate>
|
| 858 |
constexpr InputIterator find_if(InputIterator first, InputIterator last,
|
| 859 |
Predicate pred);
|
| 860 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 861 |
+
ForwardIterator find_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 862 |
ForwardIterator first, ForwardIterator last,
|
| 863 |
Predicate pred);
|
| 864 |
template<class InputIterator, class Predicate>
|
| 865 |
constexpr InputIterator find_if_not(InputIterator first, InputIterator last,
|
| 866 |
Predicate pred);
|
| 867 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 868 |
+
ForwardIterator find_if_not(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 869 |
ForwardIterator first, ForwardIterator last,
|
| 870 |
Predicate pred);
|
| 871 |
|
| 872 |
namespace ranges {
|
| 873 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 874 |
+
class T = projected_value_t<I, Proj>>
|
| 875 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 876 |
constexpr I find(I first, S last, const T& value, Proj proj = {});
|
| 877 |
+
template<input_range R, class Proj = identity,
|
| 878 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 879 |
requires indirect_binary_predicate<ranges::equal_to,
|
| 880 |
projected<iterator_t<R>, Proj>, const T*>
|
| 881 |
constexpr borrowed_iterator_t<R>
|
| 882 |
find(R&& r, const T& value, Proj proj = {});
|
| 883 |
+
|
| 884 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 885 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 886 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 887 |
+
I find(Ep&& exec, I first, S last, const T& value, Proj proj = {}); // freestanding-deleted
|
| 888 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 889 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 890 |
+
requires indirect_binary_predicate<ranges::equal_to,
|
| 891 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 892 |
+
borrowed_iterator_t<R>
|
| 893 |
+
find(Ep&& exec, R&& r, const T& value, Proj proj = {}); // freestanding-deleted
|
| 894 |
+
|
| 895 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 896 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 897 |
constexpr I find_if(I first, S last, Pred pred, Proj proj = {});
|
| 898 |
template<input_range R, class Proj = identity,
|
| 899 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 900 |
constexpr borrowed_iterator_t<R>
|
| 901 |
find_if(R&& r, Pred pred, Proj proj = {});
|
| 902 |
+
|
| 903 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 904 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 905 |
+
I find_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 906 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 907 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 908 |
+
borrowed_iterator_t<R>
|
| 909 |
+
find_if(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 910 |
+
|
| 911 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 912 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 913 |
constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 914 |
template<input_range R, class Proj = identity,
|
| 915 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 916 |
constexpr borrowed_iterator_t<R>
|
| 917 |
find_if_not(R&& r, Pred pred, Proj proj = {});
|
| 918 |
+
|
| 919 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 920 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 921 |
+
I find_if_not(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 922 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 923 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 924 |
+
borrowed_iterator_t<R>
|
| 925 |
+
find_if_not(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 926 |
}
|
| 927 |
|
| 928 |
// [alg.find.last], find last
|
| 929 |
namespace ranges {
|
| 930 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 931 |
+
class T = projected_value_t<I, Proj>>
|
| 932 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 933 |
constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {});
|
| 934 |
+
template<forward_range R, class Proj = identity,
|
| 935 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 936 |
requires
|
| 937 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 938 |
constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {});
|
| 939 |
+
|
| 940 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 941 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 942 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 943 |
+
subrange<I>
|
| 944 |
+
find_last(Ep&& exec, I first, S last, const T& value,
|
| 945 |
+
Proj proj = {}); // freestanding-deleted
|
| 946 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 947 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 948 |
+
requires
|
| 949 |
+
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 950 |
+
borrowed_subrange_t<R>
|
| 951 |
+
find_last(Ep&& exec, R&& r, const T& value, Proj proj = {}); // freestanding-deleted
|
| 952 |
+
|
| 953 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 954 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 955 |
constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {});
|
| 956 |
template<forward_range R, class Proj = identity,
|
| 957 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 958 |
constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {});
|
| 959 |
+
|
| 960 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 961 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 962 |
+
subrange<I>
|
| 963 |
+
find_last_if(Ep&& exec, I first, S last, Pred pred,
|
| 964 |
+
Proj proj = {}); // freestanding-deleted
|
| 965 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 966 |
+
class Proj = identity,
|
| 967 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 968 |
+
borrowed_subrange_t<R>
|
| 969 |
+
find_last_if(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 970 |
+
|
| 971 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 972 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 973 |
constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 974 |
template<forward_range R, class Proj = identity,
|
| 975 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 976 |
constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {});
|
| 977 |
+
|
| 978 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 979 |
+
class Proj = identity,
|
| 980 |
+
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 981 |
+
subrange<I>
|
| 982 |
+
find_last_if_not(Ep&& exec, I first, S last, Pred pred,
|
| 983 |
+
Proj proj = {}); // freestanding-deleted
|
| 984 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 985 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 986 |
+
borrowed_subrange_t<R>
|
| 987 |
+
find_last_if_not(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 988 |
}
|
| 989 |
|
| 990 |
// [alg.find.end], find end
|
| 991 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 992 |
constexpr ForwardIterator1
|
|
|
|
| 997 |
find_end(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 998 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 999 |
BinaryPredicate pred);
|
| 1000 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1001 |
ForwardIterator1
|
| 1002 |
+
find_end(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1003 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1004 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1005 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 1006 |
class ForwardIterator2, class BinaryPredicate>
|
| 1007 |
ForwardIterator1
|
| 1008 |
+
find_end(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1009 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1010 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1011 |
BinaryPredicate pred);
|
| 1012 |
|
| 1013 |
namespace ranges {
|
|
|
|
| 1021 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1022 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1023 |
constexpr borrowed_subrange_t<R1>
|
| 1024 |
find_end(R1&& r1, R2&& r2, Pred pred = {},
|
| 1025 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1026 |
+
|
| 1027 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1028 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1029 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1030 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1031 |
+
subrange<I1>
|
| 1032 |
+
find_end(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 1033 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1034 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1035 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1036 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1037 |
+
borrowed_subrange_t<R1>
|
| 1038 |
+
find_end(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 1039 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1040 |
}
|
| 1041 |
|
| 1042 |
+
// [alg.find.first.of], find first of
|
| 1043 |
template<class InputIterator, class ForwardIterator>
|
| 1044 |
constexpr InputIterator
|
| 1045 |
find_first_of(InputIterator first1, InputIterator last1,
|
| 1046 |
ForwardIterator first2, ForwardIterator last2);
|
| 1047 |
template<class InputIterator, class ForwardIterator, class BinaryPredicate>
|
|
|
|
| 1049 |
find_first_of(InputIterator first1, InputIterator last1,
|
| 1050 |
ForwardIterator first2, ForwardIterator last2,
|
| 1051 |
BinaryPredicate pred);
|
| 1052 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1053 |
ForwardIterator1
|
| 1054 |
+
find_first_of(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1055 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1056 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1057 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 1058 |
class ForwardIterator2, class BinaryPredicate>
|
| 1059 |
ForwardIterator1
|
| 1060 |
+
find_first_of(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1061 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1062 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1063 |
BinaryPredicate pred);
|
| 1064 |
|
| 1065 |
namespace ranges {
|
|
|
|
| 1072 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1073 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1074 |
constexpr borrowed_iterator_t<R1>
|
| 1075 |
find_first_of(R1&& r1, R2&& r2, Pred pred = {},
|
| 1076 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1077 |
+
|
| 1078 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1079 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1080 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1081 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1082 |
+
I1 find_first_of(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 1083 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1084 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1085 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1086 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1087 |
+
borrowed_iterator_t<R1>
|
| 1088 |
+
find_first_of(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 1089 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1090 |
}
|
| 1091 |
|
| 1092 |
// [alg.adjacent.find], adjacent find
|
| 1093 |
template<class ForwardIterator>
|
| 1094 |
constexpr ForwardIterator
|
|
|
|
| 1097 |
constexpr ForwardIterator
|
| 1098 |
adjacent_find(ForwardIterator first, ForwardIterator last,
|
| 1099 |
BinaryPredicate pred);
|
| 1100 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 1101 |
ForwardIterator
|
| 1102 |
+
adjacent_find(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1103 |
ForwardIterator first, ForwardIterator last);
|
| 1104 |
template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
|
| 1105 |
ForwardIterator
|
| 1106 |
+
adjacent_find(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1107 |
ForwardIterator first, ForwardIterator last,
|
| 1108 |
BinaryPredicate pred);
|
| 1109 |
|
| 1110 |
namespace ranges {
|
| 1111 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 1116 |
template<forward_range R, class Proj = identity,
|
| 1117 |
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 1118 |
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 1119 |
constexpr borrowed_iterator_t<R>
|
| 1120 |
adjacent_find(R&& r, Pred pred = {}, Proj proj = {});
|
| 1121 |
+
|
| 1122 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1123 |
+
class Proj = identity,
|
| 1124 |
+
indirect_binary_predicate<projected<I, Proj>,
|
| 1125 |
+
projected<I, Proj>> Pred = ranges::equal_to>
|
| 1126 |
+
I adjacent_find(Ep&& exec, I first, S last, Pred pred = {},
|
| 1127 |
+
Proj proj = {}); // freestanding-deleted
|
| 1128 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 1129 |
+
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 1130 |
+
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 1131 |
+
borrowed_iterator_t<R>
|
| 1132 |
+
adjacent_find(Ep&& exec, R&& r, Pred pred = {}, Proj proj = {}); // freestanding-deleted
|
| 1133 |
}
|
| 1134 |
|
| 1135 |
// [alg.count], count
|
| 1136 |
+
template<class InputIterator, class T = iterator_traits<InputIterator>::value_type>
|
| 1137 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 1138 |
count(InputIterator first, InputIterator last, const T& value);
|
| 1139 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 1140 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1141 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 1142 |
+
count(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1143 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 1144 |
template<class InputIterator, class Predicate>
|
| 1145 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 1146 |
count_if(InputIterator first, InputIterator last, Predicate pred);
|
| 1147 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 1148 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 1149 |
+
count_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1150 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 1151 |
|
| 1152 |
namespace ranges {
|
| 1153 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 1154 |
+
class T = projected_value_t<I, Proj>>
|
| 1155 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 1156 |
constexpr iter_difference_t<I>
|
| 1157 |
count(I first, S last, const T& value, Proj proj = {});
|
| 1158 |
+
template<input_range R, class Proj = identity,
|
| 1159 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 1160 |
requires indirect_binary_predicate<ranges::equal_to,
|
| 1161 |
projected<iterator_t<R>, Proj>, const T*>
|
| 1162 |
constexpr range_difference_t<R>
|
| 1163 |
count(R&& r, const T& value, Proj proj = {});
|
| 1164 |
+
|
| 1165 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1166 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 1167 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 1168 |
+
iter_difference_t<I>
|
| 1169 |
+
count(Ep&& exec, I first, S last, const T& value, Proj proj = {}); // freestanding-deleted
|
| 1170 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 1171 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 1172 |
+
requires indirect_binary_predicate<ranges::equal_to,
|
| 1173 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 1174 |
+
range_difference_t<R>
|
| 1175 |
+
count(Ep&& exec, R&& r, const T& value, Proj proj = {}); // freestanding-deleted
|
| 1176 |
+
|
| 1177 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 1178 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1179 |
constexpr iter_difference_t<I>
|
| 1180 |
count_if(I first, S last, Pred pred, Proj proj = {});
|
| 1181 |
template<input_range R, class Proj = identity,
|
| 1182 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1183 |
constexpr range_difference_t<R>
|
| 1184 |
count_if(R&& r, Pred pred, Proj proj = {});
|
| 1185 |
+
|
| 1186 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1187 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1188 |
+
iter_difference_t<I>
|
| 1189 |
+
count_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 1190 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 1191 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1192 |
+
range_difference_t<R>
|
| 1193 |
+
count_if(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 1194 |
}
|
| 1195 |
|
| 1196 |
+
// [alg.mismatch], mismatch
|
| 1197 |
template<class InputIterator1, class InputIterator2>
|
| 1198 |
constexpr pair<InputIterator1, InputIterator2>
|
| 1199 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 1200 |
InputIterator2 first2);
|
| 1201 |
template<class InputIterator1, class InputIterator2, class BinaryPredicate>
|
|
|
|
| 1211 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 1212 |
InputIterator2 first2, InputIterator2 last2,
|
| 1213 |
BinaryPredicate pred);
|
| 1214 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1215 |
pair<ForwardIterator1, ForwardIterator2>
|
| 1216 |
+
mismatch(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1217 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1218 |
ForwardIterator2 first2);
|
| 1219 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1220 |
class BinaryPredicate>
|
| 1221 |
pair<ForwardIterator1, ForwardIterator2>
|
| 1222 |
+
mismatch(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1223 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1224 |
ForwardIterator2 first2, BinaryPredicate pred);
|
| 1225 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1226 |
pair<ForwardIterator1, ForwardIterator2>
|
| 1227 |
+
mismatch(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1228 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1229 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1230 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1231 |
class BinaryPredicate>
|
| 1232 |
pair<ForwardIterator1, ForwardIterator2>
|
| 1233 |
+
mismatch(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1234 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1235 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1236 |
BinaryPredicate pred);
|
| 1237 |
|
| 1238 |
namespace ranges {
|
|
|
|
| 1249 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1250 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1251 |
constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1252 |
mismatch(R1&& r1, R2&& r2, Pred pred = {},
|
| 1253 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1254 |
+
|
| 1255 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1256 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1257 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1258 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1259 |
+
mismatch_result<I1, I2>
|
| 1260 |
+
mismatch(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 1261 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1262 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1263 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1264 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1265 |
+
mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1266 |
+
mismatch(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 1267 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1268 |
}
|
| 1269 |
|
| 1270 |
// [alg.equal], equal
|
| 1271 |
template<class InputIterator1, class InputIterator2>
|
| 1272 |
constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 1280 |
template<class InputIterator1, class InputIterator2, class BinaryPredicate>
|
| 1281 |
constexpr bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 1282 |
InputIterator2 first2, InputIterator2 last2,
|
| 1283 |
BinaryPredicate pred);
|
| 1284 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1285 |
+
bool equal(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1286 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1287 |
ForwardIterator2 first2);
|
| 1288 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1289 |
class BinaryPredicate>
|
| 1290 |
+
bool equal(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1291 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1292 |
ForwardIterator2 first2, BinaryPredicate pred);
|
| 1293 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1294 |
+
bool equal(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1295 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1296 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1297 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1298 |
class BinaryPredicate>
|
| 1299 |
+
bool equal(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1300 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1301 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1302 |
BinaryPredicate pred);
|
| 1303 |
|
| 1304 |
namespace ranges {
|
|
|
|
| 1311 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to,
|
| 1312 |
class Proj1 = identity, class Proj2 = identity>
|
| 1313 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1314 |
constexpr bool equal(R1&& r1, R2&& r2, Pred pred = {},
|
| 1315 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1316 |
+
|
| 1317 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1318 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1319 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1320 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1321 |
+
bool equal(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 1322 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1323 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1324 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1325 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1326 |
+
bool equal(Ep&& exec, R1&& r1, R2&& r2,
|
| 1327 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1328 |
}
|
| 1329 |
|
| 1330 |
// [alg.is.permutation], is permutation
|
| 1331 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 1332 |
constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
|
|
|
| 1369 |
search(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1370 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1371 |
BinaryPredicate pred);
|
| 1372 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1373 |
ForwardIterator1
|
| 1374 |
+
search(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1375 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1376 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 1377 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1378 |
class BinaryPredicate>
|
| 1379 |
ForwardIterator1
|
| 1380 |
+
search(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1381 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1382 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 1383 |
BinaryPredicate pred);
|
| 1384 |
|
| 1385 |
namespace ranges {
|
|
|
|
| 1394 |
class Proj1 = identity, class Proj2 = identity>
|
| 1395 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1396 |
constexpr borrowed_subrange_t<R1>
|
| 1397 |
search(R1&& r1, R2&& r2, Pred pred = {},
|
| 1398 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1399 |
+
|
| 1400 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1401 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1402 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1403 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1404 |
+
subrange<I1>
|
| 1405 |
+
search(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 1406 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1407 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1408 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1409 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1410 |
+
borrowed_subrange_t<R1>
|
| 1411 |
+
search(Ep&& exec, R1&& r1, R2&& r2,
|
| 1412 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1413 |
}
|
| 1414 |
|
| 1415 |
+
template<class ForwardIterator, class Size,
|
| 1416 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1417 |
constexpr ForwardIterator
|
| 1418 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 1419 |
Size count, const T& value);
|
| 1420 |
+
template<class ForwardIterator, class Size,
|
| 1421 |
+
class T = iterator_traits<ForwardIterator>::value_type, class BinaryPredicate>
|
| 1422 |
constexpr ForwardIterator
|
| 1423 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 1424 |
Size count, const T& value, BinaryPredicate pred);
|
| 1425 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 1426 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1427 |
ForwardIterator
|
| 1428 |
+
search_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1429 |
ForwardIterator first, ForwardIterator last,
|
| 1430 |
Size count, const T& value);
|
| 1431 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 1432 |
+
class T = iterator_traits<ForwardIterator>::value_type, class BinaryPredicate>
|
| 1433 |
ForwardIterator
|
| 1434 |
+
search_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1435 |
ForwardIterator first, ForwardIterator last,
|
| 1436 |
Size count, const T& value,
|
| 1437 |
BinaryPredicate pred);
|
| 1438 |
|
| 1439 |
namespace ranges {
|
| 1440 |
+
template<forward_iterator I, sentinel_for<I> S,
|
| 1441 |
+
class Pred = ranges::equal_to, class Proj = identity,
|
| 1442 |
+
class T = projected_value_t<I, Proj>>
|
| 1443 |
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 1444 |
constexpr subrange<I>
|
| 1445 |
search_n(I first, S last, iter_difference_t<I> count,
|
| 1446 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 1447 |
+
template<forward_range R, class Pred = ranges::equal_to,
|
| 1448 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 1449 |
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 1450 |
constexpr borrowed_subrange_t<R>
|
| 1451 |
search_n(R&& r, range_difference_t<R> count,
|
| 1452 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 1453 |
+
|
| 1454 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1455 |
+
class Pred = ranges::equal_to, class Proj = identity,
|
| 1456 |
+
class T = projected_value_t<I, Proj>>
|
| 1457 |
+
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 1458 |
+
subrange<I>
|
| 1459 |
+
search_n(Ep&& exec, I first, S last, iter_difference_t<I> count,
|
| 1460 |
+
const T& value, Pred pred = {}, Proj proj = {}); // freestanding-deleted
|
| 1461 |
+
template<execution-policy Ep, sized-random-access-range R, class Pred = ranges::equal_to,
|
| 1462 |
+
class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 1463 |
+
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 1464 |
+
borrowed_subrange_t<R>
|
| 1465 |
+
search_n(Ep&& exec, R&& r, range_difference_t<R> count,
|
| 1466 |
+
const T& value, Pred pred = {}, Proj proj = {}); // freestanding-deleted
|
| 1467 |
}
|
| 1468 |
|
| 1469 |
template<class ForwardIterator, class Searcher>
|
| 1470 |
constexpr ForwardIterator
|
| 1471 |
search(ForwardIterator first, ForwardIterator last, const Searcher& searcher);
|
|
|
|
| 1481 |
class Proj1 = identity, class Proj2 = identity>
|
| 1482 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1483 |
constexpr bool starts_with(R1&& r1, R2&& r2, Pred pred = {},
|
| 1484 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1485 |
|
| 1486 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1487 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1488 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1489 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1490 |
+
bool starts_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 1491 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1492 |
+
template<execution-policy Ep, sized-random-access-range R1,
|
| 1493 |
+
sized-random-access-range R2, class Pred = ranges::equal_to,
|
| 1494 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 1495 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1496 |
+
bool starts_with(Ep&& exec, R1&& r1, R2&& r2,
|
| 1497 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1498 |
+
|
| 1499 |
// [alg.ends.with], ends with
|
| 1500 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 1501 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1502 |
requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) &&
|
| 1503 |
(forward_iterator<I2> || sized_sentinel_for<S2, I2>) &&
|
|
|
|
| 1510 |
(forward_range<R2> || sized_range<R2>) &&
|
| 1511 |
indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1512 |
constexpr bool ends_with(R1&& r1, R2&& r2, Pred pred = {},
|
| 1513 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1514 |
|
| 1515 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1516 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1517 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 1518 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 1519 |
+
bool ends_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 1520 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1521 |
+
template<execution-policy Ep, sized-random-access-range R1,
|
| 1522 |
+
sized-random-access-range R2, class Pred = ranges::equal_to,
|
| 1523 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 1524 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 1525 |
+
bool ends_with(Ep&& exec, R1&& r1, R2&& r2,
|
| 1526 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1527 |
+
|
| 1528 |
// [alg.fold], fold
|
| 1529 |
template<class F>
|
| 1530 |
class flipped { // exposition only
|
| 1531 |
F f; // exposition only
|
| 1532 |
|
|
|
|
| 1552 |
|
| 1553 |
template<class F, class T, class I>
|
| 1554 |
concept indirectly-binary-right-foldable = // exposition only
|
| 1555 |
indirectly-binary-left-foldable<flipped<F>, T, I>;
|
| 1556 |
|
| 1557 |
+
template<input_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 1558 |
indirectly-binary-left-foldable<T, I> F>
|
| 1559 |
constexpr auto fold_left(I first, S last, T init, F f);
|
| 1560 |
|
| 1561 |
+
template<input_range R, class T = range_value_t<R>,
|
| 1562 |
+
indirectly-binary-left-foldable<T, iterator_t<R>> F>
|
| 1563 |
constexpr auto fold_left(R&& r, T init, F f);
|
| 1564 |
|
| 1565 |
template<input_iterator I, sentinel_for<I> S,
|
| 1566 |
indirectly-binary-left-foldable<iter_value_t<I>, I> F>
|
| 1567 |
requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
|
|
|
|
| 1569 |
|
| 1570 |
template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F>
|
| 1571 |
requires constructible_from<range_value_t<R>, range_reference_t<R>>
|
| 1572 |
constexpr auto fold_left_first(R&& r, F f);
|
| 1573 |
|
| 1574 |
+
template<bidirectional_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 1575 |
indirectly-binary-right-foldable<T, I> F>
|
| 1576 |
constexpr auto fold_right(I first, S last, T init, F f);
|
| 1577 |
|
| 1578 |
+
template<bidirectional_range R, class T = range_value_t<R>,
|
| 1579 |
indirectly-binary-right-foldable<T, iterator_t<R>> F>
|
| 1580 |
constexpr auto fold_right(R&& r, T init, F f);
|
| 1581 |
|
| 1582 |
template<bidirectional_iterator I, sentinel_for<I> S,
|
| 1583 |
indirectly-binary-right-foldable<iter_value_t<I>, I> F>
|
|
|
|
| 1592 |
template<class I, class T>
|
| 1593 |
using fold_left_with_iter_result = in_value_result<I, T>;
|
| 1594 |
template<class I, class T>
|
| 1595 |
using fold_left_first_with_iter_result = in_value_result<I, T>;
|
| 1596 |
|
| 1597 |
+
template<input_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 1598 |
indirectly-binary-left-foldable<T, I> F>
|
| 1599 |
constexpr see below fold_left_with_iter(I first, S last, T init, F f);
|
| 1600 |
|
| 1601 |
+
template<input_range R, class T = range_value_t<R>,
|
| 1602 |
+
indirectly-binary-left-foldable<T, iterator_t<R>> F>
|
| 1603 |
constexpr see below fold_left_with_iter(R&& r, T init, F f);
|
| 1604 |
|
| 1605 |
template<input_iterator I, sentinel_for<I> S,
|
| 1606 |
indirectly-binary-left-foldable<iter_value_t<I>, I> F>
|
| 1607 |
requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
|
|
|
|
| 1617 |
// [alg.copy], copy
|
| 1618 |
template<class InputIterator, class OutputIterator>
|
| 1619 |
constexpr OutputIterator copy(InputIterator first, InputIterator last,
|
| 1620 |
OutputIterator result);
|
| 1621 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1622 |
+
ForwardIterator2 copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1623 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1624 |
ForwardIterator2 result);
|
| 1625 |
|
| 1626 |
namespace ranges {
|
| 1627 |
template<class I, class O>
|
|
|
|
| 1633 |
copy(I first, S last, O result);
|
| 1634 |
template<input_range R, weakly_incrementable O>
|
| 1635 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1636 |
constexpr copy_result<borrowed_iterator_t<R>, O>
|
| 1637 |
copy(R&& r, O result);
|
| 1638 |
+
|
| 1639 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1640 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 1641 |
+
requires indirectly_copyable<I, O>
|
| 1642 |
+
copy_result<I, O>
|
| 1643 |
+
copy(Ep&& exec, I first, S last, O result, OutS result_last); // freestanding-deleted
|
| 1644 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 1645 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 1646 |
+
copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 1647 |
+
copy(Ep&& exec, R&& r, OutR&& result_r); // freestanding-deleted
|
| 1648 |
}
|
| 1649 |
|
| 1650 |
template<class InputIterator, class Size, class OutputIterator>
|
| 1651 |
constexpr OutputIterator copy_n(InputIterator first, Size n,
|
| 1652 |
OutputIterator result);
|
| 1653 |
template<class ExecutionPolicy, class ForwardIterator1, class Size,
|
| 1654 |
class ForwardIterator2>
|
| 1655 |
+
ForwardIterator2 copy_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1656 |
ForwardIterator1 first, Size n,
|
| 1657 |
ForwardIterator2 result);
|
| 1658 |
|
| 1659 |
namespace ranges {
|
| 1660 |
template<class I, class O>
|
|
|
|
| 1662 |
|
| 1663 |
template<input_iterator I, weakly_incrementable O>
|
| 1664 |
requires indirectly_copyable<I, O>
|
| 1665 |
constexpr copy_n_result<I, O>
|
| 1666 |
copy_n(I first, iter_difference_t<I> n, O result);
|
| 1667 |
+
|
| 1668 |
+
template<execution-policy Ep, random_access_iterator I, random_access_iterator O,
|
| 1669 |
+
sized_sentinel_for<O> OutS>
|
| 1670 |
+
requires indirectly_copyable<I, O>
|
| 1671 |
+
copy_n_result<I, O>
|
| 1672 |
+
copy_n(Ep&& exec, I first, iter_difference_t<I> n, O result,
|
| 1673 |
+
OutS result_last); // freestanding-deleted
|
| 1674 |
}
|
| 1675 |
|
| 1676 |
template<class InputIterator, class OutputIterator, class Predicate>
|
| 1677 |
constexpr OutputIterator copy_if(InputIterator first, InputIterator last,
|
| 1678 |
OutputIterator result, Predicate pred);
|
| 1679 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1680 |
class Predicate>
|
| 1681 |
+
ForwardIterator2 copy_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1682 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1683 |
ForwardIterator2 result, Predicate pred);
|
| 1684 |
|
| 1685 |
namespace ranges {
|
| 1686 |
template<class I, class O>
|
|
|
|
| 1694 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 1695 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1696 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 1697 |
constexpr copy_if_result<borrowed_iterator_t<R>, O>
|
| 1698 |
copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
| 1699 |
+
|
| 1700 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1701 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 1702 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1703 |
+
requires indirectly_copyable<I, O>
|
| 1704 |
+
copy_if_result<I, O>
|
| 1705 |
+
copy_if(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 1706 |
+
Pred pred, Proj proj = {}); // freestanding-deleted
|
| 1707 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 1708 |
+
class Proj = identity,
|
| 1709 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1710 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 1711 |
+
copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 1712 |
+
copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred,
|
| 1713 |
+
Proj proj = {}); // freestanding-deleted
|
| 1714 |
}
|
| 1715 |
|
| 1716 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
| 1717 |
constexpr BidirectionalIterator2
|
| 1718 |
copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
|
|
|
|
| 1736 |
template<class InputIterator, class OutputIterator>
|
| 1737 |
constexpr OutputIterator move(InputIterator first, InputIterator last,
|
| 1738 |
OutputIterator result);
|
| 1739 |
template<class ExecutionPolicy, class ForwardIterator1,
|
| 1740 |
class ForwardIterator2>
|
| 1741 |
+
ForwardIterator2 move(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1742 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 1743 |
ForwardIterator2 result);
|
| 1744 |
|
| 1745 |
namespace ranges {
|
| 1746 |
template<class I, class O>
|
|
|
|
| 1752 |
move(I first, S last, O result);
|
| 1753 |
template<input_range R, weakly_incrementable O>
|
| 1754 |
requires indirectly_movable<iterator_t<R>, O>
|
| 1755 |
constexpr move_result<borrowed_iterator_t<R>, O>
|
| 1756 |
move(R&& r, O result);
|
| 1757 |
+
|
| 1758 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1759 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 1760 |
+
requires indirectly_movable<I, O>
|
| 1761 |
+
move_result<I, O>
|
| 1762 |
+
move(Ep&& exec, I first, S last, O result, OutS result_last); // freestanding-deleted
|
| 1763 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 1764 |
+
requires indirectly_movable<iterator_t<R>, iterator_t<OutR>>
|
| 1765 |
+
move_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 1766 |
+
move(Ep&& exec, R&& r, OutR&& result_r); // freestanding-deleted
|
| 1767 |
}
|
| 1768 |
|
| 1769 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
| 1770 |
constexpr BidirectionalIterator2
|
| 1771 |
move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
|
|
|
|
| 1788 |
// [alg.swap], swap
|
| 1789 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 1790 |
constexpr ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1791 |
ForwardIterator2 first2);
|
| 1792 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 1793 |
+
ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1794 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1795 |
ForwardIterator2 first2);
|
| 1796 |
|
| 1797 |
namespace ranges {
|
| 1798 |
template<class I1, class I2>
|
|
|
|
| 1804 |
swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
|
| 1805 |
template<input_range R1, input_range R2>
|
| 1806 |
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 1807 |
constexpr swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1808 |
swap_ranges(R1&& r1, R2&& r2);
|
| 1809 |
+
|
| 1810 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1811 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2>
|
| 1812 |
+
requires indirectly_swappable<I1, I2>
|
| 1813 |
+
swap_ranges_result<I1, I2>
|
| 1814 |
+
swap_ranges(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2); // freestanding-deleted
|
| 1815 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2>
|
| 1816 |
+
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 1817 |
+
swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 1818 |
+
swap_ranges(Ep&& exec, R1&& r1, R2&& r2); // freestanding-deleted
|
| 1819 |
}
|
| 1820 |
|
| 1821 |
template<class ForwardIterator1, class ForwardIterator2>
|
| 1822 |
constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b);
|
| 1823 |
|
|
|
|
| 1833 |
InputIterator2 first2, OutputIterator result,
|
| 1834 |
BinaryOperation binary_op);
|
| 1835 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1836 |
class UnaryOperation>
|
| 1837 |
ForwardIterator2
|
| 1838 |
+
transform(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1839 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1840 |
ForwardIterator2 result, UnaryOperation op);
|
| 1841 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 1842 |
class ForwardIterator, class BinaryOperation>
|
| 1843 |
ForwardIterator
|
| 1844 |
+
transform(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1845 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 1846 |
ForwardIterator2 first2, ForwardIterator result,
|
| 1847 |
BinaryOperation binary_op);
|
| 1848 |
|
| 1849 |
namespace ranges {
|
|
|
|
| 1859 |
class Proj = identity>
|
| 1860 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 1861 |
constexpr unary_transform_result<borrowed_iterator_t<R>, O>
|
| 1862 |
transform(R&& r, O result, F op, Proj proj = {});
|
| 1863 |
|
| 1864 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1865 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 1866 |
+
copy_constructible F, class Proj = identity>
|
| 1867 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
|
| 1868 |
+
unary_transform_result<I, O>
|
| 1869 |
+
transform(Ep&& exec, I first1, S last1, O result, OutS result_last,
|
| 1870 |
+
F op, Proj proj = {}); // freestanding-deleted
|
| 1871 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 1872 |
+
copy_constructible F, class Proj = identity>
|
| 1873 |
+
requires indirectly_writable<iterator_t<OutR>,
|
| 1874 |
+
indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 1875 |
+
unary_transform_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 1876 |
+
transform(Ep&& exec, R&& r, OutR&& result_r, F op, Proj proj = {}); // freestanding-deleted
|
| 1877 |
+
|
| 1878 |
template<class I1, class I2, class O>
|
| 1879 |
using binary_transform_result = in_in_out_result<I1, I2, O>;
|
| 1880 |
|
| 1881 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 1882 |
weakly_incrementable O, copy_constructible F, class Proj1 = identity,
|
|
|
|
| 1891 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 1892 |
projected<iterator_t<R2>, Proj2>>>
|
| 1893 |
constexpr binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 1894 |
transform(R1&& r1, R2&& r2, O result,
|
| 1895 |
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 1896 |
+
|
| 1897 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 1898 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 1899 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 1900 |
+
copy_constructible F, class Proj1 = identity, class Proj2 = identity>
|
| 1901 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
|
| 1902 |
+
projected<I2, Proj2>>>
|
| 1903 |
+
binary_transform_result<I1, I2, O>
|
| 1904 |
+
transform(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 1905 |
+
O result, OutS result_last,
|
| 1906 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1907 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 1908 |
+
sized-random-access-range OutR, copy_constructible F,
|
| 1909 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 1910 |
+
requires indirectly_writable<iterator_t<OutR>,
|
| 1911 |
+
indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 1912 |
+
projected<iterator_t<R2>, Proj2>>>
|
| 1913 |
+
binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 1914 |
+
borrowed_iterator_t<OutR>>
|
| 1915 |
+
transform(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
|
| 1916 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 1917 |
}
|
| 1918 |
|
| 1919 |
// [alg.replace], replace
|
| 1920 |
template<class ForwardIterator, class T>
|
| 1921 |
constexpr void replace(ForwardIterator first, ForwardIterator last,
|
| 1922 |
const T& old_value, const T& new_value);
|
| 1923 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 1924 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1925 |
+
void replace(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1926 |
ForwardIterator first, ForwardIterator last,
|
| 1927 |
const T& old_value, const T& new_value);
|
| 1928 |
+
template<class ForwardIterator, class Predicate,
|
| 1929 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1930 |
constexpr void replace_if(ForwardIterator first, ForwardIterator last,
|
| 1931 |
Predicate pred, const T& new_value);
|
| 1932 |
+
template<class ExecutionPolicy, class ForwardIterator, class Predicate,
|
| 1933 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 1934 |
+
void replace_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 1935 |
ForwardIterator first, ForwardIterator last,
|
| 1936 |
Predicate pred, const T& new_value);
|
| 1937 |
|
| 1938 |
namespace ranges {
|
| 1939 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 1940 |
+
class T1 = projected_value_t<I, Proj>, class T2 = T1>
|
| 1941 |
requires indirectly_writable<I, const T2&> &&
|
| 1942 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 1943 |
constexpr I
|
| 1944 |
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 1945 |
+
template<input_range R, class Proj = identity,
|
| 1946 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
|
| 1947 |
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 1948 |
indirect_binary_predicate<ranges::equal_to,
|
| 1949 |
projected<iterator_t<R>, Proj>, const T1*>
|
| 1950 |
constexpr borrowed_iterator_t<R>
|
| 1951 |
replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 1952 |
+
|
| 1953 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1954 |
+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = T1>
|
| 1955 |
+
requires indirectly_writable<I, const T2&> &&
|
| 1956 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 1957 |
+
I replace(Ep&& exec, I first, S last,
|
| 1958 |
+
const T1& old_value, const T2& new_value, Proj proj = {}); // freestanding-deleted
|
| 1959 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 1960 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
|
| 1961 |
+
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 1962 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 1963 |
+
projected<iterator_t<R>, Proj>, const T1*>
|
| 1964 |
+
borrowed_iterator_t<R>
|
| 1965 |
+
replace(Ep&& exec, R&& r, const T1& old_value, const T2& new_value,
|
| 1966 |
+
Proj proj = {}); // freestanding-deleted
|
| 1967 |
+
|
| 1968 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 1969 |
+
class T = projected_value_t<I, Proj>,
|
| 1970 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1971 |
requires indirectly_writable<I, const T&>
|
| 1972 |
constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
|
| 1973 |
+
template<input_range R, class Proj = identity, class T = projected_value_t<I, Proj>,
|
| 1974 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1975 |
requires indirectly_writable<iterator_t<R>, const T&>
|
| 1976 |
constexpr borrowed_iterator_t<R>
|
| 1977 |
replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
|
| 1978 |
+
|
| 1979 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 1980 |
+
class Proj = identity, class T = projected_value_t<I, Proj>,
|
| 1981 |
+
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 1982 |
+
requires indirectly_writable<I, const T&>
|
| 1983 |
+
I replace_if(Ep&& exec, I first, S last, Pred pred,
|
| 1984 |
+
const T& new_value, Proj proj = {}); // freestanding-deleted
|
| 1985 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 1986 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 1987 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 1988 |
+
requires indirectly_writable<iterator_t<R>, const T&>
|
| 1989 |
+
borrowed_iterator_t<R>
|
| 1990 |
+
replace_if(Ep&& exec, R&& r, Pred pred, const T& new_value,
|
| 1991 |
+
Proj proj = {}); // freestanding-deleted
|
| 1992 |
}
|
| 1993 |
|
| 1994 |
template<class InputIterator, class OutputIterator, class T>
|
| 1995 |
constexpr OutputIterator replace_copy(InputIterator first, InputIterator last,
|
| 1996 |
OutputIterator result,
|
| 1997 |
const T& old_value, const T& new_value);
|
| 1998 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
|
| 1999 |
+
ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2000 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2001 |
ForwardIterator2 result,
|
| 2002 |
const T& old_value, const T& new_value);
|
| 2003 |
+
template<class InputIterator, class OutputIterator, class Predicate,
|
| 2004 |
+
class T = iterator_traits<OutputIterator>::value_type>
|
| 2005 |
constexpr OutputIterator replace_copy_if(InputIterator first, InputIterator last,
|
| 2006 |
OutputIterator result,
|
| 2007 |
Predicate pred, const T& new_value);
|
| 2008 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2009 |
+
class Predicate, class T = iterator_traits<ForwardIterator2>::value_type>
|
| 2010 |
+
ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2011 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2012 |
ForwardIterator2 result,
|
| 2013 |
Predicate pred, const T& new_value);
|
| 2014 |
|
| 2015 |
namespace ranges {
|
| 2016 |
template<class I, class O>
|
| 2017 |
using replace_copy_result = in_out_result<I, O>;
|
| 2018 |
|
| 2019 |
+
template<input_iterator I, sentinel_for<I> S, class O,
|
| 2020 |
+
class Proj = identity,
|
| 2021 |
+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<O>>
|
| 2022 |
requires indirectly_copyable<I, O> &&
|
| 2023 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> &&
|
| 2024 |
+
output_iterator<O, const T2&>
|
| 2025 |
constexpr replace_copy_result<I, O>
|
| 2026 |
replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
|
| 2027 |
Proj proj = {});
|
| 2028 |
+
template<input_range R, class O, class Proj = identity,
|
| 2029 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = iter_value_t<O>>
|
| 2030 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 2031 |
indirect_binary_predicate<ranges::equal_to,
|
| 2032 |
+
projected<iterator_t<R>, Proj>, const T1*> &&
|
| 2033 |
+
output_iterator<O, const T2&>
|
| 2034 |
constexpr replace_copy_result<borrowed_iterator_t<R>, O>
|
| 2035 |
replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
|
| 2036 |
Proj proj = {});
|
| 2037 |
|
| 2038 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2039 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 2040 |
+
class Proj = identity,
|
| 2041 |
+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<O>>
|
| 2042 |
+
requires indirectly_copyable<I, O> &&
|
| 2043 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> &&
|
| 2044 |
+
indirectly_writable<O, const T2&>
|
| 2045 |
+
replace_copy_result<I, O>
|
| 2046 |
+
replace_copy(Ep&& exec, I first, S last, O result, OutS result_last, const T1& old_value,
|
| 2047 |
+
const T2& new_value, Proj proj = {}); // freestanding-deleted
|
| 2048 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 2049 |
+
class Proj = identity, class T1 = projected_value_t<iterator_t<R>, Proj>,
|
| 2050 |
+
class T2 = range_value_t<OutR>>
|
| 2051 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 2052 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 2053 |
+
projected<iterator_t<R>, Proj>, const T1*> &&
|
| 2054 |
+
indirectly_writable<iterator_t<OutR>, const T2&>
|
| 2055 |
+
replace_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2056 |
+
replace_copy(Ep&& exec, R&& r, OutR&& result_r, const T1& old_value, const T2& new_value,
|
| 2057 |
+
Proj proj = {}); // freestanding-deleted
|
| 2058 |
+
|
| 2059 |
template<class I, class O>
|
| 2060 |
using replace_copy_if_result = in_out_result<I, O>;
|
| 2061 |
|
| 2062 |
+
template<input_iterator I, sentinel_for<I> S, class O, class T = iter_value_t<O>,
|
| 2063 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2064 |
+
requires indirectly_copyable<I, O> && output_iterator<O, const T&>
|
| 2065 |
constexpr replace_copy_if_result<I, O>
|
| 2066 |
replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
|
| 2067 |
Proj proj = {});
|
| 2068 |
+
template<input_range R, class O, class T = iter_value_t<O>, class Proj = identity,
|
| 2069 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2070 |
+
requires indirectly_copyable<iterator_t<R>, O> && output_iterator<O, const T&>
|
| 2071 |
constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
|
| 2072 |
replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
|
| 2073 |
Proj proj = {});
|
| 2074 |
+
|
| 2075 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2076 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class T = iter_value_t<O>,
|
| 2077 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2078 |
+
requires indirectly_copyable<I, O> && indirectly_writable<O, const T&>
|
| 2079 |
+
replace_copy_if_result<I, O>
|
| 2080 |
+
replace_copy_if(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 2081 |
+
Pred pred, const T& new_value, Proj proj = {}); // freestanding-deleted
|
| 2082 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 2083 |
+
class T = range_value_t<OutR>, class Proj = identity,
|
| 2084 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2085 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 2086 |
+
indirectly_writable<iterator_t<OutR>, const T&>
|
| 2087 |
+
replace_copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2088 |
+
replace_copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred, const T& new_value,
|
| 2089 |
+
Proj proj = {}); // freestanding-deleted
|
| 2090 |
}
|
| 2091 |
|
| 2092 |
// [alg.fill], fill
|
| 2093 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2094 |
constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value);
|
| 2095 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 2096 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 2097 |
+
void fill(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2098 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 2099 |
+
template<class OutputIterator, class Size,
|
| 2100 |
+
class T = iterator_traits<OutputIterator>::value_type>
|
| 2101 |
+
constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value)
|
| 2102 |
template<class ExecutionPolicy, class ForwardIterator,
|
| 2103 |
+
class Size, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2104 |
+
ForwardIterator fill_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2105 |
ForwardIterator first, Size n, const T& value);
|
| 2106 |
|
| 2107 |
namespace ranges {
|
| 2108 |
+
template<class O, sentinel_for<O> S, class T = iter_value_t<O>>
|
| 2109 |
+
requires output_iterator<O, const T&>
|
| 2110 |
constexpr O fill(O first, S last, const T& value);
|
| 2111 |
+
template<class R, class T = range_value_t<R>>
|
| 2112 |
+
requires output_range<R, const T&>
|
| 2113 |
constexpr borrowed_iterator_t<R> fill(R&& r, const T& value);
|
| 2114 |
+
template<class O, class T = iter_value_t<O>>
|
| 2115 |
+
requires output_iterator<O, const T&>
|
| 2116 |
constexpr O fill_n(O first, iter_difference_t<O> n, const T& value);
|
| 2117 |
+
|
| 2118 |
+
template<execution-policy Ep, random_access_iterator O, sized_sentinel_for<O> S,
|
| 2119 |
+
class T = iter_value_t<O>>
|
| 2120 |
+
requires indirectly_writable<O, const T&>
|
| 2121 |
+
O fill(Ep&& exec, O first, S last, const T& value); // freestanding-deleted
|
| 2122 |
+
template<execution-policy Ep, sized-random-access-range R, class T = range_value_t<R>>
|
| 2123 |
+
requires indirectly_writable<iterator_t<R>, const T&>
|
| 2124 |
+
borrowed_iterator_t<R> fill(Ep&& exec, R&& r, const T& value); // freestanding-deleted
|
| 2125 |
+
template<execution-policy Ep, random_access_iterator O, class T = iter_value_t<O>>
|
| 2126 |
+
requires indirectly_writable<O, const T&>
|
| 2127 |
+
O fill_n(Ep&& exec, O first, iter_difference_t<O> n, const T& value); // freestanding-deleted
|
| 2128 |
}
|
| 2129 |
|
| 2130 |
// [alg.generate], generate
|
| 2131 |
template<class ForwardIterator, class Generator>
|
| 2132 |
constexpr void generate(ForwardIterator first, ForwardIterator last,
|
| 2133 |
Generator gen);
|
| 2134 |
template<class ExecutionPolicy, class ForwardIterator, class Generator>
|
| 2135 |
+
void generate(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2136 |
ForwardIterator first, ForwardIterator last,
|
| 2137 |
Generator gen);
|
| 2138 |
template<class OutputIterator, class Size, class Generator>
|
| 2139 |
constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
|
| 2140 |
template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
|
| 2141 |
+
ForwardIterator generate_n(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2142 |
ForwardIterator first, Size n, Generator gen);
|
| 2143 |
|
| 2144 |
namespace ranges {
|
| 2145 |
template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
|
| 2146 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
|
|
|
| 2149 |
requires invocable<F&> && output_range<R, invoke_result_t<F&>>
|
| 2150 |
constexpr borrowed_iterator_t<R> generate(R&& r, F gen);
|
| 2151 |
template<input_or_output_iterator O, copy_constructible F>
|
| 2152 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 2153 |
constexpr O generate_n(O first, iter_difference_t<O> n, F gen);
|
| 2154 |
+
template<execution-policy Ep, random_access_iterator O, sized_sentinel_for<O> S,
|
| 2155 |
+
copy_constructible F>
|
| 2156 |
+
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 2157 |
+
O generate(Ep&& exec, O first, S last, F gen); // freestanding-deleted
|
| 2158 |
+
template<execution-policy Ep, sized-random-access-range R, copy_constructible F>
|
| 2159 |
+
requires invocable<F&> && indirectly_writable<iterator_t<R>, invoke_result_t<F&>>
|
| 2160 |
+
borrowed_iterator_t<R> generate(Ep&& exec, R&& r, F gen); // freestanding-deleted
|
| 2161 |
+
template<execution-policy Ep, random_access_iterator O, copy_constructible F>
|
| 2162 |
+
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 2163 |
+
O generate_n(Ep&& exec, O first, iter_difference_t<O> n, F gen); // freestanding-deleted
|
| 2164 |
}
|
| 2165 |
|
| 2166 |
// [alg.remove], remove
|
| 2167 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2168 |
constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last,
|
| 2169 |
const T& value);
|
| 2170 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 2171 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 2172 |
+
ForwardIterator remove(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2173 |
ForwardIterator first, ForwardIterator last,
|
| 2174 |
const T& value);
|
| 2175 |
template<class ForwardIterator, class Predicate>
|
| 2176 |
constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
|
| 2177 |
Predicate pred);
|
| 2178 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 2179 |
+
ForwardIterator remove_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2180 |
ForwardIterator first, ForwardIterator last,
|
| 2181 |
Predicate pred);
|
| 2182 |
|
| 2183 |
namespace ranges {
|
| 2184 |
+
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 2185 |
+
class T = projected_value_t<I, Proj>>
|
| 2186 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 2187 |
constexpr subrange<I> remove(I first, S last, const T& value, Proj proj = {});
|
| 2188 |
+
template<forward_range R, class Proj = identity,
|
| 2189 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 2190 |
requires permutable<iterator_t<R>> &&
|
| 2191 |
indirect_binary_predicate<ranges::equal_to,
|
| 2192 |
projected<iterator_t<R>, Proj>, const T*>
|
| 2193 |
constexpr borrowed_subrange_t<R>
|
| 2194 |
remove(R&& r, const T& value, Proj proj = {});
|
| 2195 |
+
|
| 2196 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2197 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 2198 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 2199 |
+
subrange<I> remove(Ep&& exec, I first, S last, const T& value,
|
| 2200 |
+
Proj proj = {}); // freestanding-deleted
|
| 2201 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 2202 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 2203 |
+
requires permutable<iterator_t<R>> &&
|
| 2204 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 2205 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 2206 |
+
borrowed_subrange_t<R>
|
| 2207 |
+
remove(Ep&& exec, R&& r, const T& value, Proj proj = {}); // freestanding-deleted
|
| 2208 |
+
|
| 2209 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 2210 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2211 |
constexpr subrange<I> remove_if(I first, S last, Pred pred, Proj proj = {});
|
| 2212 |
template<forward_range R, class Proj = identity,
|
| 2213 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2214 |
requires permutable<iterator_t<R>>
|
| 2215 |
constexpr borrowed_subrange_t<R>
|
| 2216 |
remove_if(R&& r, Pred pred, Proj proj = {});
|
| 2217 |
+
|
| 2218 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2219 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2220 |
+
subrange<I>
|
| 2221 |
+
remove_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 2222 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 2223 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2224 |
+
requires permutable<iterator_t<R>>
|
| 2225 |
+
borrowed_subrange_t<R>
|
| 2226 |
+
remove_if(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 2227 |
}
|
| 2228 |
|
| 2229 |
+
template<class InputIterator, class OutputIterator,
|
| 2230 |
+
class T = iterator_traits<InputIterator>::value_type>
|
| 2231 |
constexpr OutputIterator
|
| 2232 |
remove_copy(InputIterator first, InputIterator last,
|
| 2233 |
OutputIterator result, const T& value);
|
| 2234 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2235 |
+
class T = iterator_traits<ForwardIterator1>::value_type>
|
| 2236 |
ForwardIterator2
|
| 2237 |
+
remove_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2238 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2239 |
ForwardIterator2 result, const T& value);
|
| 2240 |
template<class InputIterator, class OutputIterator, class Predicate>
|
| 2241 |
constexpr OutputIterator
|
| 2242 |
remove_copy_if(InputIterator first, InputIterator last,
|
| 2243 |
OutputIterator result, Predicate pred);
|
| 2244 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2245 |
class Predicate>
|
| 2246 |
ForwardIterator2
|
| 2247 |
+
remove_copy_if(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2248 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2249 |
ForwardIterator2 result, Predicate pred);
|
| 2250 |
|
| 2251 |
namespace ranges {
|
| 2252 |
template<class I, class O>
|
| 2253 |
using remove_copy_result = in_out_result<I, O>;
|
| 2254 |
|
| 2255 |
+
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 2256 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 2257 |
requires indirectly_copyable<I, O> &&
|
| 2258 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 2259 |
constexpr remove_copy_result<I, O>
|
| 2260 |
remove_copy(I first, S last, O result, const T& value, Proj proj = {});
|
| 2261 |
+
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 2262 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 2263 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 2264 |
indirect_binary_predicate<ranges::equal_to,
|
| 2265 |
projected<iterator_t<R>, Proj>, const T*>
|
| 2266 |
constexpr remove_copy_result<borrowed_iterator_t<R>, O>
|
| 2267 |
remove_copy(R&& r, O result, const T& value, Proj proj = {});
|
| 2268 |
|
| 2269 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2270 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 2271 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 2272 |
+
requires indirectly_copyable<I, O> &&
|
| 2273 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 2274 |
+
remove_copy_result<I, O>
|
| 2275 |
+
remove_copy(Ep&& exec, I first, S last, O result, OutS result_last, const T& value,
|
| 2276 |
+
Proj proj = {}); // freestanding-deleted
|
| 2277 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 2278 |
+
class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 2279 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 2280 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 2281 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 2282 |
+
remove_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2283 |
+
remove_copy(Ep&& exec, R&& r, OutR&& result_r, const T& value,
|
| 2284 |
+
Proj proj = {}); // freestanding-deleted
|
| 2285 |
+
|
| 2286 |
template<class I, class O>
|
| 2287 |
using remove_copy_if_result = in_out_result<I, O>;
|
| 2288 |
|
| 2289 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 2290 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
|
|
|
| 2294 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 2295 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2296 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 2297 |
constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
|
| 2298 |
remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
| 2299 |
+
|
| 2300 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2301 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 2302 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 2303 |
+
requires indirectly_copyable<I, O>
|
| 2304 |
+
remove_copy_if_result<I, O>
|
| 2305 |
+
remove_copy_if(Ep&& exec, I first, S last, O result, OutS result_last, Pred pred,
|
| 2306 |
+
Proj proj = {}); // freestanding-deleted
|
| 2307 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 2308 |
+
class Proj = identity,
|
| 2309 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 2310 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 2311 |
+
remove_copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2312 |
+
remove_copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred,
|
| 2313 |
+
Proj proj = {}); // freestanding-deleted
|
| 2314 |
}
|
| 2315 |
|
| 2316 |
// [alg.unique], unique
|
| 2317 |
template<class ForwardIterator>
|
| 2318 |
constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last);
|
| 2319 |
template<class ForwardIterator, class BinaryPredicate>
|
| 2320 |
constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last,
|
| 2321 |
BinaryPredicate pred);
|
| 2322 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2323 |
+
ForwardIterator unique(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2324 |
ForwardIterator first, ForwardIterator last);
|
| 2325 |
template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
|
| 2326 |
+
ForwardIterator unique(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2327 |
ForwardIterator first, ForwardIterator last,
|
| 2328 |
BinaryPredicate pred);
|
| 2329 |
|
| 2330 |
namespace ranges {
|
| 2331 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 2334 |
template<forward_range R, class Proj = identity,
|
| 2335 |
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 2336 |
requires permutable<iterator_t<R>>
|
| 2337 |
constexpr borrowed_subrange_t<R>
|
| 2338 |
unique(R&& r, C comp = {}, Proj proj = {});
|
| 2339 |
+
|
| 2340 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2341 |
+
class Proj = identity,
|
| 2342 |
+
indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
|
| 2343 |
+
requires permutable<I>
|
| 2344 |
+
subrange<I> unique(Ep&& exec, I first, S last, C comp = {},
|
| 2345 |
+
Proj proj = {}); // freestanding-deleted
|
| 2346 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 2347 |
+
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 2348 |
+
requires permutable<iterator_t<R>>
|
| 2349 |
+
borrowed_subrange_t<R>
|
| 2350 |
+
unique(Ep&& exec, R&& r, C comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2351 |
}
|
| 2352 |
|
| 2353 |
template<class InputIterator, class OutputIterator>
|
| 2354 |
constexpr OutputIterator
|
| 2355 |
unique_copy(InputIterator first, InputIterator last,
|
|
|
|
| 2358 |
constexpr OutputIterator
|
| 2359 |
unique_copy(InputIterator first, InputIterator last,
|
| 2360 |
OutputIterator result, BinaryPredicate pred);
|
| 2361 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 2362 |
ForwardIterator2
|
| 2363 |
+
unique_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2364 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2365 |
ForwardIterator2 result);
|
| 2366 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 2367 |
class BinaryPredicate>
|
| 2368 |
ForwardIterator2
|
| 2369 |
+
unique_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2370 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 2371 |
ForwardIterator2 result, BinaryPredicate pred);
|
| 2372 |
|
| 2373 |
namespace ranges {
|
| 2374 |
template<class I, class O>
|
|
|
|
| 2388 |
(forward_iterator<iterator_t<R>> ||
|
| 2389 |
(input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
|
| 2390 |
indirectly_copyable_storable<iterator_t<R>, O>)
|
| 2391 |
constexpr unique_copy_result<borrowed_iterator_t<R>, O>
|
| 2392 |
unique_copy(R&& r, O result, C comp = {}, Proj proj = {});
|
| 2393 |
+
|
| 2394 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2395 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Proj = identity,
|
| 2396 |
+
indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
|
| 2397 |
+
requires indirectly_copyable<I, O>
|
| 2398 |
+
unique_copy_result<I, O>
|
| 2399 |
+
unique_copy(Ep&& exec, I first, S last, O result, OutS result_last, C comp = {},
|
| 2400 |
+
Proj proj = {}); // freestanding-deleted
|
| 2401 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 2402 |
+
class Proj = identity,
|
| 2403 |
+
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 2404 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 2405 |
+
unique_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2406 |
+
unique_copy(Ep&& exec, R&& r, OutR&& result_r, C comp = {},
|
| 2407 |
+
Proj proj = {}); // freestanding-deleted
|
| 2408 |
}
|
| 2409 |
|
| 2410 |
// [alg.reverse], reverse
|
| 2411 |
template<class BidirectionalIterator>
|
| 2412 |
constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last);
|
| 2413 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 2414 |
+
void reverse(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2415 |
BidirectionalIterator first, BidirectionalIterator last);
|
| 2416 |
|
| 2417 |
namespace ranges {
|
| 2418 |
template<bidirectional_iterator I, sentinel_for<I> S>
|
| 2419 |
requires permutable<I>
|
| 2420 |
constexpr I reverse(I first, S last);
|
| 2421 |
template<bidirectional_range R>
|
| 2422 |
requires permutable<iterator_t<R>>
|
| 2423 |
constexpr borrowed_iterator_t<R> reverse(R&& r);
|
| 2424 |
+
|
| 2425 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 2426 |
+
requires permutable<I>
|
| 2427 |
+
I reverse(Ep&& exec, I first, S last); // freestanding-deleted
|
| 2428 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 2429 |
+
requires permutable<iterator_t<R>>
|
| 2430 |
+
borrowed_iterator_t<R> reverse(Ep&& exec, R&& r); // freestanding-deleted
|
| 2431 |
}
|
| 2432 |
|
| 2433 |
template<class BidirectionalIterator, class OutputIterator>
|
| 2434 |
constexpr OutputIterator
|
| 2435 |
reverse_copy(BidirectionalIterator first, BidirectionalIterator last,
|
| 2436 |
OutputIterator result);
|
| 2437 |
template<class ExecutionPolicy, class BidirectionalIterator, class ForwardIterator>
|
| 2438 |
ForwardIterator
|
| 2439 |
+
reverse_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2440 |
BidirectionalIterator first, BidirectionalIterator last,
|
| 2441 |
ForwardIterator result);
|
| 2442 |
|
| 2443 |
namespace ranges {
|
| 2444 |
template<class I, class O>
|
| 2445 |
using reverse_copy_result = in_out_result<I, O>;
|
| 2446 |
+
template<class I, class O>
|
| 2447 |
+
using reverse_copy_truncated_result = in_in_out_result<I, I, O>;
|
| 2448 |
|
| 2449 |
template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
|
| 2450 |
requires indirectly_copyable<I, O>
|
| 2451 |
constexpr reverse_copy_result<I, O>
|
| 2452 |
reverse_copy(I first, S last, O result);
|
| 2453 |
template<bidirectional_range R, weakly_incrementable O>
|
| 2454 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 2455 |
constexpr reverse_copy_result<borrowed_iterator_t<R>, O>
|
| 2456 |
reverse_copy(R&& r, O result);
|
| 2457 |
+
|
| 2458 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2459 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 2460 |
+
requires indirectly_copyable<I, O>
|
| 2461 |
+
reverse_copy_truncated_result<I, O>
|
| 2462 |
+
reverse_copy(Ep&& exec, I first, S last, O result,
|
| 2463 |
+
OutS result_last); // freestanding-deleted
|
| 2464 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 2465 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 2466 |
+
reverse_copy_truncated_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2467 |
+
reverse_copy(Ep&& exec, R&& r, OutR&& result_r); // freestanding-deleted
|
| 2468 |
}
|
| 2469 |
|
| 2470 |
// [alg.rotate], rotate
|
| 2471 |
template<class ForwardIterator>
|
| 2472 |
constexpr ForwardIterator rotate(ForwardIterator first,
|
| 2473 |
ForwardIterator middle,
|
| 2474 |
ForwardIterator last);
|
| 2475 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2476 |
+
ForwardIterator rotate(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2477 |
ForwardIterator first,
|
| 2478 |
ForwardIterator middle,
|
| 2479 |
ForwardIterator last);
|
| 2480 |
|
| 2481 |
namespace ranges {
|
| 2482 |
template<permutable I, sentinel_for<I> S>
|
| 2483 |
constexpr subrange<I> rotate(I first, I middle, S last);
|
| 2484 |
template<forward_range R>
|
| 2485 |
requires permutable<iterator_t<R>>
|
| 2486 |
constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle);
|
| 2487 |
+
|
| 2488 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 2489 |
+
requires permutable<I>
|
| 2490 |
+
subrange<I>
|
| 2491 |
+
rotate(Ep&& exec, I first, I middle, S last); // freestanding-deleted
|
| 2492 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 2493 |
+
requires permutable<iterator_t<R>>
|
| 2494 |
+
borrowed_subrange_t<R>
|
| 2495 |
+
rotate(Ep&& exec, R&& r, iterator_t<R> middle); // freestanding-deleted
|
| 2496 |
}
|
| 2497 |
|
| 2498 |
template<class ForwardIterator, class OutputIterator>
|
| 2499 |
constexpr OutputIterator
|
| 2500 |
rotate_copy(ForwardIterator first, ForwardIterator middle,
|
| 2501 |
ForwardIterator last, OutputIterator result);
|
| 2502 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 2503 |
ForwardIterator2
|
| 2504 |
+
rotate_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2505 |
ForwardIterator1 first, ForwardIterator1 middle,
|
| 2506 |
ForwardIterator1 last, ForwardIterator2 result);
|
| 2507 |
|
| 2508 |
namespace ranges {
|
| 2509 |
template<class I, class O>
|
| 2510 |
using rotate_copy_result = in_out_result<I, O>;
|
| 2511 |
+
template<class I, class O>
|
| 2512 |
+
using rotate_copy_truncated_result = in_in_out_result<I, I, O>;
|
| 2513 |
|
| 2514 |
template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
|
| 2515 |
requires indirectly_copyable<I, O>
|
| 2516 |
constexpr rotate_copy_result<I, O>
|
| 2517 |
rotate_copy(I first, I middle, S last, O result);
|
| 2518 |
template<forward_range R, weakly_incrementable O>
|
| 2519 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 2520 |
constexpr rotate_copy_result<borrowed_iterator_t<R>, O>
|
| 2521 |
rotate_copy(R&& r, iterator_t<R> middle, O result);
|
| 2522 |
+
|
| 2523 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2524 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 2525 |
+
requires indirectly_copyable<I, O>
|
| 2526 |
+
rotate_copy_truncated_result<I, O>
|
| 2527 |
+
rotate_copy(Ep&& exec, I first, I middle, S last, O result, // freestanding-deleted
|
| 2528 |
+
OutS result_last);
|
| 2529 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 2530 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 2531 |
+
rotate_copy_truncated_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 2532 |
+
rotate_copy(Ep&& exec, R&& r, iterator_t<R> middle, // freestanding-deleted
|
| 2533 |
+
OutR&& result_r);
|
| 2534 |
}
|
| 2535 |
|
| 2536 |
// [alg.random.sample], sample
|
| 2537 |
template<class PopulationIterator, class SampleIterator,
|
| 2538 |
class Distance, class UniformRandomBitGenerator>
|
|
|
|
| 2576 |
constexpr ForwardIterator
|
| 2577 |
shift_left(ForwardIterator first, ForwardIterator last,
|
| 2578 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 2579 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2580 |
ForwardIterator
|
| 2581 |
+
shift_left(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2582 |
ForwardIterator first, ForwardIterator last,
|
| 2583 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 2584 |
|
| 2585 |
namespace ranges {
|
| 2586 |
template<permutable I, sentinel_for<I> S>
|
| 2587 |
constexpr subrange<I> shift_left(I first, S last, iter_difference_t<I> n);
|
| 2588 |
template<forward_range R>
|
| 2589 |
requires permutable<iterator_t<R>>
|
| 2590 |
constexpr borrowed_subrange_t<R> shift_left(R&& r, range_difference_t<R> n);
|
| 2591 |
+
|
| 2592 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 2593 |
+
requires permutable<I>
|
| 2594 |
+
subrange<I>
|
| 2595 |
+
shift_left(Ep&& exec, I first, S last, iter_difference_t<I> n); // freestanding-deleted
|
| 2596 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 2597 |
+
requires permutable<iterator_t<R>>
|
| 2598 |
+
borrowed_subrange_t<R>
|
| 2599 |
+
shift_left(Ep&& exec, R&& r, range_difference_t<R> n); // freestanding-deleted
|
| 2600 |
}
|
| 2601 |
|
| 2602 |
template<class ForwardIterator>
|
| 2603 |
constexpr ForwardIterator
|
| 2604 |
shift_right(ForwardIterator first, ForwardIterator last,
|
| 2605 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 2606 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2607 |
ForwardIterator
|
| 2608 |
+
shift_right(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2609 |
ForwardIterator first, ForwardIterator last,
|
| 2610 |
typename iterator_traits<ForwardIterator>::difference_type n);
|
| 2611 |
|
| 2612 |
namespace ranges {
|
| 2613 |
template<permutable I, sentinel_for<I> S>
|
| 2614 |
constexpr subrange<I> shift_right(I first, S last, iter_difference_t<I> n);
|
| 2615 |
template<forward_range R>
|
| 2616 |
requires permutable<iterator_t<R>>
|
| 2617 |
constexpr borrowed_subrange_t<R> shift_right(R&& r, range_difference_t<R> n);
|
| 2618 |
+
|
| 2619 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 2620 |
+
requires permutable<I>
|
| 2621 |
+
subrange<I>
|
| 2622 |
+
shift_right(Ep&& exec, I first, S last, iter_difference_t<I> n); // freestanding-deleted
|
| 2623 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 2624 |
+
requires permutable<iterator_t<R>>
|
| 2625 |
+
borrowed_subrange_t<R>
|
| 2626 |
+
shift_right(Ep&& exec, R&& r, range_difference_t<R> n); // freestanding-deleted
|
| 2627 |
}
|
| 2628 |
|
| 2629 |
// [alg.sorting], sorting and related operations
|
| 2630 |
// [alg.sort], sorting
|
| 2631 |
template<class RandomAccessIterator>
|
| 2632 |
constexpr void sort(RandomAccessIterator first, RandomAccessIterator last);
|
| 2633 |
template<class RandomAccessIterator, class Compare>
|
| 2634 |
constexpr void sort(RandomAccessIterator first, RandomAccessIterator last,
|
| 2635 |
Compare comp);
|
| 2636 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2637 |
+
void sort(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2638 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 2639 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2640 |
+
void sort(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2641 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 2642 |
Compare comp);
|
| 2643 |
|
| 2644 |
namespace ranges {
|
| 2645 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
|
|
| 2649 |
sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2650 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 2651 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2652 |
constexpr borrowed_iterator_t<R>
|
| 2653 |
sort(R&& r, Comp comp = {}, Proj proj = {});
|
| 2654 |
+
|
| 2655 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2656 |
+
class Comp = ranges::less, class Proj = identity>
|
| 2657 |
+
requires sortable<I, Comp, Proj>
|
| 2658 |
+
I sort(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2659 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 2660 |
+
class Proj = identity>
|
| 2661 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2662 |
+
borrowed_iterator_t<R>
|
| 2663 |
+
sort(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2664 |
}
|
| 2665 |
|
| 2666 |
template<class RandomAccessIterator>
|
| 2667 |
+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last); // hosted
|
| 2668 |
template<class RandomAccessIterator, class Compare>
|
| 2669 |
+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last, // hosted
|
| 2670 |
Compare comp);
|
| 2671 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2672 |
+
void stable_sort(ExecutionPolicy&& exec, // hosted, see [algorithms.parallel.overloads]
|
| 2673 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 2674 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2675 |
+
void stable_sort(ExecutionPolicy&& exec, // hosted, see [algorithms.parallel.overloads]
|
| 2676 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 2677 |
Compare comp);
|
| 2678 |
|
| 2679 |
namespace ranges {
|
| 2680 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 2681 |
class Proj = identity>
|
| 2682 |
requires sortable<I, Comp, Proj>
|
| 2683 |
+
constexpr I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // hosted
|
| 2684 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 2685 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2686 |
+
constexpr borrowed_iterator_t<R>
|
| 2687 |
+
stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // hosted
|
| 2688 |
+
|
| 2689 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2690 |
+
class Comp = ranges::less, class Proj = identity>
|
| 2691 |
+
requires sortable<I, Comp, Proj>
|
| 2692 |
+
I stable_sort(Ep&& exec, I first, S last, Comp comp = {},
|
| 2693 |
+
Proj proj = {}); // freestanding-deleted
|
| 2694 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 2695 |
+
class Proj = identity>
|
| 2696 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2697 |
borrowed_iterator_t<R>
|
| 2698 |
+
stable_sort(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2699 |
}
|
| 2700 |
|
| 2701 |
template<class RandomAccessIterator>
|
| 2702 |
constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle,
|
| 2703 |
RandomAccessIterator last);
|
| 2704 |
template<class RandomAccessIterator, class Compare>
|
| 2705 |
constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle,
|
| 2706 |
RandomAccessIterator last, Compare comp);
|
| 2707 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2708 |
+
void partial_sort(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2709 |
RandomAccessIterator first, RandomAccessIterator middle,
|
| 2710 |
RandomAccessIterator last);
|
| 2711 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2712 |
+
void partial_sort(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2713 |
RandomAccessIterator first, RandomAccessIterator middle,
|
| 2714 |
RandomAccessIterator last, Compare comp);
|
| 2715 |
|
| 2716 |
namespace ranges {
|
| 2717 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
|
|
| 2722 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 2723 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2724 |
constexpr borrowed_iterator_t<R>
|
| 2725 |
partial_sort(R&& r, iterator_t<R> middle, Comp comp = {},
|
| 2726 |
Proj proj = {});
|
| 2727 |
+
|
| 2728 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2729 |
+
class Comp = ranges::less, class Proj = identity>
|
| 2730 |
+
requires sortable<I, Comp, Proj>
|
| 2731 |
+
I partial_sort(Ep&& exec, I first, I middle, S last, Comp comp = {},
|
| 2732 |
+
Proj proj = {}); // freestanding-deleted
|
| 2733 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 2734 |
+
class Comp = ranges::less, class Proj = identity>
|
| 2735 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2736 |
+
borrowed_iterator_t<R>
|
| 2737 |
+
partial_sort(Ep&& exec, R&& r, iterator_t<R> middle, Comp comp = {},
|
| 2738 |
+
Proj proj = {}); // freestanding-deleted
|
| 2739 |
}
|
| 2740 |
|
| 2741 |
template<class InputIterator, class RandomAccessIterator>
|
| 2742 |
constexpr RandomAccessIterator
|
| 2743 |
partial_sort_copy(InputIterator first, InputIterator last,
|
|
|
|
| 2749 |
RandomAccessIterator result_first,
|
| 2750 |
RandomAccessIterator result_last,
|
| 2751 |
Compare comp);
|
| 2752 |
template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator>
|
| 2753 |
RandomAccessIterator
|
| 2754 |
+
partial_sort_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2755 |
ForwardIterator first, ForwardIterator last,
|
| 2756 |
RandomAccessIterator result_first,
|
| 2757 |
RandomAccessIterator result_last);
|
| 2758 |
template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator,
|
| 2759 |
class Compare>
|
| 2760 |
RandomAccessIterator
|
| 2761 |
+
partial_sort_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2762 |
ForwardIterator first, ForwardIterator last,
|
| 2763 |
RandomAccessIterator result_first,
|
| 2764 |
RandomAccessIterator result_last,
|
| 2765 |
Compare comp);
|
| 2766 |
|
|
|
|
| 2783 |
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 2784 |
projected<iterator_t<R2>, Proj2>>
|
| 2785 |
constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 2786 |
partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
|
| 2787 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 2788 |
+
|
| 2789 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 2790 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 2791 |
+
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 2792 |
+
requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
|
| 2793 |
+
indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
|
| 2794 |
+
partial_sort_copy_result<I1, I2>
|
| 2795 |
+
partial_sort_copy(Ep&& exec, I1 first, S1 last, I2 result_first, S2 result_last,
|
| 2796 |
+
Comp comp = {}, Proj1 proj1 = {},
|
| 2797 |
+
Proj2 proj2 = {}); // freestanding-deleted
|
| 2798 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 2799 |
+
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 2800 |
+
requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
|
| 2801 |
+
sortable<iterator_t<R2>, Comp, Proj2> &&
|
| 2802 |
+
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 2803 |
+
projected<iterator_t<R2>, Proj2>>
|
| 2804 |
+
partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 2805 |
+
partial_sort_copy(Ep&& exec, R1&& r, R2&& result_r, Comp comp = {},
|
| 2806 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 2807 |
}
|
| 2808 |
|
| 2809 |
template<class ForwardIterator>
|
| 2810 |
constexpr bool is_sorted(ForwardIterator first, ForwardIterator last);
|
| 2811 |
template<class ForwardIterator, class Compare>
|
| 2812 |
constexpr bool is_sorted(ForwardIterator first, ForwardIterator last,
|
| 2813 |
Compare comp);
|
| 2814 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2815 |
+
bool is_sorted(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2816 |
ForwardIterator first, ForwardIterator last);
|
| 2817 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2818 |
+
bool is_sorted(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2819 |
ForwardIterator first, ForwardIterator last,
|
| 2820 |
Compare comp);
|
| 2821 |
|
| 2822 |
namespace ranges {
|
| 2823 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2824 |
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 2825 |
constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2826 |
template<forward_range R, class Proj = identity,
|
| 2827 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2828 |
constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {});
|
| 2829 |
+
|
| 2830 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2831 |
+
class Proj = identity,
|
| 2832 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 2833 |
+
bool is_sorted(Ep&& exec, I first, S last, Comp comp = {},
|
| 2834 |
+
Proj proj = {}); // freestanding-deleted
|
| 2835 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 2836 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2837 |
+
bool is_sorted(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2838 |
}
|
| 2839 |
|
| 2840 |
template<class ForwardIterator>
|
| 2841 |
constexpr ForwardIterator
|
| 2842 |
is_sorted_until(ForwardIterator first, ForwardIterator last);
|
|
|
|
| 2844 |
constexpr ForwardIterator
|
| 2845 |
is_sorted_until(ForwardIterator first, ForwardIterator last,
|
| 2846 |
Compare comp);
|
| 2847 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 2848 |
ForwardIterator
|
| 2849 |
+
is_sorted_until(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2850 |
ForwardIterator first, ForwardIterator last);
|
| 2851 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 2852 |
ForwardIterator
|
| 2853 |
+
is_sorted_until(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2854 |
ForwardIterator first, ForwardIterator last,
|
| 2855 |
Compare comp);
|
| 2856 |
|
| 2857 |
namespace ranges {
|
| 2858 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 2860 |
constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 2861 |
template<forward_range R, class Proj = identity,
|
| 2862 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2863 |
constexpr borrowed_iterator_t<R>
|
| 2864 |
is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});
|
| 2865 |
+
|
| 2866 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2867 |
+
class Proj = identity,
|
| 2868 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 2869 |
+
I is_sorted_until(Ep&& exec, I first, S last, Comp comp = {},
|
| 2870 |
+
Proj proj = {}); // freestanding-deleted
|
| 2871 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 2872 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 2873 |
+
borrowed_iterator_t<R>
|
| 2874 |
+
is_sorted_until(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 2875 |
}
|
| 2876 |
|
| 2877 |
// [alg.nth.element], Nth element
|
| 2878 |
template<class RandomAccessIterator>
|
| 2879 |
constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
|
| 2880 |
RandomAccessIterator last);
|
| 2881 |
template<class RandomAccessIterator, class Compare>
|
| 2882 |
constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth,
|
| 2883 |
RandomAccessIterator last, Compare comp);
|
| 2884 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 2885 |
+
void nth_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2886 |
RandomAccessIterator first, RandomAccessIterator nth,
|
| 2887 |
RandomAccessIterator last);
|
| 2888 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 2889 |
+
void nth_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 2890 |
RandomAccessIterator first, RandomAccessIterator nth,
|
| 2891 |
RandomAccessIterator last, Compare comp);
|
| 2892 |
|
| 2893 |
namespace ranges {
|
| 2894 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
|
|
|
| 2898 |
nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 2899 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 2900 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2901 |
constexpr borrowed_iterator_t<R>
|
| 2902 |
nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});
|
| 2903 |
+
|
| 2904 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 2905 |
+
class Comp = ranges::less, class Proj = identity>
|
| 2906 |
+
requires sortable<I, Comp, Proj>
|
| 2907 |
+
I nth_element(Ep&& exec, I first, I nth, S last, Comp comp = {},
|
| 2908 |
+
Proj proj = {}); // freestanding-deleted
|
| 2909 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 2910 |
+
class Proj = identity>
|
| 2911 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 2912 |
+
borrowed_iterator_t<R>
|
| 2913 |
+
nth_element(Ep&& exec, R&& r, iterator_t<R> nth, Comp comp = {},
|
| 2914 |
+
Proj proj = {}); // freestanding-deleted
|
| 2915 |
}
|
| 2916 |
|
| 2917 |
// [alg.binary.search], binary search
|
| 2918 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2919 |
constexpr ForwardIterator
|
| 2920 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 2921 |
const T& value);
|
| 2922 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 2923 |
+
class Compare>
|
| 2924 |
constexpr ForwardIterator
|
| 2925 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 2926 |
const T& value, Compare comp);
|
| 2927 |
|
| 2928 |
namespace ranges {
|
| 2929 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2930 |
+
class T = projected_value_t<I, Proj>,
|
| 2931 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2932 |
constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
|
| 2933 |
Proj proj = {});
|
| 2934 |
+
template<forward_range R, class Proj = identity,
|
| 2935 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 2936 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2937 |
ranges::less>
|
| 2938 |
constexpr borrowed_iterator_t<R>
|
| 2939 |
lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2940 |
}
|
| 2941 |
|
| 2942 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2943 |
constexpr ForwardIterator
|
| 2944 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 2945 |
const T& value);
|
| 2946 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 2947 |
+
class Compare>
|
| 2948 |
constexpr ForwardIterator
|
| 2949 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 2950 |
const T& value, Compare comp);
|
| 2951 |
|
| 2952 |
namespace ranges {
|
| 2953 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2954 |
+
class T = projected_value_t<I, Proj>
|
| 2955 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2956 |
constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 2957 |
+
template<forward_range R, class Proj = identity,
|
| 2958 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 2959 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2960 |
ranges::less>
|
| 2961 |
constexpr borrowed_iterator_t<R>
|
| 2962 |
upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2963 |
}
|
| 2964 |
|
| 2965 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2966 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2967 |
equal_range(ForwardIterator first, ForwardIterator last,
|
| 2968 |
const T& value);
|
| 2969 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 2970 |
+
class Compare>
|
| 2971 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 2972 |
equal_range(ForwardIterator first, ForwardIterator last,
|
| 2973 |
const T& value, Compare comp);
|
| 2974 |
|
| 2975 |
namespace ranges {
|
| 2976 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 2977 |
+
class T = projected_value_t<I, Proj,
|
| 2978 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 2979 |
constexpr subrange<I>
|
| 2980 |
equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 2981 |
+
template<forward_range R, class Proj = identity,
|
| 2982 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 2983 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 2984 |
ranges::less>
|
| 2985 |
constexpr borrowed_subrange_t<R>
|
| 2986 |
equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 2987 |
}
|
| 2988 |
|
| 2989 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 2990 |
constexpr bool
|
| 2991 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 2992 |
const T& value);
|
| 2993 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 2994 |
+
class Compare>
|
| 2995 |
constexpr bool
|
| 2996 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 2997 |
const T& value, Compare comp);
|
| 2998 |
|
| 2999 |
namespace ranges {
|
| 3000 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3001 |
+
class T = projected_value_t<I, Proj>,
|
| 3002 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 3003 |
constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
|
| 3004 |
Proj proj = {});
|
| 3005 |
+
template<forward_range R, class Proj = identity,
|
| 3006 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 3007 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 3008 |
ranges::less>
|
| 3009 |
constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
|
| 3010 |
Proj proj = {});
|
| 3011 |
}
|
| 3012 |
|
| 3013 |
// [alg.partitions], partitions
|
| 3014 |
template<class InputIterator, class Predicate>
|
| 3015 |
constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);
|
| 3016 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 3017 |
+
bool is_partitioned(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3018 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 3019 |
|
| 3020 |
namespace ranges {
|
| 3021 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3022 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3023 |
constexpr bool is_partitioned(I first, S last, Pred pred, Proj proj = {});
|
| 3024 |
template<input_range R, class Proj = identity,
|
| 3025 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3026 |
constexpr bool is_partitioned(R&& r, Pred pred, Proj proj = {});
|
| 3027 |
+
|
| 3028 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3029 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3030 |
+
bool is_partitioned(Ep&& exec, I first, S last, Pred pred,
|
| 3031 |
+
Proj proj = {}); // freestanding-deleted
|
| 3032 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3033 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3034 |
+
bool is_partitioned(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 3035 |
}
|
| 3036 |
|
| 3037 |
template<class ForwardIterator, class Predicate>
|
| 3038 |
constexpr ForwardIterator partition(ForwardIterator first,
|
| 3039 |
ForwardIterator last,
|
| 3040 |
Predicate pred);
|
| 3041 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 3042 |
+
ForwardIterator partition(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3043 |
ForwardIterator first,
|
| 3044 |
ForwardIterator last,
|
| 3045 |
Predicate pred);
|
| 3046 |
|
| 3047 |
namespace ranges {
|
|
|
|
| 3052 |
template<forward_range R, class Proj = identity,
|
| 3053 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3054 |
requires permutable<iterator_t<R>>
|
| 3055 |
constexpr borrowed_subrange_t<R>
|
| 3056 |
partition(R&& r, Pred pred, Proj proj = {});
|
| 3057 |
+
|
| 3058 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3059 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3060 |
+
subrange<I>
|
| 3061 |
+
partition(Ep&& exec, I first, S last, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 3062 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3063 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3064 |
+
requires permutable<iterator_t<R>>
|
| 3065 |
+
borrowed_subrange_t<R>
|
| 3066 |
+
partition(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 3067 |
}
|
| 3068 |
|
| 3069 |
template<class BidirectionalIterator, class Predicate>
|
| 3070 |
+
constexpr BidirectionalIterator stable_partition(BidirectionalIterator first, // hosted
|
| 3071 |
BidirectionalIterator last,
|
| 3072 |
Predicate pred);
|
| 3073 |
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
|
| 3074 |
+
BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // hosted,
|
| 3075 |
+
BidirectionalIterator first, // see [algorithms.parallel.overloads]
|
| 3076 |
BidirectionalIterator last,
|
| 3077 |
Predicate pred);
|
| 3078 |
|
| 3079 |
namespace ranges {
|
| 3080 |
template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3081 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3082 |
requires permutable<I>
|
| 3083 |
+
constexpr subrange<I> stable_partition(I first, S last, Pred pred, // hosted
|
| 3084 |
+
Proj proj = {});
|
| 3085 |
template<bidirectional_range R, class Proj = identity,
|
| 3086 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3087 |
requires permutable<iterator_t<R>>
|
| 3088 |
+
constexpr borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, // hosted
|
| 3089 |
+
Proj proj = {});
|
| 3090 |
+
|
| 3091 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3092 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3093 |
+
requires permutable<I>
|
| 3094 |
+
subrange<I>
|
| 3095 |
+
stable_partition(Ep&& exec, I first, S last, Pred pred,
|
| 3096 |
+
Proj proj = {}); // freestanding-deleted
|
| 3097 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3098 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3099 |
+
requires permutable<iterator_t<R>>
|
| 3100 |
+
borrowed_subrange_t<R>
|
| 3101 |
+
stable_partition(Ep&& exec, R&& r, Pred pred, Proj proj = {}); // freestanding-deleted
|
| 3102 |
}
|
| 3103 |
|
| 3104 |
template<class InputIterator, class OutputIterator1,
|
| 3105 |
class OutputIterator2, class Predicate>
|
| 3106 |
constexpr pair<OutputIterator1, OutputIterator2>
|
|
|
|
| 3108 |
OutputIterator1 out_true, OutputIterator2 out_false,
|
| 3109 |
Predicate pred);
|
| 3110 |
template<class ExecutionPolicy, class ForwardIterator, class ForwardIterator1,
|
| 3111 |
class ForwardIterator2, class Predicate>
|
| 3112 |
pair<ForwardIterator1, ForwardIterator2>
|
| 3113 |
+
partition_copy(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3114 |
ForwardIterator first, ForwardIterator last,
|
| 3115 |
ForwardIterator1 out_true, ForwardIterator2 out_false,
|
| 3116 |
Predicate pred);
|
| 3117 |
|
| 3118 |
namespace ranges {
|
|
|
|
| 3131 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3132 |
requires indirectly_copyable<iterator_t<R>, O1> &&
|
| 3133 |
indirectly_copyable<iterator_t<R>, O2>
|
| 3134 |
constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
|
| 3135 |
partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});
|
| 3136 |
+
|
| 3137 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3138 |
+
random_access_iterator O1, sized_sentinel_for<O1> OutS1,
|
| 3139 |
+
random_access_iterator O2, sized_sentinel_for<O2> OutS2,
|
| 3140 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 3141 |
+
requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
|
| 3142 |
+
partition_copy_result<I, O1, O2>
|
| 3143 |
+
partition_copy(Ep&& exec, I first, S last, O1 out_true, OutS1 last_true,
|
| 3144 |
+
O2 out_false, OutS2 last_false, Pred pred,
|
| 3145 |
+
Proj proj = {}); // freestanding-deleted
|
| 3146 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 3147 |
+
sized-random-access-range OutR1, sized-random-access-range OutR2,
|
| 3148 |
+
class Proj = identity,
|
| 3149 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 3150 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR1>> &&
|
| 3151 |
+
indirectly_copyable<iterator_t<R>, iterator_t<OutR2>>
|
| 3152 |
+
partition_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR1>,
|
| 3153 |
+
borrowed_iterator_t<OutR2>>
|
| 3154 |
+
partition_copy(Ep&& exec, R&& r, OutR1&& out_true_r, OutR2&& out_false_r, Pred pred,
|
| 3155 |
+
Proj proj = {}); // freestanding-deleted
|
| 3156 |
}
|
| 3157 |
|
| 3158 |
template<class ForwardIterator, class Predicate>
|
| 3159 |
constexpr ForwardIterator
|
| 3160 |
partition_point(ForwardIterator first, ForwardIterator last,
|
|
|
|
| 3183 |
InputIterator2 first2, InputIterator2 last2,
|
| 3184 |
OutputIterator result, Compare comp);
|
| 3185 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3186 |
class ForwardIterator>
|
| 3187 |
ForwardIterator
|
| 3188 |
+
merge(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3189 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3190 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3191 |
ForwardIterator result);
|
| 3192 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3193 |
class ForwardIterator, class Compare>
|
| 3194 |
ForwardIterator
|
| 3195 |
+
merge(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3196 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3197 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3198 |
ForwardIterator result, Compare comp);
|
| 3199 |
|
| 3200 |
namespace ranges {
|
|
|
|
| 3212 |
class Proj1 = identity, class Proj2 = identity>
|
| 3213 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 3214 |
constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 3215 |
merge(R1&& r1, R2&& r2, O result,
|
| 3216 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3217 |
+
|
| 3218 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3219 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3220 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 3221 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3222 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 3223 |
+
merge_result<I1, I2, O>
|
| 3224 |
+
merge(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, O result, OutS result_last,
|
| 3225 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3226 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3227 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 3228 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3229 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 3230 |
+
merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, borrowed_iterator_t<OutR>>
|
| 3231 |
+
merge(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
|
| 3232 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3233 |
}
|
| 3234 |
|
| 3235 |
template<class BidirectionalIterator>
|
| 3236 |
+
constexpr void inplace_merge(BidirectionalIterator first, // hosted
|
| 3237 |
BidirectionalIterator middle,
|
| 3238 |
BidirectionalIterator last);
|
| 3239 |
template<class BidirectionalIterator, class Compare>
|
| 3240 |
+
constexpr void inplace_merge(BidirectionalIterator first, // hosted
|
| 3241 |
BidirectionalIterator middle,
|
| 3242 |
BidirectionalIterator last, Compare comp);
|
| 3243 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 3244 |
+
void inplace_merge(ExecutionPolicy&& exec, // hosted, see [algorithms.parallel.overloads]
|
| 3245 |
BidirectionalIterator first,
|
| 3246 |
BidirectionalIterator middle,
|
| 3247 |
BidirectionalIterator last);
|
| 3248 |
template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
|
| 3249 |
+
void inplace_merge(ExecutionPolicy&& exec, // hosted, see [algorithms.parallel.overloads]
|
| 3250 |
BidirectionalIterator first,
|
| 3251 |
BidirectionalIterator middle,
|
| 3252 |
BidirectionalIterator last, Compare comp);
|
| 3253 |
|
| 3254 |
namespace ranges {
|
| 3255 |
template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 3256 |
class Proj = identity>
|
| 3257 |
requires sortable<I, Comp, Proj>
|
| 3258 |
+
constexpr I
|
| 3259 |
+
inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // hosted
|
| 3260 |
template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
|
| 3261 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 3262 |
+
constexpr borrowed_iterator_t<R>
|
| 3263 |
+
inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // hosted
|
| 3264 |
+
|
| 3265 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3266 |
+
class Comp = ranges::less, class Proj = identity>
|
| 3267 |
+
requires sortable<I, Comp, Proj>
|
| 3268 |
+
I inplace_merge(Ep&& exec, I first, I middle, S last, Comp comp = {},
|
| 3269 |
+
Proj proj = {}); // freestanding-deleted
|
| 3270 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 3271 |
+
class Proj = identity>
|
| 3272 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 3273 |
borrowed_iterator_t<R>
|
| 3274 |
+
inplace_merge(Ep&& exec, R&& r, iterator_t<R> middle, Comp comp = {},
|
| 3275 |
+
Proj proj = {}); // freestanding-deleted
|
| 3276 |
}
|
| 3277 |
|
| 3278 |
// [alg.set.operations], set operations
|
| 3279 |
template<class InputIterator1, class InputIterator2>
|
| 3280 |
constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 3282 |
template<class InputIterator1, class InputIterator2, class Compare>
|
| 3283 |
constexpr bool includes(InputIterator1 first1, InputIterator1 last1,
|
| 3284 |
InputIterator2 first2, InputIterator2 last2,
|
| 3285 |
Compare comp);
|
| 3286 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 3287 |
+
bool includes(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3288 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3289 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 3290 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3291 |
class Compare>
|
| 3292 |
+
bool includes(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3293 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3294 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3295 |
Compare comp);
|
| 3296 |
|
| 3297 |
namespace ranges {
|
|
|
|
| 3305 |
class Proj2 = identity,
|
| 3306 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 3307 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 3308 |
constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
|
| 3309 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3310 |
+
|
| 3311 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3312 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3313 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 3314 |
+
indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
|
| 3315 |
+
ranges::less>
|
| 3316 |
+
bool includes(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 3317 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3318 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3319 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 3320 |
+
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 3321 |
+
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 3322 |
+
bool includes(Ep&& exec, R1&& r1, R2&& r2,
|
| 3323 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3324 |
}
|
| 3325 |
|
| 3326 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 3327 |
constexpr OutputIterator
|
| 3328 |
set_union(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 3334 |
InputIterator2 first2, InputIterator2 last2,
|
| 3335 |
OutputIterator result, Compare comp);
|
| 3336 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3337 |
class ForwardIterator>
|
| 3338 |
ForwardIterator
|
| 3339 |
+
set_union(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3340 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3341 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3342 |
ForwardIterator result);
|
| 3343 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3344 |
class ForwardIterator, class Compare>
|
| 3345 |
ForwardIterator
|
| 3346 |
+
set_union(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3347 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3348 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3349 |
ForwardIterator result, Compare comp);
|
| 3350 |
|
| 3351 |
namespace ranges {
|
|
|
|
| 3363 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 3364 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 3365 |
constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 3366 |
set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 3367 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3368 |
+
|
| 3369 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3370 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3371 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 3372 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3373 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 3374 |
+
set_union_result<I1, I2, O>
|
| 3375 |
+
set_union(Ep&& exec, I1 first1, S1 last1,
|
| 3376 |
+
I2 first2, S2 last2, O result, OutS result_last,
|
| 3377 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3378 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3379 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 3380 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3381 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 3382 |
+
set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 3383 |
+
borrowed_iterator_t<OutR>>
|
| 3384 |
+
set_union(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 3385 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3386 |
}
|
| 3387 |
|
| 3388 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 3389 |
constexpr OutputIterator
|
| 3390 |
set_intersection(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 3396 |
InputIterator2 first2, InputIterator2 last2,
|
| 3397 |
OutputIterator result, Compare comp);
|
| 3398 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3399 |
class ForwardIterator>
|
| 3400 |
ForwardIterator
|
| 3401 |
+
set_intersection(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3402 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3403 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3404 |
ForwardIterator result);
|
| 3405 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3406 |
class ForwardIterator, class Compare>
|
| 3407 |
ForwardIterator
|
| 3408 |
+
set_intersection(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3409 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3410 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3411 |
ForwardIterator result, Compare comp);
|
| 3412 |
|
| 3413 |
namespace ranges {
|
|
|
|
| 3425 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 3426 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 3427 |
constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 3428 |
set_intersection(R1&& r1, R2&& r2, O result,
|
| 3429 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3430 |
+
|
| 3431 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3432 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3433 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 3434 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3435 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 3436 |
+
set_intersection_result<I1, I2, O>
|
| 3437 |
+
set_intersection(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 3438 |
+
O result, OutS result_last, Comp comp = {}, Proj1 proj1 = {},
|
| 3439 |
+
Proj2 proj2 = {}); // freestanding-deleted
|
| 3440 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3441 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 3442 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3443 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 3444 |
+
set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 3445 |
+
borrowed_iterator_t<OutR>>
|
| 3446 |
+
set_intersection(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 3447 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3448 |
}
|
| 3449 |
|
| 3450 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 3451 |
constexpr OutputIterator
|
| 3452 |
set_difference(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 3458 |
InputIterator2 first2, InputIterator2 last2,
|
| 3459 |
OutputIterator result, Compare comp);
|
| 3460 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3461 |
class ForwardIterator>
|
| 3462 |
ForwardIterator
|
| 3463 |
+
set_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3464 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3465 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3466 |
ForwardIterator result);
|
| 3467 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3468 |
class ForwardIterator, class Compare>
|
| 3469 |
ForwardIterator
|
| 3470 |
+
set_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3471 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3472 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3473 |
ForwardIterator result, Compare comp);
|
| 3474 |
|
| 3475 |
namespace ranges {
|
|
|
|
| 3487 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 3488 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 3489 |
constexpr set_difference_result<borrowed_iterator_t<R1>, O>
|
| 3490 |
set_difference(R1&& r1, R2&& r2, O result,
|
| 3491 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3492 |
+
|
| 3493 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3494 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3495 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 3496 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3497 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 3498 |
+
set_difference_result<I1, O>
|
| 3499 |
+
set_difference(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 3500 |
+
O result, OutS result_last, Comp comp = {}, Proj1 proj1 = {},
|
| 3501 |
+
Proj2 proj2 = {}); // freestanding-deleted
|
| 3502 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3503 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 3504 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3505 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 3506 |
+
set_difference_result<borrowed_iterator_t<R1>, borrowed_iterator_t<OutR>>
|
| 3507 |
+
set_difference(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 3508 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3509 |
}
|
| 3510 |
|
| 3511 |
template<class InputIterator1, class InputIterator2, class OutputIterator>
|
| 3512 |
constexpr OutputIterator
|
| 3513 |
set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 3519 |
InputIterator2 first2, InputIterator2 last2,
|
| 3520 |
OutputIterator result, Compare comp);
|
| 3521 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3522 |
class ForwardIterator>
|
| 3523 |
ForwardIterator
|
| 3524 |
+
set_symmetric_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3525 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3526 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3527 |
ForwardIterator result);
|
| 3528 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3529 |
class ForwardIterator, class Compare>
|
| 3530 |
ForwardIterator
|
| 3531 |
+
set_symmetric_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3532 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3533 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3534 |
ForwardIterator result, Compare comp);
|
| 3535 |
|
| 3536 |
namespace ranges {
|
|
|
|
| 3550 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 3551 |
constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
|
| 3552 |
borrowed_iterator_t<R2>, O>
|
| 3553 |
set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 3554 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3555 |
+
|
| 3556 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3557 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3558 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 3559 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3560 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 3561 |
+
set_symmetric_difference_result<I1, I2, O>
|
| 3562 |
+
set_symmetric_difference(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 3563 |
+
O result, OutS result_last, Comp comp = {},
|
| 3564 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3565 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3566 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 3567 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 3568 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 3569 |
+
set_symmetric_difference_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 3570 |
+
borrowed_iterator_t<OutR>>
|
| 3571 |
+
set_symmetric_difference(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 3572 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3573 |
}
|
| 3574 |
|
| 3575 |
// [alg.heap.operations], heap operations
|
| 3576 |
template<class RandomAccessIterator>
|
| 3577 |
constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last);
|
|
|
|
| 3649 |
constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
|
| 3650 |
template<class RandomAccessIterator, class Compare>
|
| 3651 |
constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last,
|
| 3652 |
Compare comp);
|
| 3653 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 3654 |
+
bool is_heap(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3655 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 3656 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 3657 |
+
bool is_heap(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3658 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 3659 |
Compare comp);
|
| 3660 |
|
| 3661 |
namespace ranges {
|
| 3662 |
template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 3663 |
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3664 |
constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {});
|
| 3665 |
template<random_access_range R, class Proj = identity,
|
| 3666 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3667 |
constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {});
|
| 3668 |
+
|
| 3669 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3670 |
+
class Proj = identity,
|
| 3671 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3672 |
+
bool is_heap(Ep&& exec, I first, S last, Comp comp = {},
|
| 3673 |
+
Proj proj = {}); // freestanding-deleted
|
| 3674 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3675 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3676 |
+
bool is_heap(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3677 |
}
|
| 3678 |
|
| 3679 |
template<class RandomAccessIterator>
|
| 3680 |
constexpr RandomAccessIterator
|
| 3681 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
|
|
|
|
| 3683 |
constexpr RandomAccessIterator
|
| 3684 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last,
|
| 3685 |
Compare comp);
|
| 3686 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 3687 |
RandomAccessIterator
|
| 3688 |
+
is_heap_until(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3689 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 3690 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 3691 |
RandomAccessIterator
|
| 3692 |
+
is_heap_until(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3693 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 3694 |
Compare comp);
|
| 3695 |
|
| 3696 |
namespace ranges {
|
| 3697 |
template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 3699 |
constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 3700 |
template<random_access_range R, class Proj = identity,
|
| 3701 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3702 |
constexpr borrowed_iterator_t<R>
|
| 3703 |
is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
|
| 3704 |
+
|
| 3705 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3706 |
+
class Proj = identity,
|
| 3707 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3708 |
+
I is_heap_until(Ep&& exec, I first, S last, Comp comp = {},
|
| 3709 |
+
Proj proj = {}); // freestanding-deleted
|
| 3710 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3711 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3712 |
+
borrowed_iterator_t<R>
|
| 3713 |
+
is_heap_until(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3714 |
}
|
| 3715 |
|
| 3716 |
// [alg.min.max], minimum and maximum
|
| 3717 |
template<class T> constexpr const T& min(const T& a, const T& b);
|
| 3718 |
template<class T, class Compare>
|
|
|
|
| 3732 |
template<input_range R, class Proj = identity,
|
| 3733 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3734 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3735 |
constexpr range_value_t<R>
|
| 3736 |
min(R&& r, Comp comp = {}, Proj proj = {});
|
| 3737 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3738 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3739 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3740 |
+
range_value_t<R>
|
| 3741 |
+
min(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3742 |
}
|
| 3743 |
|
| 3744 |
template<class T> constexpr const T& max(const T& a, const T& b);
|
| 3745 |
template<class T, class Compare>
|
| 3746 |
constexpr const T& max(const T& a, const T& b, Compare comp);
|
|
|
|
| 3759 |
template<input_range R, class Proj = identity,
|
| 3760 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3761 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3762 |
constexpr range_value_t<R>
|
| 3763 |
max(R&& r, Comp comp = {}, Proj proj = {});
|
| 3764 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3765 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3766 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3767 |
+
range_value_t<R>
|
| 3768 |
+
max(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3769 |
}
|
| 3770 |
|
| 3771 |
template<class T> constexpr pair<const T&, const T&> minmax(const T& a, const T& b);
|
| 3772 |
template<class T, class Compare>
|
| 3773 |
constexpr pair<const T&, const T&> minmax(const T& a, const T& b, Compare comp);
|
|
|
|
| 3791 |
template<input_range R, class Proj = identity,
|
| 3792 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3793 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3794 |
constexpr minmax_result<range_value_t<R>>
|
| 3795 |
minmax(R&& r, Comp comp = {}, Proj proj = {});
|
| 3796 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3797 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3798 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 3799 |
+
minmax_result<range_value_t<R>>
|
| 3800 |
+
minmax(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3801 |
}
|
| 3802 |
|
| 3803 |
template<class ForwardIterator>
|
| 3804 |
constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
|
| 3805 |
template<class ForwardIterator, class Compare>
|
| 3806 |
constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last,
|
| 3807 |
Compare comp);
|
| 3808 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 3809 |
+
ForwardIterator min_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3810 |
ForwardIterator first, ForwardIterator last);
|
| 3811 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 3812 |
+
ForwardIterator min_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3813 |
ForwardIterator first, ForwardIterator last,
|
| 3814 |
Compare comp);
|
| 3815 |
|
| 3816 |
namespace ranges {
|
| 3817 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 3819 |
constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 3820 |
template<forward_range R, class Proj = identity,
|
| 3821 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3822 |
constexpr borrowed_iterator_t<R>
|
| 3823 |
min_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 3824 |
+
|
| 3825 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3826 |
+
class Proj = identity,
|
| 3827 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3828 |
+
I min_element(Ep&& exec, I first, S last, Comp comp = {},
|
| 3829 |
+
Proj proj = {}); // freestanding-deleted
|
| 3830 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 3831 |
+
class Proj = identity,
|
| 3832 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3833 |
+
borrowed_iterator_t<R>
|
| 3834 |
+
min_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3835 |
}
|
| 3836 |
|
| 3837 |
template<class ForwardIterator>
|
| 3838 |
constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
|
| 3839 |
template<class ForwardIterator, class Compare>
|
| 3840 |
constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last,
|
| 3841 |
Compare comp);
|
| 3842 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 3843 |
+
ForwardIterator max_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3844 |
ForwardIterator first, ForwardIterator last);
|
| 3845 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 3846 |
+
ForwardIterator max_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3847 |
ForwardIterator first, ForwardIterator last,
|
| 3848 |
Compare comp);
|
| 3849 |
|
| 3850 |
namespace ranges {
|
| 3851 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
|
|
|
| 3853 |
constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 3854 |
template<forward_range R, class Proj = identity,
|
| 3855 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3856 |
constexpr borrowed_iterator_t<R>
|
| 3857 |
max_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 3858 |
+
|
| 3859 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3860 |
+
class Proj = identity,
|
| 3861 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3862 |
+
I max_element(Ep&& exec, I first, S last, Comp comp = {},
|
| 3863 |
+
Proj proj = {}); // freestanding-deleted
|
| 3864 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 3865 |
+
class Proj = identity,
|
| 3866 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3867 |
+
borrowed_iterator_t<R>
|
| 3868 |
+
max_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3869 |
}
|
| 3870 |
|
| 3871 |
template<class ForwardIterator>
|
| 3872 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 3873 |
minmax_element(ForwardIterator first, ForwardIterator last);
|
| 3874 |
template<class ForwardIterator, class Compare>
|
| 3875 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 3876 |
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
| 3877 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 3878 |
pair<ForwardIterator, ForwardIterator>
|
| 3879 |
+
minmax_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3880 |
ForwardIterator first, ForwardIterator last);
|
| 3881 |
template<class ExecutionPolicy, class ForwardIterator, class Compare>
|
| 3882 |
pair<ForwardIterator, ForwardIterator>
|
| 3883 |
+
minmax_element(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3884 |
ForwardIterator first, ForwardIterator last, Compare comp);
|
| 3885 |
|
| 3886 |
namespace ranges {
|
| 3887 |
template<class I>
|
| 3888 |
using minmax_element_result = min_max_result<I>;
|
|
|
|
| 3893 |
minmax_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 3894 |
template<forward_range R, class Proj = identity,
|
| 3895 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3896 |
constexpr minmax_element_result<borrowed_iterator_t<R>>
|
| 3897 |
minmax_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 3898 |
+
|
| 3899 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 3900 |
+
class Proj = identity,
|
| 3901 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 3902 |
+
minmax_element_result<I>
|
| 3903 |
+
minmax_element(Ep&& exec, I first, S last, Comp comp = {},
|
| 3904 |
+
Proj proj = {}); // freestanding-deleted
|
| 3905 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 3906 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 3907 |
+
minmax_element_result<borrowed_iterator_t<R>>
|
| 3908 |
+
minmax_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {}); // freestanding-deleted
|
| 3909 |
}
|
| 3910 |
|
| 3911 |
// [alg.clamp], bounded value
|
| 3912 |
template<class T>
|
| 3913 |
constexpr const T& clamp(const T& v, const T& lo, const T& hi);
|
|
|
|
| 3931 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 3932 |
InputIterator2 first2, InputIterator2 last2,
|
| 3933 |
Compare comp);
|
| 3934 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 3935 |
bool
|
| 3936 |
+
lexicographical_compare(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3937 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3938 |
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 3939 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 3940 |
class Compare>
|
| 3941 |
bool
|
| 3942 |
+
lexicographical_compare(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 3943 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 3944 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 3945 |
Compare comp);
|
| 3946 |
|
| 3947 |
namespace ranges {
|
|
|
|
| 3957 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 3958 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 3959 |
constexpr bool
|
| 3960 |
lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
|
| 3961 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 3962 |
+
|
| 3963 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 3964 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 3965 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 3966 |
+
indirect_strict_weak_order<projected<I1, Proj1>,
|
| 3967 |
+
projected<I2, Proj2>> Comp = ranges::less>
|
| 3968 |
+
bool lexicographical_compare(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 3969 |
+
Comp comp = {}, Proj1 proj1 = {},
|
| 3970 |
+
Proj2 proj2 = {}); // freestanding-deleted
|
| 3971 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 3972 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 3973 |
+
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 3974 |
+
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 3975 |
+
bool lexicographical_compare(Ep&& exec, R1&& r1, R2&& r2, Comp comp = {},
|
| 3976 |
+
Proj1 proj1 = {}, Proj2 proj2 = {}); // freestanding-deleted
|
| 3977 |
}
|
| 3978 |
|
| 3979 |
// [alg.three.way], three-way comparison algorithms
|
| 3980 |
template<class InputIterator1, class InputIterator2, class Cmp>
|
| 3981 |
constexpr auto
|
|
|
|
| 4233 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4234 |
constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {});
|
| 4235 |
template<input_range R, class Proj = identity,
|
| 4236 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4237 |
constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {});
|
| 4238 |
+
|
| 4239 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4240 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4241 |
+
bool ranges::all_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4242 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4243 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4244 |
+
bool ranges::all_of(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4245 |
```
|
| 4246 |
|
| 4247 |
Let E be:
|
| 4248 |
|
| 4249 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
|
|
| 4269 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4270 |
constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {});
|
| 4271 |
template<input_range R, class Proj = identity,
|
| 4272 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4273 |
constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {});
|
| 4274 |
+
|
| 4275 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4276 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4277 |
+
bool ranges::any_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4278 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4279 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4280 |
+
bool ranges::any_of(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4281 |
```
|
| 4282 |
|
| 4283 |
Let E be:
|
| 4284 |
|
| 4285 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
|
|
| 4305 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4306 |
constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {});
|
| 4307 |
template<input_range R, class Proj = identity,
|
| 4308 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4309 |
constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {});
|
| 4310 |
+
|
| 4311 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4312 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4313 |
+
bool ranges::none_of(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4314 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4315 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4316 |
+
bool ranges::none_of(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4317 |
```
|
| 4318 |
|
| 4319 |
Let E be:
|
| 4320 |
|
| 4321 |
- `pred(*i)` for the overloads in namespace `std`;
|
|
|
|
| 4329 |
any projection.
|
| 4330 |
|
| 4331 |
### Contains <a id="alg.contains">[[alg.contains]]</a>
|
| 4332 |
|
| 4333 |
``` cpp
|
| 4334 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4335 |
+
class T = projected_value_t<I, Proj>>
|
| 4336 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4337 |
constexpr bool ranges::contains(I first, S last, const T& value, Proj proj = {});
|
| 4338 |
+
template<input_range R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4339 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4340 |
constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
|
| 4341 |
```
|
| 4342 |
|
| 4343 |
*Returns:* `ranges::find(std::move(first), last, value, proj) != last`.
|
| 4344 |
|
| 4345 |
+
``` cpp
|
| 4346 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4347 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 4348 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4349 |
+
bool ranges::contains(Ep&& exec, I first, S last, const T& value, Proj proj = {});
|
| 4350 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4351 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4352 |
+
requires
|
| 4353 |
+
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4354 |
+
bool ranges::contains(Ep&& exec, R&& r, const T& value, Proj proj = {});
|
| 4355 |
+
```
|
| 4356 |
+
|
| 4357 |
+
*Returns:*
|
| 4358 |
+
`ranges::find(std::forward<Ep>(exec), first, last, value, proj) != last`.
|
| 4359 |
+
|
| 4360 |
``` cpp
|
| 4361 |
template<forward_iterator I1, sentinel_for<I1> S1,
|
| 4362 |
forward_iterator I2, sentinel_for<I2> S2,
|
| 4363 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4364 |
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
|
|
|
| 4370 |
constexpr bool ranges::contains_subrange(R1&& r1, R2&& r2, Pred pred = {},
|
| 4371 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4372 |
```
|
| 4373 |
|
| 4374 |
*Returns:*
|
| 4375 |
+
|
| 4376 |
+
``` cpp
|
| 4377 |
+
first2 == last2 || !ranges::search(first1, last1, first2, last2,
|
| 4378 |
+
pred, proj1, proj2).empty()
|
| 4379 |
+
```
|
| 4380 |
+
|
| 4381 |
+
``` cpp
|
| 4382 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 4383 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 4384 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4385 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 4386 |
+
bool ranges::contains_subrange(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 4387 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4388 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 4389 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4390 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4391 |
+
bool ranges::contains_subrange(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 4392 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4393 |
+
```
|
| 4394 |
+
|
| 4395 |
+
*Returns:*
|
| 4396 |
+
|
| 4397 |
+
``` cpp
|
| 4398 |
+
first2 == last2 || !ranges::search(std::forward<Ep>(exec), first1, last1,
|
| 4399 |
+
first2, last2, pred, proj1, proj2).empty()
|
| 4400 |
+
```
|
| 4401 |
|
| 4402 |
### For each <a id="alg.foreach">[[alg.foreach]]</a>
|
| 4403 |
|
| 4404 |
``` cpp
|
| 4405 |
template<class InputIterator, class Function>
|
|
|
|
| 4479 |
*Remarks:* If `f` returns a result, the result is ignored.
|
| 4480 |
|
| 4481 |
[*Note 6*: The overloads in namespace `ranges` require `Fun` to model
|
| 4482 |
`copy_constructible`. — *end note*]
|
| 4483 |
|
| 4484 |
+
``` cpp
|
| 4485 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4486 |
+
class Proj = identity,
|
| 4487 |
+
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 4488 |
+
I ranges::for_each(Ep&& exec, I first, S last, Fun f, Proj proj = {});
|
| 4489 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4490 |
+
indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
|
| 4491 |
+
borrowed_iterator_t<R>
|
| 4492 |
+
ranges::for_each(Ep&& exec, R&& r, Fun f, Proj proj = {});
|
| 4493 |
+
```
|
| 4494 |
+
|
| 4495 |
+
*Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
|
| 4496 |
+
the range \[`first`, `last`).
|
| 4497 |
+
|
| 4498 |
+
[*Note 7*: If the result of `invoke(proj, *i)` is a mutable reference,
|
| 4499 |
+
`f` can apply non-constant functions. — *end note*]
|
| 4500 |
+
|
| 4501 |
+
*Returns:* `last`.
|
| 4502 |
+
|
| 4503 |
+
*Complexity:* Applies `f` and `proj` exactly `last - first` times.
|
| 4504 |
+
|
| 4505 |
+
*Remarks:*
|
| 4506 |
+
|
| 4507 |
+
- If `f` returns a result, the result is ignored.
|
| 4508 |
+
- Implementations do not have the freedom granted under
|
| 4509 |
+
[[algorithms.parallel.exec]] to make arbitrary copies of elements from
|
| 4510 |
+
the input sequence.
|
| 4511 |
+
- `f` may modify objects via its arguments [[algorithms.parallel.user]].
|
| 4512 |
+
|
| 4513 |
+
[*Note 8*: Does not return a copy of its `Fun` parameter, since
|
| 4514 |
+
parallelization often does not permit efficient state
|
| 4515 |
+
accumulation. — *end note*]
|
| 4516 |
+
|
| 4517 |
``` cpp
|
| 4518 |
template<class InputIterator, class Size, class Function>
|
| 4519 |
constexpr InputIterator for_each_n(InputIterator first, Size n, Function f);
|
| 4520 |
```
|
| 4521 |
|
|
|
|
| 4523 |
type [[conv.integral]], [[class.conv]].
|
| 4524 |
|
| 4525 |
*Preconditions:* `n >= 0` is `true`. `Function` meets the
|
| 4526 |
*Cpp17MoveConstructible* requirements.
|
| 4527 |
|
| 4528 |
+
[*Note 9*: `Function` need not meet the requirements of
|
| 4529 |
*Cpp17CopyConstructible*. — *end note*]
|
| 4530 |
|
| 4531 |
*Effects:* Applies `f` to the result of dereferencing every iterator in
|
| 4532 |
the range \[`first`, `first + n`) in order.
|
| 4533 |
|
| 4534 |
+
[*Note 10*: If the type of `first` meets the requirements of a mutable
|
| 4535 |
iterator, `f` can apply non-constant functions through the dereferenced
|
| 4536 |
iterator. — *end note*]
|
| 4537 |
|
| 4538 |
*Returns:* `first + n`.
|
| 4539 |
|
|
|
|
| 4552 |
*Cpp17CopyConstructible* requirements.
|
| 4553 |
|
| 4554 |
*Effects:* Applies `f` to the result of dereferencing every iterator in
|
| 4555 |
the range \[`first`, `first + n`).
|
| 4556 |
|
| 4557 |
+
[*Note 11*: If the type of `first` meets the requirements of a mutable
|
| 4558 |
iterator, `f` can apply non-constant functions through the dereferenced
|
| 4559 |
iterator. — *end note*]
|
| 4560 |
|
| 4561 |
*Returns:* `first + n`.
|
| 4562 |
|
|
|
|
| 4575 |
*Preconditions:* `n >= 0` is `true`.
|
| 4576 |
|
| 4577 |
*Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
|
| 4578 |
the range \[`first`, `first + n`) in order.
|
| 4579 |
|
| 4580 |
+
[*Note 12*: If the result of `invoke(proj, *i)` is a mutable reference,
|
| 4581 |
`f` can apply non-constant functions. — *end note*]
|
| 4582 |
|
| 4583 |
*Returns:* `{first + n, std::move(f)}`.
|
| 4584 |
|
| 4585 |
*Remarks:* If `f` returns a result, the result is ignored.
|
| 4586 |
|
| 4587 |
+
[*Note 13*: The overload in namespace `ranges` requires `Fun` to model
|
| 4588 |
`copy_constructible`. — *end note*]
|
| 4589 |
|
| 4590 |
+
``` cpp
|
| 4591 |
+
template<execution-policy Ep, random_access_iterator I, class Proj = identity,
|
| 4592 |
+
indirectly_unary_invocable<projected<I, Proj>> Fun>
|
| 4593 |
+
I ranges::for_each_n(Ep&& exec, I first, iter_difference_t<I> n, Fun f, Proj proj = {});
|
| 4594 |
+
```
|
| 4595 |
+
|
| 4596 |
+
*Preconditions:* `n >= 0` is `true`.
|
| 4597 |
+
|
| 4598 |
+
*Effects:* Calls `invoke(f, invoke(proj, *i))` for every iterator `i` in
|
| 4599 |
+
the range \[`first`, `first + n`).
|
| 4600 |
+
|
| 4601 |
+
[*Note 14*: If the result of `invoke(proj, *i)` is a mutable reference,
|
| 4602 |
+
`f` can apply non-constant functions. — *end note*]
|
| 4603 |
+
|
| 4604 |
+
*Returns:* `first + n`.
|
| 4605 |
+
|
| 4606 |
+
*Remarks:*
|
| 4607 |
+
|
| 4608 |
+
- If `f` returns a result, the result is ignored.
|
| 4609 |
+
- Implementations do not have the freedom granted under
|
| 4610 |
+
[[algorithms.parallel.exec]] to make arbitrary copies of elements from
|
| 4611 |
+
the input sequence.
|
| 4612 |
+
- `f` may modify objects via its arguments [[algorithms.parallel.user]].
|
| 4613 |
+
|
| 4614 |
+
[*Note 15*: Does not return a copy of its `Fun` parameter, since
|
| 4615 |
+
parallelization often does not permit efficient state
|
| 4616 |
+
accumulation. — *end note*]
|
| 4617 |
+
|
| 4618 |
### Find <a id="alg.find">[[alg.find]]</a>
|
| 4619 |
|
| 4620 |
``` cpp
|
| 4621 |
+
template<class InputIterator, class T = iterator_traits<InputIterator>::value_type>
|
| 4622 |
constexpr InputIterator find(InputIterator first, InputIterator last,
|
| 4623 |
const T& value);
|
| 4624 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 4625 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 4626 |
ForwardIterator find(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
|
| 4627 |
const T& value);
|
| 4628 |
|
| 4629 |
template<class InputIterator, class Predicate>
|
| 4630 |
constexpr InputIterator find_if(InputIterator first, InputIterator last,
|
|
|
|
| 4639 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 4640 |
ForwardIterator find_if_not(ExecutionPolicy&& exec,
|
| 4641 |
ForwardIterator first, ForwardIterator last,
|
| 4642 |
Predicate pred);
|
| 4643 |
|
| 4644 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4645 |
+
class T = projected_value_t<I, Proj>>
|
| 4646 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4647 |
constexpr I ranges::find(I first, S last, const T& value, Proj proj = {});
|
| 4648 |
+
template<input_range R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4649 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4650 |
constexpr borrowed_iterator_t<R>
|
| 4651 |
ranges::find(R&& r, const T& value, Proj proj = {});
|
| 4652 |
+
|
| 4653 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4654 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 4655 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4656 |
+
I ranges::find(Ep&& exec, I first, S last, const T& value, Proj proj = {});
|
| 4657 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4658 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4659 |
+
requires indirect_binary_predicate<ranges::equal_to,
|
| 4660 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 4661 |
+
borrowed_iterator_t<R> ranges::find(Ep&& exec, R&& r, const T& value, Proj proj = {});
|
| 4662 |
+
|
| 4663 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4664 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4665 |
constexpr I ranges::find_if(I first, S last, Pred pred, Proj proj = {});
|
| 4666 |
template<input_range R, class Proj = identity,
|
| 4667 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4668 |
constexpr borrowed_iterator_t<R>
|
| 4669 |
ranges::find_if(R&& r, Pred pred, Proj proj = {});
|
| 4670 |
+
|
| 4671 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4672 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4673 |
+
I ranges::find_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4674 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4675 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4676 |
+
borrowed_iterator_t<R> ranges::find_if(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4677 |
+
|
| 4678 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4679 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4680 |
constexpr I ranges::find_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 4681 |
template<input_range R, class Proj = identity,
|
| 4682 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4683 |
constexpr borrowed_iterator_t<R>
|
| 4684 |
ranges::find_if_not(R&& r, Pred pred, Proj proj = {});
|
| 4685 |
+
|
| 4686 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4687 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4688 |
+
I ranges::find_if_not(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4689 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4690 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4691 |
+
borrowed_iterator_t<R> ranges::find_if_not(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4692 |
```
|
| 4693 |
|
| 4694 |
Let E be:
|
| 4695 |
|
| 4696 |
- `*i == value` for `find`;
|
|
|
|
| 4707 |
predicate and any projection.
|
| 4708 |
|
| 4709 |
### Find last <a id="alg.find.last">[[alg.find.last]]</a>
|
| 4710 |
|
| 4711 |
``` cpp
|
| 4712 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4713 |
+
class T = projected_value_t<I, Proj>>
|
| 4714 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4715 |
constexpr subrange<I> ranges::find_last(I first, S last, const T& value, Proj proj = {});
|
| 4716 |
+
template<forward_range R, class Proj = identity,
|
| 4717 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4718 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4719 |
constexpr borrowed_subrange_t<R> ranges::find_last(R&& r, const T& value, Proj proj = {});
|
| 4720 |
+
|
| 4721 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4722 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 4723 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 4724 |
+
subrange<I> ranges::find_last(Ep&& exec, I first, S last, const T& value, Proj proj = {});
|
| 4725 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4726 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 4727 |
+
requires
|
| 4728 |
+
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 4729 |
+
borrowed_subrange_t<R> ranges::find_last(Ep&& exec, R&& r, const T& value, Proj proj = {});
|
| 4730 |
+
|
| 4731 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4732 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4733 |
constexpr subrange<I> ranges::find_last_if(I first, S last, Pred pred, Proj proj = {});
|
| 4734 |
template<forward_range R, class Proj = identity,
|
| 4735 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4736 |
constexpr borrowed_subrange_t<R> ranges::find_last_if(R&& r, Pred pred, Proj proj = {});
|
| 4737 |
+
|
| 4738 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4739 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4740 |
+
subrange<I> ranges::find_last_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4741 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 4742 |
+
class Proj = identity,
|
| 4743 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4744 |
+
borrowed_subrange_t<R> ranges::find_last_if(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4745 |
+
|
| 4746 |
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 4747 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4748 |
constexpr subrange<I> ranges::find_last_if_not(I first, S last, Pred pred, Proj proj = {});
|
| 4749 |
template<forward_range R, class Proj = identity,
|
| 4750 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4751 |
constexpr borrowed_subrange_t<R> ranges::find_last_if_not(R&& r, Pred pred, Proj proj = {});
|
| 4752 |
+
|
| 4753 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4754 |
+
class Proj = identity,
|
| 4755 |
+
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 4756 |
+
subrange<I> ranges::find_last_if_not(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 4757 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4758 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 4759 |
+
borrowed_subrange_t<R> ranges::find_last_if_not(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 4760 |
```
|
| 4761 |
|
| 4762 |
Let E be:
|
| 4763 |
|
| 4764 |
- `bool(invoke(proj, *i) == value)` for `ranges::find_last`;
|
|
|
|
| 4810 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4811 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4812 |
constexpr borrowed_subrange_t<R1>
|
| 4813 |
ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
|
| 4814 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4815 |
+
|
| 4816 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 4817 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 4818 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4819 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 4820 |
+
subrange<I1>
|
| 4821 |
+
ranges::find_end(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 4822 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4823 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 4824 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4825 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4826 |
+
borrowed_subrange_t<R1>
|
| 4827 |
+
ranges::find_end(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 4828 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4829 |
```
|
| 4830 |
|
| 4831 |
Let:
|
| 4832 |
|
| 4833 |
- `pred` be `equal_to{}` for the overloads with no parameter `pred`;
|
|
|
|
| 4851 |
|
| 4852 |
*Complexity:* At most
|
| 4853 |
`(last2 - first2) * (last1 - first1 - (last2 - first2) + 1)`
|
| 4854 |
applications of the corresponding predicate and any projections.
|
| 4855 |
|
| 4856 |
+
### Find first of <a id="alg.find.first.of">[[alg.find.first.of]]</a>
|
| 4857 |
|
| 4858 |
``` cpp
|
| 4859 |
template<class InputIterator, class ForwardIterator>
|
| 4860 |
constexpr InputIterator
|
| 4861 |
find_first_of(InputIterator first1, InputIterator last1,
|
|
|
|
| 4891 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4892 |
constexpr borrowed_iterator_t<R1>
|
| 4893 |
ranges::find_first_of(R1&& r1, R2&& r2,
|
| 4894 |
Pred pred = {},
|
| 4895 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4896 |
+
|
| 4897 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 4898 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 4899 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4900 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 4901 |
+
I1 ranges::find_first_of(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 4902 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4903 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 4904 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 4905 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 4906 |
+
borrowed_iterator_t<R1>
|
| 4907 |
+
ranges::find_first_of(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 4908 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 4909 |
```
|
| 4910 |
|
| 4911 |
Let E be:
|
| 4912 |
|
| 4913 |
- `*i == *j` for the overloads with no parameter `pred`;
|
|
|
|
| 4921 |
*Returns:* The first iterator `i` in the range \[`first1`, `last1`) such
|
| 4922 |
that for some iterator `j` in the range \[`first2`, `last2`) E holds.
|
| 4923 |
Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
|
| 4924 |
is found.
|
| 4925 |
|
| 4926 |
+
*Complexity:* At most `(last1 - first1) * (last2 - first2)` applications
|
| 4927 |
+
of the corresponding predicate and any projections.
|
| 4928 |
|
| 4929 |
### Adjacent find <a id="alg.adjacent.find">[[alg.adjacent.find]]</a>
|
| 4930 |
|
| 4931 |
``` cpp
|
| 4932 |
template<class ForwardIterator>
|
|
|
|
| 4953 |
constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {});
|
| 4954 |
template<forward_range R, class Proj = identity,
|
| 4955 |
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 4956 |
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 4957 |
constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {});
|
| 4958 |
+
|
| 4959 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 4960 |
+
class Proj = identity,
|
| 4961 |
+
indirect_binary_predicate<projected<I, Proj>,
|
| 4962 |
+
projected<I, Proj>> Pred = ranges::equal_to>
|
| 4963 |
+
I ranges::adjacent_find(Ep&& exec, I first, S last, Pred pred = {}, Proj proj = {});
|
| 4964 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 4965 |
+
indirect_binary_predicate<projected<iterator_t<R>, Proj>,
|
| 4966 |
+
projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
|
| 4967 |
+
borrowed_iterator_t<R>
|
| 4968 |
+
ranges::adjacent_find(Ep&& exec, R&& r, Pred pred = {}, Proj proj = {});
|
| 4969 |
```
|
| 4970 |
|
| 4971 |
Let E be:
|
| 4972 |
|
| 4973 |
- `*i == *(i + 1)` for the overloads with no parameter `pred`;
|
|
|
|
| 4978 |
|
| 4979 |
*Returns:* The first iterator `i` such that both `i` and `i + 1` are in
|
| 4980 |
the range \[`first`, `last`) for which E holds. Returns `last` if no
|
| 4981 |
such iterator is found.
|
| 4982 |
|
| 4983 |
+
*Complexity:* For the non-parallel algorithm overloads, exactly
|
| 4984 |
$$\min(\texttt{(i - first) + 1}, \ \texttt{(last - first) - 1})$$
|
| 4985 |
applications of the corresponding predicate, where `i` is
|
| 4986 |
+
`adjacent_find`’s return value. For the parallel algorithm overloads,
|
| 4987 |
+
𝑂(`last - first`) applications of the corresponding predicate. No more
|
| 4988 |
+
than twice as many applications of any projection.
|
|
|
|
| 4989 |
|
| 4990 |
### Count <a id="alg.count">[[alg.count]]</a>
|
| 4991 |
|
| 4992 |
``` cpp
|
| 4993 |
+
template<class InputIterator, class T = iterator_traits<InputIterator>::value_type>
|
| 4994 |
constexpr typename iterator_traits<InputIterator>::difference_type
|
| 4995 |
count(InputIterator first, InputIterator last, const T& value);
|
| 4996 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 4997 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 4998 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 4999 |
count(ExecutionPolicy&& exec,
|
| 5000 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 5001 |
|
| 5002 |
template<class InputIterator, class Predicate>
|
|
|
|
| 5005 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 5006 |
typename iterator_traits<ForwardIterator>::difference_type
|
| 5007 |
count_if(ExecutionPolicy&& exec,
|
| 5008 |
ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 5009 |
|
| 5010 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 5011 |
+
class T = projected_value_t<I, Proj>>
|
| 5012 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 5013 |
constexpr iter_difference_t<I>
|
| 5014 |
ranges::count(I first, S last, const T& value, Proj proj = {});
|
| 5015 |
+
template<input_range R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 5016 |
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 5017 |
constexpr range_difference_t<R>
|
| 5018 |
ranges::count(R&& r, const T& value, Proj proj = {});
|
| 5019 |
+
|
| 5020 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 5021 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 5022 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 5023 |
+
iter_difference_t<I>
|
| 5024 |
+
ranges::count(Ep&& exec, I first, S last, const T& value, Proj proj = {});
|
| 5025 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 5026 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 5027 |
+
requires indirect_binary_predicate<ranges::equal_to,
|
| 5028 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 5029 |
+
range_difference_t<R> ranges::count(Ep&& exec, R&& r, const T& value, Proj proj = {});
|
| 5030 |
+
|
| 5031 |
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 5032 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 5033 |
constexpr iter_difference_t<I>
|
| 5034 |
ranges::count_if(I first, S last, Pred pred, Proj proj = {});
|
| 5035 |
template<input_range R, class Proj = identity,
|
| 5036 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 5037 |
constexpr range_difference_t<R>
|
| 5038 |
ranges::count_if(R&& r, Pred pred, Proj proj = {});
|
| 5039 |
+
|
| 5040 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 5041 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 5042 |
+
iter_difference_t<I>
|
| 5043 |
+
ranges::count_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 5044 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 5045 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 5046 |
+
range_difference_t<R>
|
| 5047 |
+
ranges::count_if(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 5048 |
```
|
| 5049 |
|
| 5050 |
Let E be:
|
| 5051 |
|
| 5052 |
- `*i == value` for the overloads with no parameter `pred` or `proj`;
|
|
|
|
| 5061 |
`last`) for which E holds.
|
| 5062 |
|
| 5063 |
*Complexity:* Exactly `last - first` applications of the corresponding
|
| 5064 |
predicate and any projection.
|
| 5065 |
|
| 5066 |
+
### Mismatch <a id="alg.mismatch">[[alg.mismatch]]</a>
|
| 5067 |
|
| 5068 |
``` cpp
|
| 5069 |
template<class InputIterator1, class InputIterator2>
|
| 5070 |
constexpr pair<InputIterator1, InputIterator2>
|
| 5071 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 5122 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5123 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5124 |
constexpr ranges::mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 5125 |
ranges::mismatch(R1&& r1, R2&& r2, Pred pred = {},
|
| 5126 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5127 |
+
|
| 5128 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 5129 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 5130 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5131 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 5132 |
+
ranges::mismatch_result<I1, I2>
|
| 5133 |
+
ranges::mismatch(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
|
| 5134 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5135 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 5136 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5137 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5138 |
+
ranges::mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 5139 |
+
ranges::mismatch(Ep&& exec, R1&& r1, R2&& r2, Pred pred = {},
|
| 5140 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5141 |
```
|
| 5142 |
|
| 5143 |
+
Let `last2` be `first2 + (last1 - first1)` for the overloads in
|
| 5144 |
+
namespace `std` with no parameter `last2`.
|
| 5145 |
|
| 5146 |
Let E be:
|
| 5147 |
|
| 5148 |
- `!(*(first1 + n) == *(first2 + n))` for the overloads with no
|
| 5149 |
parameter `pred`;
|
|
|
|
| 5210 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to,
|
| 5211 |
class Proj1 = identity, class Proj2 = identity>
|
| 5212 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5213 |
constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
|
| 5214 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5215 |
+
|
| 5216 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 5217 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 5218 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5219 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 5220 |
+
bool ranges::equal(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 5221 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5222 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 5223 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5224 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5225 |
+
bool ranges::equal(Ep&& exec, R1&& r1, R2&& r2,
|
| 5226 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5227 |
```
|
| 5228 |
|
| 5229 |
Let:
|
| 5230 |
|
| 5231 |
+
- `last2` be `first2 + (last1 - first1)` for the overloads in namespace
|
| 5232 |
+
`std` with no parameter `last2`;
|
| 5233 |
- `pred` be `equal_to{}` for the overloads with no parameter `pred`;
|
| 5234 |
- E be:
|
| 5235 |
- `pred(*i, *(first2 + (i - first1)))` for the overloads with no
|
| 5236 |
parameter `proj1`;
|
| 5237 |
- `invoke(pred, invoke(proj1, *i), invoke(proj2, *(first2 + (i - first1))))`
|
|
|
|
| 5247 |
*Cpp17RandomAccessIterator* requirements [[random.access.iterators]]
|
| 5248 |
and `last1 - first1 != last2 - first2` for the overloads in namespace
|
| 5249 |
`std`;
|
| 5250 |
- the types of `first1`, `last1`, `first2`, and `last2` pairwise model
|
| 5251 |
`sized_sentinel_for` [[iterator.concept.sizedsentinel]] and
|
| 5252 |
+
`last1 - first1 != last2 - first2` for the first and third overloads
|
| 5253 |
+
in namespace `ranges`, or
|
| 5254 |
- `R1` and `R2` each model `sized_range` and
|
| 5255 |
+
`ranges::distance(r1) != ranges::distance(r2)` for the second and
|
| 5256 |
+
fourth overloads in namespace `ranges`,
|
| 5257 |
|
| 5258 |
then no applications of the corresponding predicate and each projection;
|
| 5259 |
+
otherwise, at most
|
| 5260 |
+
$$\min(\texttt{last1 - first1}, \ \texttt{last2 - first2})$$
|
| 5261 |
+
applications of the corresponding predicate and any projections.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5262 |
|
| 5263 |
### Is permutation <a id="alg.is.permutation">[[alg.is.permutation]]</a>
|
| 5264 |
|
| 5265 |
``` cpp
|
| 5266 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
|
|
| 5324 |
the range \[`first2`, `last2`), bounded by \[`pfirst`, `plast`), such
|
| 5325 |
that `ranges::equal(first1, last1, pfirst, plast, pred, proj1, proj2)`
|
| 5326 |
returns `true`; otherwise, returns `false`.
|
| 5327 |
|
| 5328 |
*Complexity:* No applications of the corresponding predicate and
|
| 5329 |
+
projections if
|
| 5330 |
|
| 5331 |
- for the first overload,
|
| 5332 |
- `S1` and `I1` model `sized_sentinel_for<S1, I1>`,
|
| 5333 |
- `S2` and `I2` model `sized_sentinel_for<S2, I2>`, and
|
| 5334 |
- `last1 - first1 != last2 - first2`;
|
|
|
|
| 5368 |
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 5369 |
BinaryPredicate pred);
|
| 5370 |
```
|
| 5371 |
|
| 5372 |
*Returns:* The first iterator `i` in the range \[`first1`,
|
| 5373 |
+
`last1 - (last2 - first2)`\] such that for every non-negative integer
|
| 5374 |
+
`n` less than `last2 - first2` the following corresponding conditions
|
| 5375 |
+
hold:
|
| 5376 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 5377 |
Returns `first1` if \[`first2`, `last2`) is empty, otherwise returns
|
| 5378 |
`last1` if no such iterator is found.
|
| 5379 |
|
| 5380 |
*Complexity:* At most `(last1 - first1) * (last2 - first2)` applications
|
|
|
|
| 5392 |
class Proj1 = identity, class Proj2 = identity>
|
| 5393 |
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5394 |
constexpr borrowed_subrange_t<R1>
|
| 5395 |
ranges::search(R1&& r1, R2&& r2, Pred pred = {},
|
| 5396 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5397 |
+
|
| 5398 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 5399 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 5400 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5401 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 5402 |
+
subrange<I1>
|
| 5403 |
+
ranges::search(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 5404 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5405 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 5406 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5407 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5408 |
+
borrowed_subrange_t<R1>
|
| 5409 |
+
ranges::search(Ep&& exec, R1&& r1, R2&& r2,
|
| 5410 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5411 |
```
|
| 5412 |
|
| 5413 |
*Returns:*
|
| 5414 |
|
| 5415 |
- `{i, i + (last2 - first2)}`, where `i` is the first iterator in the
|
| 5416 |
+
range \[`first1`, `last1 - (last2 - first2)`\] such that for every
|
| 5417 |
non-negative integer `n` less than `last2 - first2` the condition
|
| 5418 |
``` cpp
|
| 5419 |
bool(invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n))))
|
| 5420 |
```
|
| 5421 |
|
|
|
|
| 5424 |
|
| 5425 |
*Complexity:* At most `(last1 - first1) * (last2 - first2)` applications
|
| 5426 |
of the corresponding predicate and projections.
|
| 5427 |
|
| 5428 |
``` cpp
|
| 5429 |
+
template<class ForwardIterator, class Size, class T = iterator_traits<ForwardIterator>::value_type>
|
| 5430 |
constexpr ForwardIterator
|
| 5431 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 5432 |
Size count, const T& value);
|
| 5433 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 5434 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 5435 |
ForwardIterator
|
| 5436 |
search_n(ExecutionPolicy&& exec,
|
| 5437 |
ForwardIterator first, ForwardIterator last,
|
| 5438 |
Size count, const T& value);
|
| 5439 |
|
| 5440 |
+
template<class ForwardIterator, class Size, class T = iterator_traits<ForwardIterator>::value_type,
|
| 5441 |
class BinaryPredicate>
|
| 5442 |
constexpr ForwardIterator
|
| 5443 |
search_n(ForwardIterator first, ForwardIterator last,
|
| 5444 |
Size count, const T& value,
|
| 5445 |
BinaryPredicate pred);
|
| 5446 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 5447 |
+
class T = iterator_traits<ForwardIterator>::value_type,
|
| 5448 |
class BinaryPredicate>
|
| 5449 |
ForwardIterator
|
| 5450 |
search_n(ExecutionPolicy&& exec,
|
| 5451 |
ForwardIterator first, ForwardIterator last,
|
| 5452 |
Size count, const T& value,
|
|
|
|
| 5454 |
```
|
| 5455 |
|
| 5456 |
*Mandates:* The type `Size` is convertible to an integral
|
| 5457 |
type [[conv.integral]], [[class.conv]].
|
| 5458 |
|
| 5459 |
+
Let E be `pred(*(i + n), value) != false` for the overloads with a
|
| 5460 |
+
parameter `pred`, and `*(i + n) == value` otherwise.
|
| 5461 |
+
|
| 5462 |
+
*Returns:* The first iterator `i` in the range \[`first`,
|
| 5463 |
+
`last - count`\] such that for every non-negative integer `n` less than
|
| 5464 |
+
`count` the condition E is `true`. Returns `last` if no such iterator is
|
| 5465 |
+
found.
|
| 5466 |
|
| 5467 |
*Complexity:* At most `last - first` applications of the corresponding
|
| 5468 |
predicate.
|
| 5469 |
|
| 5470 |
``` cpp
|
| 5471 |
+
template<forward_iterator I, sentinel_for<I> S,
|
| 5472 |
+
class Pred = ranges::equal_to, class Proj = identity,
|
| 5473 |
+
class T = projected_value_t<I, Proj>>
|
| 5474 |
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 5475 |
constexpr subrange<I>
|
| 5476 |
ranges::search_n(I first, S last, iter_difference_t<I> count,
|
| 5477 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 5478 |
+
template<forward_range R, class Pred = ranges::equal_to,
|
| 5479 |
+
class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 5480 |
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 5481 |
constexpr borrowed_subrange_t<R>
|
| 5482 |
ranges::search_n(R&& r, range_difference_t<R> count,
|
| 5483 |
const T& value, Pred pred = {}, Proj proj = {});
|
| 5484 |
+
|
| 5485 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 5486 |
+
class Pred = ranges::equal_to, class Proj = identity,
|
| 5487 |
+
class T = projected_value_t<I, Proj>>
|
| 5488 |
+
requires indirectly_comparable<I, const T*, Pred, Proj>
|
| 5489 |
+
subrange<I>
|
| 5490 |
+
ranges::search_n(Ep&& exec, I first, S last, iter_difference_t<I> count,
|
| 5491 |
+
const T& value, Pred pred = {}, Proj proj = {});
|
| 5492 |
+
template<execution-policy Ep, sized-random-access-range R, class Pred = ranges::equal_to,
|
| 5493 |
+
class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 5494 |
+
requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
|
| 5495 |
+
borrowed_subrange_t<R>
|
| 5496 |
+
ranges::search_n(Ep&& exec, R&& r, range_difference_t<R> count,
|
| 5497 |
+
const T& value, Pred pred = {}, Proj proj = {});
|
| 5498 |
```
|
| 5499 |
|
| 5500 |
*Returns:* `{i, i + count}` where `i` is the first iterator in the range
|
| 5501 |
+
\[`first`, `last - count`\] such that for every non-negative integer `n`
|
| 5502 |
less than `count`, the following condition holds:
|
| 5503 |
`invoke(pred, invoke(proj, *(i + n)), value)`. Returns `{last, last}` if
|
| 5504 |
no such iterator is found.
|
| 5505 |
|
| 5506 |
*Complexity:* At most `last - first` applications of the corresponding
|
|
|
|
| 5537 |
``` cpp
|
| 5538 |
ranges::mismatch(std::move(first1), last1, std::move(first2), last2,
|
| 5539 |
pred, proj1, proj2).in2 == last2
|
| 5540 |
```
|
| 5541 |
|
| 5542 |
+
``` cpp
|
| 5543 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 5544 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 5545 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5546 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 5547 |
+
bool ranges::starts_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 5548 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5549 |
+
template<execution-policy Ep, sized-random-access-range R1,
|
| 5550 |
+
sized-random-access-range R2, class Pred = ranges::equal_to,
|
| 5551 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 5552 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5553 |
+
bool ranges::starts_with(Ep&& exec, R1&& r1, R2&& r2,
|
| 5554 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5555 |
+
```
|
| 5556 |
+
|
| 5557 |
+
*Returns:*
|
| 5558 |
+
|
| 5559 |
+
``` cpp
|
| 5560 |
+
ranges::mismatch(std::forward<Ep>(exec), std::move(first1), last1, std::move(first2),
|
| 5561 |
+
last2, pred, proj1, proj2).in2 == last2
|
| 5562 |
+
```
|
| 5563 |
+
|
| 5564 |
### Ends with <a id="alg.ends.with">[[alg.ends.with]]</a>
|
| 5565 |
|
| 5566 |
``` cpp
|
| 5567 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 5568 |
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
|
|
|
| 5573 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5574 |
```
|
| 5575 |
|
| 5576 |
Let `N1` be `last1 - first1` and `N2` be `last2 - first2`.
|
| 5577 |
|
| 5578 |
+
*Returns:* `false` if `N1` < `N2`, otherwise:
|
| 5579 |
|
| 5580 |
``` cpp
|
| 5581 |
ranges::equal(std::move(first1) + (N1 - N2), last1, std::move(first2), last2,
|
| 5582 |
pred, proj1, proj2)
|
| 5583 |
```
|
| 5584 |
|
| 5585 |
+
``` cpp
|
| 5586 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 5587 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 5588 |
+
class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
|
| 5589 |
+
requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
|
| 5590 |
+
bool ranges::ends_with(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 5591 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5592 |
+
```
|
| 5593 |
+
|
| 5594 |
+
Let `N1` be `last1 - first1` and `N2` be `last2 - first2`.
|
| 5595 |
+
|
| 5596 |
+
*Returns:* `false` if `N1` < `N2`, otherwise:
|
| 5597 |
+
|
| 5598 |
+
``` cpp
|
| 5599 |
+
ranges::equal(std::forward<Ep>(exec), std::move(first1) + (N1 - N2), last1,
|
| 5600 |
+
std::move(first2), last2, pred, proj1, proj2)
|
| 5601 |
+
```
|
| 5602 |
+
|
| 5603 |
``` cpp
|
| 5604 |
template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity,
|
| 5605 |
class Proj2 = identity>
|
| 5606 |
requires (forward_range<R1> || sized_range<R1>) &&
|
| 5607 |
(forward_range<R2> || sized_range<R2>) &&
|
|
|
|
| 5610 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5611 |
```
|
| 5612 |
|
| 5613 |
Let `N1` be `ranges::distance(r1)` and `N2` be `ranges::distance(r2)`.
|
| 5614 |
|
| 5615 |
+
*Returns:* `false` if `N1` < `N2`, otherwise:
|
| 5616 |
|
| 5617 |
``` cpp
|
| 5618 |
+
ranges::equal(views::drop(ranges::ref_view(r1), N1 - static_cast<decltype(N1)>(N2)),
|
| 5619 |
+
r2, pred, proj1, proj2)
|
| 5620 |
+
```
|
| 5621 |
+
|
| 5622 |
+
``` cpp
|
| 5623 |
+
template<execution-policy Ep, sized-random-access-range R1,
|
| 5624 |
+
sized-random-access-range R2, class Pred = ranges::equal_to,
|
| 5625 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 5626 |
+
requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
|
| 5627 |
+
bool ranges::ends_with(Ep&& exec, R1&& r1, R2&& r2,
|
| 5628 |
+
Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 5629 |
+
```
|
| 5630 |
+
|
| 5631 |
+
Let `N1` be `ranges::distance(r1)` and `N2` be `ranges::distance(r2)`.
|
| 5632 |
+
|
| 5633 |
+
*Returns:* `false` if `N1` < `N2`, otherwise:
|
| 5634 |
+
|
| 5635 |
+
``` cpp
|
| 5636 |
+
ranges::equal(std::forward<Ep>(exec),
|
| 5637 |
+
views::drop(ranges::ref_view(r1), N1 - static_cast<decltype(N1)>(N2)),
|
| 5638 |
+
r2, pred, proj1, proj2)
|
| 5639 |
```
|
| 5640 |
|
| 5641 |
### Fold <a id="alg.fold">[[alg.fold]]</a>
|
| 5642 |
|
| 5643 |
``` cpp
|
| 5644 |
+
template<input_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 5645 |
+
indirectly-binary-left-foldable<T, I> F>
|
| 5646 |
constexpr auto ranges::fold_left(I first, S last, T init, F f);
|
| 5647 |
+
template<input_range R, class T = range_value_t<R>,
|
| 5648 |
+
indirectly-binary-left-foldable<T, iterator_t<R>> F>
|
| 5649 |
constexpr auto ranges::fold_left(R&& r, T init, F f);
|
| 5650 |
```
|
| 5651 |
|
| 5652 |
*Returns:*
|
| 5653 |
|
|
|
|
| 5670 |
``` cpp
|
| 5671 |
ranges::fold_left_first_with_iter(std::move(first), last, f).value
|
| 5672 |
```
|
| 5673 |
|
| 5674 |
``` cpp
|
| 5675 |
+
template<bidirectional_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 5676 |
indirectly-binary-right-foldable<T, I> F>
|
| 5677 |
constexpr auto ranges::fold_right(I first, S last, T init, F f);
|
| 5678 |
+
template<bidirectional_range R, class T = range_value_t<R>,
|
| 5679 |
indirectly-binary-right-foldable<T, iterator_t<R>> F>
|
| 5680 |
constexpr auto ranges::fold_right(R&& r, T init, F f);
|
| 5681 |
```
|
| 5682 |
|
| 5683 |
*Effects:* Equivalent to:
|
|
|
|
| 5716 |
return optional<U>(in_place,
|
| 5717 |
ranges::fold_right(std::move(first), tail, iter_value_t<I>(*tail), std::move(f)));
|
| 5718 |
```
|
| 5719 |
|
| 5720 |
``` cpp
|
| 5721 |
+
template<input_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
|
| 5722 |
indirectly-binary-left-foldable<T, I> F>
|
| 5723 |
constexpr see below ranges::fold_left_with_iter(I first, S last, T init, F f);
|
| 5724 |
+
template<input_range R, class T = range_value_t<R>,
|
| 5725 |
+
indirectly-binary-left-foldable<T, iterator_t<R>> F>
|
| 5726 |
constexpr see below ranges::fold_left_with_iter(R&& r, T init, F f);
|
| 5727 |
```
|
| 5728 |
|
| 5729 |
Let `U` be `decay_t<invoke_result_t<F&, T, iter_reference_t<I>>>`.
|
| 5730 |
|
|
|
|
| 5810 |
|
| 5811 |
*Complexity:* Exactly N assignments.
|
| 5812 |
|
| 5813 |
``` cpp
|
| 5814 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 5815 |
+
ForwardIterator2 copy(ExecutionPolicy&& exec,
|
| 5816 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 5817 |
ForwardIterator2 result);
|
| 5818 |
+
|
| 5819 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 5820 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 5821 |
+
requires indirectly_copyable<I, O>
|
| 5822 |
+
ranges::copy_result<I, O>
|
| 5823 |
+
ranges::copy(Ep&& exec, I first, S last, O result, OutS result_last);
|
| 5824 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 5825 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 5826 |
+
ranges::copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 5827 |
+
ranges::copy(Ep&& exec, R&& r, OutR&& result_r);
|
| 5828 |
```
|
| 5829 |
|
| 5830 |
+
Let `result_last` be `result + (last - first)` for the overload in
|
| 5831 |
+
namespace `std`.
|
| 5832 |
+
|
| 5833 |
+
Let N be min(`last - first`, `result_last - result`).
|
| 5834 |
+
|
| 5835 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 5836 |
+
`result + `N) do not overlap.
|
| 5837 |
|
| 5838 |
+
*Effects:* Copies elements in the range \[`first`, `first + `N) into the
|
| 5839 |
+
range \[`result`, `result + `N). For each non-negative integer n < N,
|
| 5840 |
+
performs `*(result + `n`) = *(first + `n`)`.
|
| 5841 |
|
| 5842 |
+
*Returns:*
|
| 5843 |
|
| 5844 |
+
- `result + `N for the overload in namespace `std`.
|
| 5845 |
+
- `{first + `N`, result + `N`}` for the overloads in namespace `ranges`.
|
| 5846 |
+
|
| 5847 |
+
*Complexity:* Exactly N assignments.
|
| 5848 |
|
| 5849 |
``` cpp
|
| 5850 |
template<class InputIterator, class Size, class OutputIterator>
|
| 5851 |
constexpr OutputIterator copy_n(InputIterator first, Size n,
|
| 5852 |
OutputIterator result);
|
|
|
|
| 5857 |
|
| 5858 |
template<input_iterator I, weakly_incrementable O>
|
| 5859 |
requires indirectly_copyable<I, O>
|
| 5860 |
constexpr ranges::copy_n_result<I, O>
|
| 5861 |
ranges::copy_n(I first, iter_difference_t<I> n, O result);
|
| 5862 |
+
|
| 5863 |
+
template<execution-policy Ep, random_access_iterator I, random_access_iterator O,
|
| 5864 |
+
sized_sentinel_for<O> OutS>
|
| 5865 |
+
requires indirectly_copyable<I, O>
|
| 5866 |
+
ranges::copy_n_result<I, O>
|
| 5867 |
+
ranges::copy_n(Ep&& exec, I first, iter_difference_t<I> n, O result, OutS result_last);
|
| 5868 |
```
|
| 5869 |
|
| 5870 |
+
Let M be max(0, `n`).
|
| 5871 |
+
|
| 5872 |
+
Let `result_last` be `result + `M for the overloads with no parameter
|
| 5873 |
+
`result_last`.
|
| 5874 |
+
|
| 5875 |
+
Let N be min(`result_last - result`, M).
|
| 5876 |
|
| 5877 |
*Mandates:* The type `Size` is convertible to an integral
|
| 5878 |
type [[conv.integral]], [[class.conv]].
|
| 5879 |
|
| 5880 |
*Effects:* For each non-negative integer i < N, performs
|
|
|
|
| 5905 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 5906 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 5907 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 5908 |
constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
|
| 5909 |
ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
| 5910 |
+
|
| 5911 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 5912 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 5913 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 5914 |
+
requires indirectly_copyable<I, O>
|
| 5915 |
+
ranges::copy_if_result<I, O>
|
| 5916 |
+
ranges::copy_if(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 5917 |
+
Pred pred, Proj proj = {});
|
| 5918 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 5919 |
+
class Proj = identity,
|
| 5920 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 5921 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 5922 |
+
ranges::copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 5923 |
+
ranges::copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred, Proj proj = {});
|
| 5924 |
```
|
| 5925 |
|
| 5926 |
+
Let E(`i`) be:
|
| 5927 |
|
| 5928 |
- `bool(pred(*i))` for the overloads in namespace `std`;
|
| 5929 |
- `bool(invoke(pred, invoke(proj, *i)))` for the overloads in namespace
|
| 5930 |
+
`ranges`.
|
| 5931 |
|
| 5932 |
+
Let:
|
| 5933 |
+
|
| 5934 |
+
- M be the number of iterators `i` in the range \[`first`, `last`) for
|
| 5935 |
+
which the condition E(`i`) holds;
|
| 5936 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 5937 |
+
`result_last` or `result_r`;
|
| 5938 |
+
- N be min(M, `result_last - result`).
|
| 5939 |
|
| 5940 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 5941 |
+
`result + `N) do not overlap.
|
| 5942 |
|
| 5943 |
+
[*Note 1*: For the parallel algorithm overload in namespace `std`,
|
| 5944 |
+
there can be a performance cost if
|
| 5945 |
+
`iterator_traits<ForwardIterator1>::value_type` does not meet the
|
| 5946 |
+
*Cpp17MoveConstructible* ([[cpp17.moveconstructible]]) requirements.
|
| 5947 |
+
For the parallel algorithm overloads in namespace `ranges`, there can be
|
| 5948 |
+
a performance cost if `iter_value_t<I>` does not model
|
| 5949 |
+
`move_constructible`. — *end note*]
|
| 5950 |
|
| 5951 |
+
*Effects:* Copies the first N elements referred to by the iterator `i`
|
| 5952 |
+
in the range \[`first`, `last`) for which E(`i`) is `true` into the
|
| 5953 |
+
range \[`result`, `result + `N).
|
| 5954 |
|
| 5955 |
*Returns:*
|
| 5956 |
|
| 5957 |
- `result + `N for the overloads in namespace `std`.
|
| 5958 |
+
- `{last, result + `N`}` for the overloads in namespace `ranges`, if N
|
| 5959 |
+
is equal to M.
|
| 5960 |
+
- Otherwise, `{j, result_last}` for the overloads in namespace `ranges`,
|
| 5961 |
+
where `j` is the iterator in \[`first`, `last`) for which E(`j`) holds
|
| 5962 |
+
and there are exactly N iterators `i` in \[`first`, `j`) for which
|
| 5963 |
+
E(`i`) holds.
|
| 5964 |
|
| 5965 |
+
*Complexity:* At most `last - first` applications of the corresponding
|
| 5966 |
predicate and any projection.
|
| 5967 |
|
| 5968 |
*Remarks:* Stable [[algorithm.stable]].
|
| 5969 |
|
| 5970 |
``` cpp
|
|
|
|
| 6017 |
requires indirectly_movable<iterator_t<R>, O>
|
| 6018 |
constexpr ranges::move_result<borrowed_iterator_t<R>, O>
|
| 6019 |
ranges::move(R&& r, O result);
|
| 6020 |
```
|
| 6021 |
|
| 6022 |
+
Let E(n) be
|
| 6023 |
|
| 6024 |
- `std::move(*(first + `n`))` for the overload in namespace `std`;
|
| 6025 |
- `ranges::iter_move(first + `n`)` for the overloads in namespace
|
| 6026 |
`ranges`.
|
| 6027 |
|
|
|
|
| 6030 |
*Preconditions:* `result` is not in the range \[`first`, `last`).
|
| 6031 |
|
| 6032 |
*Effects:* Moves elements in the range \[`first`, `last`) into the range
|
| 6033 |
\[`result`, `result + `N) starting from `first` and proceeding to
|
| 6034 |
`last`. For each non-negative integer n < N, performs
|
| 6035 |
+
`*(result + `n`) = `E(n).
|
| 6036 |
|
| 6037 |
*Returns:*
|
| 6038 |
|
| 6039 |
- `result + `N for the overload in namespace `std`.
|
| 6040 |
- `{last, result + `N`}` for the overloads in namespace `ranges`.
|
| 6041 |
|
| 6042 |
*Complexity:* Exactly N assignments.
|
| 6043 |
|
| 6044 |
``` cpp
|
| 6045 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 6046 |
+
ForwardIterator2 move(ExecutionPolicy&& exec,
|
| 6047 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 6048 |
ForwardIterator2 result);
|
| 6049 |
+
|
| 6050 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6051 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 6052 |
+
requires indirectly_movable<I, O>
|
| 6053 |
+
ranges::move_result<I, O>
|
| 6054 |
+
ranges::move(Ep&& exec, I first, S last, O result, OutS result_last);
|
| 6055 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 6056 |
+
requires indirectly_movable<iterator_t<R>, iterator_t<OutR>>
|
| 6057 |
+
ranges::move_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6058 |
+
ranges::move(Ep&& exec, R&& r, OutR&& result_r);
|
| 6059 |
```
|
| 6060 |
|
| 6061 |
+
Let E(n) be:
|
| 6062 |
+
|
| 6063 |
+
- `std::move(*(first + `n`))` for the overload in namespace `std`;
|
| 6064 |
+
- `ranges::iter_move(first + `n`)` for the overloads in namespace
|
| 6065 |
+
`ranges`.
|
| 6066 |
+
|
| 6067 |
+
Let `result_last` be `result + (last - first)` for the overloads in
|
| 6068 |
+
namespace `std`.
|
| 6069 |
+
|
| 6070 |
+
Let N be min(`last - first`, `result_last - result`).
|
| 6071 |
|
| 6072 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 6073 |
`result + `N) do not overlap.
|
| 6074 |
|
| 6075 |
+
*Effects:* Moves elements in the range \[`first`, `first + `N) into the
|
| 6076 |
+
range \[`result`, `result + `N). For each non-negative integer n < N,
|
| 6077 |
+
performs `*(result + `n`) = `E(n).
|
| 6078 |
|
| 6079 |
+
*Returns:*
|
| 6080 |
+
|
| 6081 |
+
- `result + `N for the overload in namespace `std`.
|
| 6082 |
+
- `{first + `N`, result + `N`}` for the overloads in namespace `ranges`.
|
| 6083 |
|
| 6084 |
*Complexity:* Exactly N assignments.
|
| 6085 |
|
| 6086 |
``` cpp
|
| 6087 |
template<class BidirectionalIterator1, class BidirectionalIterator2>
|
|
|
|
| 6097 |
requires indirectly_movable<iterator_t<R>, I>
|
| 6098 |
constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
|
| 6099 |
ranges::move_backward(R&& r, I result);
|
| 6100 |
```
|
| 6101 |
|
| 6102 |
+
Let E(n) be
|
| 6103 |
|
| 6104 |
- `std::move(*(last - `n`))` for the overload in namespace `std`;
|
| 6105 |
- `ranges::iter_move(last - `n`)` for the overloads in namespace
|
| 6106 |
`ranges`.
|
| 6107 |
|
|
|
|
| 6111 |
|
| 6112 |
*Effects:* Moves elements in the range \[`first`, `last`) into the range
|
| 6113 |
\[`result - `N, `result`) starting from `last - 1` and proceeding to
|
| 6114 |
`first`.[^3]
|
| 6115 |
|
| 6116 |
+
For each positive integer n ≤ N, performs `*(result - `n`) = `E(n).
|
| 6117 |
|
| 6118 |
*Returns:*
|
| 6119 |
|
| 6120 |
- `result - `N for the overload in namespace `std`.
|
| 6121 |
- `{last, result - `N`}` for the overloads in namespace `ranges`.
|
|
|
|
| 6141 |
ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
|
| 6142 |
template<input_range R1, input_range R2>
|
| 6143 |
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 6144 |
constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 6145 |
ranges::swap_ranges(R1&& r1, R2&& r2);
|
| 6146 |
+
|
| 6147 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 6148 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2>
|
| 6149 |
+
requires indirectly_swappable<I1, I2>
|
| 6150 |
+
ranges::swap_ranges_result<I1, I2>
|
| 6151 |
+
ranges::swap_ranges(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2);
|
| 6152 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2>
|
| 6153 |
+
requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
|
| 6154 |
+
ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 6155 |
+
ranges::swap_ranges(Ep&& exec, R1&& r1, R2&& r2);
|
| 6156 |
```
|
| 6157 |
|
| 6158 |
Let:
|
| 6159 |
|
| 6160 |
+
- `last2` be `first2 + (last1 - first1)` for the overloads in namespace
|
| 6161 |
+
`std` with no parameter named `last2`;
|
| 6162 |
- M be min(`last1 - first1`, `last2 - first2`).
|
| 6163 |
|
| 6164 |
*Preconditions:* The two ranges \[`first1`, `last1`) and \[`first2`,
|
| 6165 |
`last2`) do not overlap. For the overloads in namespace `std`,
|
| 6166 |
`*(first1 + `n`)` is swappable with [[swappable.requirements]]
|
|
|
|
| 6228 |
template<input_range R, weakly_incrementable O, copy_constructible F,
|
| 6229 |
class Proj = identity>
|
| 6230 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 6231 |
constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
|
| 6232 |
ranges::transform(R&& r, O result, F op, Proj proj = {});
|
| 6233 |
+
|
| 6234 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6235 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 6236 |
+
copy_constructible F, class Proj = identity>
|
| 6237 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
|
| 6238 |
+
ranges::unary_transform_result<I, O>
|
| 6239 |
+
ranges::transform(Ep&& exec, I first1, S last1, O result, OutS result_last,
|
| 6240 |
+
F op, Proj proj = {});
|
| 6241 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6242 |
+
copy_constructible F, class Proj = identity>
|
| 6243 |
+
requires indirectly_writable<iterator_t<OutR>,
|
| 6244 |
+
indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 6245 |
+
ranges::unary_transform_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6246 |
+
ranges::transform(Ep&& exec, R&& r, OutR&& result_r, F op, Proj proj = {});
|
| 6247 |
+
|
| 6248 |
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 6249 |
weakly_incrementable O, copy_constructible F, class Proj1 = identity,
|
| 6250 |
class Proj2 = identity>
|
| 6251 |
requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
|
| 6252 |
projected<I2, Proj2>>>
|
|
|
|
| 6258 |
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 6259 |
projected<iterator_t<R2>, Proj2>>>
|
| 6260 |
constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 6261 |
ranges::transform(R1&& r1, R2&& r2, O result,
|
| 6262 |
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 6263 |
+
|
| 6264 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 6265 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 6266 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 6267 |
+
copy_constructible F, class Proj1 = identity, class Proj2 = identity>
|
| 6268 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
|
| 6269 |
+
projected<I2, Proj2>>>
|
| 6270 |
+
ranges::binary_transform_result<I1, I2, O>
|
| 6271 |
+
ranges::transform(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 6272 |
+
O result, OutS result_last,
|
| 6273 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 6274 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 6275 |
+
sized-random-access-range OutR, copy_constructible F,
|
| 6276 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 6277 |
+
requires indirectly_writable<iterator_t<OutR>,
|
| 6278 |
+
indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 6279 |
+
projected<iterator_t<R2>, Proj2>>>
|
| 6280 |
+
ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 6281 |
+
borrowed_iterator_t<OutR>>
|
| 6282 |
+
ranges::transform(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
|
| 6283 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 6284 |
```
|
| 6285 |
|
| 6286 |
Let:
|
| 6287 |
|
| 6288 |
+
- `last2` be `first2 + (last1 - first1)` for the overloads in namespace
|
| 6289 |
+
`std` with parameter `first2` but no parameter `last2`;
|
| 6290 |
+
- M be `last1 - first1` for unary transforms, or
|
| 6291 |
min(`last1 - first1`, `last2 - first2`) for binary transforms;
|
| 6292 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 6293 |
+
`result_last` or `result_r`;
|
| 6294 |
+
- N be min(M, `result_last - result`);
|
| 6295 |
+
- E(`i`) be
|
| 6296 |
- `op(*(first1 + (i - result)))` for unary transforms defined in
|
| 6297 |
namespace `std`;
|
| 6298 |
- `binary_op(*(first1 + (i - result)), *(first2 + (i - result)))` for
|
| 6299 |
binary transforms defined in namespace `std`;
|
| 6300 |
- `invoke(op, invoke(proj, *(first1 + (i - result))))` for unary
|
| 6301 |
transforms defined in namespace `ranges`;
|
| 6302 |
- `invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,*(first2 + (i - result))))`
|
| 6303 |
for binary transforms defined in namespace `ranges`.
|
| 6304 |
|
| 6305 |
+
*Preconditions:* For parallel algorithm overloads `op` and `binary_op`
|
| 6306 |
+
satisfy the requirements specified in [[algorithms.parallel.user]]. `op`
|
| 6307 |
+
and `binary_op` do not invalidate iterators or subranges, nor modify
|
| 6308 |
+
elements in the ranges
|
| 6309 |
|
| 6310 |
- \[`first1`, `first1 + `N\],
|
| 6311 |
- \[`first2`, `first2 + `N\], and
|
| 6312 |
- \[`result`, `result + `N\].[^4]
|
| 6313 |
|
| 6314 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 6315 |
+
`result + `N) a new corresponding value equal to E(`i`).
|
| 6316 |
|
| 6317 |
*Returns:*
|
| 6318 |
|
| 6319 |
- `result + `N for the overloads defined in namespace `std`.
|
| 6320 |
- `{first1 + `N`, result + `N`}` for unary transforms defined in
|
| 6321 |
namespace `ranges`.
|
| 6322 |
- `{first1 + `N`, first2 + `N`, result + `N`}` for binary transforms
|
| 6323 |
defined in namespace `ranges`.
|
| 6324 |
|
| 6325 |
*Complexity:* Exactly N applications of `op` or `binary_op`, and any
|
| 6326 |
+
projections. This requirement also applies to the parallel algorithm
|
| 6327 |
+
overloads.
|
| 6328 |
|
| 6329 |
*Remarks:* `result` may be equal to `first1` or `first2`.
|
| 6330 |
|
| 6331 |
### Replace <a id="alg.replace">[[alg.replace]]</a>
|
| 6332 |
|
| 6333 |
``` cpp
|
| 6334 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 6335 |
constexpr void replace(ForwardIterator first, ForwardIterator last,
|
| 6336 |
const T& old_value, const T& new_value);
|
| 6337 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 6338 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6339 |
void replace(ExecutionPolicy&& exec,
|
| 6340 |
ForwardIterator first, ForwardIterator last,
|
| 6341 |
const T& old_value, const T& new_value);
|
| 6342 |
|
| 6343 |
+
template<class ForwardIterator, class Predicate,
|
| 6344 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6345 |
constexpr void replace_if(ForwardIterator first, ForwardIterator last,
|
| 6346 |
Predicate pred, const T& new_value);
|
| 6347 |
+
template<class ExecutionPolicy, class ForwardIterator, class Predicate,
|
| 6348 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6349 |
void replace_if(ExecutionPolicy&& exec,
|
| 6350 |
ForwardIterator first, ForwardIterator last,
|
| 6351 |
Predicate pred, const T& new_value);
|
| 6352 |
|
| 6353 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 6354 |
+
class T1 = projected_value_t<I, Proj>, class T2 = T1>
|
| 6355 |
requires indirectly_writable<I, const T2&> &&
|
| 6356 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 6357 |
constexpr I
|
| 6358 |
ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 6359 |
+
template<input_range R, class Proj = identity,
|
| 6360 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
|
| 6361 |
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 6362 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
|
| 6363 |
constexpr borrowed_iterator_t<R>
|
| 6364 |
ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
|
| 6365 |
+
|
| 6366 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6367 |
+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = T1>
|
| 6368 |
+
requires indirectly_writable<I, const T2&> &&
|
| 6369 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
|
| 6370 |
+
I ranges::replace(Ep&& exec, I first, S last,
|
| 6371 |
+
const T1& old_value, const T2& new_value, Proj proj = {});
|
| 6372 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 6373 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
|
| 6374 |
+
requires indirectly_writable<iterator_t<R>, const T2&> &&
|
| 6375 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 6376 |
+
projected<iterator_t<R>, Proj>, const T1*>
|
| 6377 |
+
borrowed_iterator_t<R>
|
| 6378 |
+
ranges::replace(Ep&& exec, R&& r, const T1& old_value, const T2& new_value,
|
| 6379 |
+
Proj proj = {});
|
| 6380 |
+
|
| 6381 |
+
template<input_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 6382 |
+
class T = projected_value_t<I, Proj>,
|
| 6383 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6384 |
requires indirectly_writable<I, const T&>
|
| 6385 |
constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
|
| 6386 |
+
template<input_range R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>,
|
| 6387 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6388 |
requires indirectly_writable<iterator_t<R>, const T&>
|
| 6389 |
constexpr borrowed_iterator_t<R>
|
| 6390 |
ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
|
| 6391 |
+
|
| 6392 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6393 |
+
class Proj = identity, class T = projected_value_t<I, Proj>,
|
| 6394 |
+
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6395 |
+
requires indirectly_writable<I, const T&>
|
| 6396 |
+
I ranges::replace_if(Ep&& exec, I first, S last, Pred pred,
|
| 6397 |
+
const T& new_value, Proj proj = {});
|
| 6398 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 6399 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 6400 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6401 |
+
requires indirectly_writable<iterator_t<R>, const T&>
|
| 6402 |
+
borrowed_iterator_t<R>
|
| 6403 |
+
ranges::replace_if(Ep&& exec, R&& r, Pred pred, const T& new_value, Proj proj = {});
|
| 6404 |
```
|
| 6405 |
|
| 6406 |
+
Let E(`i`) be
|
| 6407 |
|
| 6408 |
- `bool(*i == old_value)` for `replace`;
|
| 6409 |
- `bool(pred(*i))` for `replace_if`;
|
| 6410 |
- `bool(invoke(proj, *i) == old_value)` for `ranges::replace`;
|
| 6411 |
- `bool(invoke(pred, invoke(proj, *i)))` for `ranges::replace_if`.
|
| 6412 |
|
| 6413 |
*Mandates:* `new_value` is writable [[iterator.requirements.general]] to
|
| 6414 |
`first`.
|
| 6415 |
|
| 6416 |
*Effects:* Substitutes elements referred by the iterator `i` in the
|
| 6417 |
+
range \[`first`, `last`) with `new_value`, when E(`i`) is `true`.
|
| 6418 |
|
| 6419 |
*Returns:* `last` for the overloads in namespace `ranges`.
|
| 6420 |
|
| 6421 |
*Complexity:* Exactly `last - first` applications of the corresponding
|
| 6422 |
predicate and any projection.
|
|
|
|
| 6445 |
replace_copy_if(ExecutionPolicy&& exec,
|
| 6446 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 6447 |
ForwardIterator2 result,
|
| 6448 |
Predicate pred, const T& new_value);
|
| 6449 |
|
| 6450 |
+
template<input_iterator I, sentinel_for<I> S, class O,
|
| 6451 |
+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<O>>
|
| 6452 |
requires indirectly_copyable<I, O> &&
|
| 6453 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> &&
|
| 6454 |
+
output_iterator<O, const T2&>
|
| 6455 |
constexpr ranges::replace_copy_result<I, O>
|
| 6456 |
ranges::replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
|
| 6457 |
Proj proj = {});
|
| 6458 |
+
template<input_range R, class O, class Proj = identity,
|
| 6459 |
+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = iter_value_t<O>>
|
| 6460 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 6461 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
|
| 6462 |
+
&& output_iterator<O, const T2&>
|
| 6463 |
constexpr ranges::replace_copy_result<borrowed_iterator_t<R>, O>
|
| 6464 |
ranges::replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
|
| 6465 |
Proj proj = {});
|
| 6466 |
|
| 6467 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6468 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 6469 |
+
class Proj = identity,
|
| 6470 |
+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<O>>
|
| 6471 |
+
requires indirectly_copyable<I, O> &&
|
| 6472 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> &&
|
| 6473 |
+
indirectly_writable<O, const T2&>
|
| 6474 |
+
ranges::replace_copy_result<I, O>
|
| 6475 |
+
ranges::replace_copy(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 6476 |
+
const T1& old_value, const T2& new_value, Proj proj = {});
|
| 6477 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6478 |
+
class Proj = identity, class T1 = projected_value_t<iterator_t<R>, Proj>,
|
| 6479 |
+
class T2 = range_value_t<OutR>>
|
| 6480 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 6481 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 6482 |
+
projected<iterator_t<R>, Proj>, const T1*> &&
|
| 6483 |
+
indirectly_writable<iterator_t<OutR>, const T2&>
|
| 6484 |
+
ranges::replace_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6485 |
+
ranges::replace_copy(Ep&& exec, R&& r, OutR&& result_r, const T1& old_value,
|
| 6486 |
+
const T2& new_value, Proj proj = {});
|
| 6487 |
+
|
| 6488 |
+
template<input_iterator I, sentinel_for<I> S,class O, class T = iter_value_t<O>,
|
| 6489 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6490 |
+
requires indirectly_copyable<I, O> && output_iterator<O, const T&>
|
| 6491 |
constexpr ranges::replace_copy_if_result<I, O>
|
| 6492 |
ranges::replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
|
| 6493 |
Proj proj = {});
|
| 6494 |
+
template<input_range R, class O, class T = iter_value_t<O>, class Proj = identity,
|
| 6495 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6496 |
+
requires indirectly_copyable<iterator_t<R>, O> && output_iterator<O, const T&>
|
| 6497 |
constexpr ranges::replace_copy_if_result<borrowed_iterator_t<R>, O>
|
| 6498 |
ranges::replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
|
| 6499 |
Proj proj = {});
|
| 6500 |
+
|
| 6501 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6502 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class T = iter_value_t<O>,
|
| 6503 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6504 |
+
requires indirectly_copyable<I, O> && indirectly_writable<O, const T&>
|
| 6505 |
+
ranges::replace_copy_if_result<I, O>
|
| 6506 |
+
ranges::replace_copy_if(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 6507 |
+
Pred pred, const T& new_value, Proj proj = {});
|
| 6508 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6509 |
+
class T = range_value_t<OutR>, class Proj = identity,
|
| 6510 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6511 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 6512 |
+
indirectly_writable<OutR, const T&>
|
| 6513 |
+
ranges::replace_copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6514 |
+
ranges::replace_copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred, const T& new_value,
|
| 6515 |
+
Proj proj = {});
|
| 6516 |
```
|
| 6517 |
|
| 6518 |
+
Let E(`i`) be
|
| 6519 |
|
| 6520 |
- `bool(*(first + (i - result)) == old_value)` for `replace_copy`;
|
| 6521 |
- `bool(pred(*(first + (i - result))))` for `replace_copy_if`;
|
| 6522 |
- `bool(invoke(proj, *(first + (i - result))) == old_value)` for
|
| 6523 |
`ranges::replace_copy`;
|
| 6524 |
- `bool(invoke(pred, invoke(proj, *(first + (i - result)))))` for
|
| 6525 |
`ranges::replace_copy_if`.
|
| 6526 |
|
| 6527 |
+
Let:
|
| 6528 |
+
|
| 6529 |
+
- `result_last` be `result + (last - first)` for the overloads with no
|
| 6530 |
+
parameter `result_last` or `result_r`;
|
| 6531 |
+
- N be min(`last - first`, `result_last - result`).
|
| 6532 |
+
|
| 6533 |
*Mandates:* The results of the expressions `*first` and `new_value` are
|
| 6534 |
writable [[iterator.requirements.general]] to `result`.
|
| 6535 |
|
| 6536 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 6537 |
+
`result + `N) do not overlap.
|
| 6538 |
|
| 6539 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 6540 |
+
`result + `N) a new corresponding value
|
| 6541 |
|
| 6542 |
+
- `new_value` if E(`i`) is `true` or
|
| 6543 |
- `*(first + (i - result))` otherwise.
|
| 6544 |
|
| 6545 |
*Returns:*
|
| 6546 |
|
| 6547 |
+
- `result + `N for the overloads in namespace `std`.
|
| 6548 |
+
- `{first + `N`, result + `N`}` for the overloads in namespace `ranges`.
|
|
|
|
| 6549 |
|
| 6550 |
+
*Complexity:* Exactly N applications of the corresponding predicate and
|
| 6551 |
+
any projection.
|
| 6552 |
|
| 6553 |
### Fill <a id="alg.fill">[[alg.fill]]</a>
|
| 6554 |
|
| 6555 |
``` cpp
|
| 6556 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 6557 |
constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value);
|
| 6558 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 6559 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6560 |
void fill(ExecutionPolicy&& exec,
|
| 6561 |
ForwardIterator first, ForwardIterator last, const T& value);
|
| 6562 |
|
| 6563 |
+
template<class OutputIterator, class Size, class T = iterator_traits<OutputIterator>::value_type>
|
| 6564 |
constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value);
|
| 6565 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 6566 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6567 |
ForwardIterator fill_n(ExecutionPolicy&& exec,
|
| 6568 |
ForwardIterator first, Size n, const T& value);
|
| 6569 |
|
| 6570 |
+
template<class O, sentinel_for<O> S, class T = iter_value_t<O>>
|
| 6571 |
+
requires output_iterator<O, const T&>
|
| 6572 |
constexpr O ranges::fill(O first, S last, const T& value);
|
| 6573 |
+
template<class R, class T = range_value_t<R>>
|
| 6574 |
+
requires output_range<R, const T&>
|
| 6575 |
constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value);
|
| 6576 |
+
template<class O, class T = iter_value_t<O>>
|
| 6577 |
+
requires output_iterator<O, const T&>
|
| 6578 |
constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value);
|
| 6579 |
+
|
| 6580 |
+
template<execution-policy Ep, random_access_iterator O, sized_sentinel_for<O> S,
|
| 6581 |
+
class T = iter_value_t<O>>
|
| 6582 |
+
requires indirectly_writable<O, const T&>
|
| 6583 |
+
O ranges::fill(Ep&& exec, O first, S last, const T& value);
|
| 6584 |
+
template<execution-policy Ep, sized-random-access-range R, class T = range_value_t<R>>
|
| 6585 |
+
requires indirectly_writable<iterator_t<R>, const T&>
|
| 6586 |
+
borrowed_iterator_t<R> fill(Ep&& exec, R&& r, const T& value);
|
| 6587 |
+
template<execution-policy Ep, random_access_iterator O, class T = iter_value_t<O>>
|
| 6588 |
+
requires indirectly_writable<O, const T&>
|
| 6589 |
+
O ranges::fill_n(Ep&& exec, O first, iter_difference_t<O> n, const T& value);
|
| 6590 |
```
|
| 6591 |
|
| 6592 |
Let N be max(0, `n`) for the `fill_n` algorithms, and `last - first` for
|
| 6593 |
the `fill` algorithms.
|
| 6594 |
|
|
|
|
| 6628 |
requires invocable<F&> && output_range<R, invoke_result_t<F&>>
|
| 6629 |
constexpr borrowed_iterator_t<R> ranges::generate(R&& r, F gen);
|
| 6630 |
template<input_or_output_iterator O, copy_constructible F>
|
| 6631 |
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 6632 |
constexpr O ranges::generate_n(O first, iter_difference_t<O> n, F gen);
|
| 6633 |
+
|
| 6634 |
+
template<execution-policy Ep, random_access_iterator O, sized_sentinel_for<O> S,
|
| 6635 |
+
copy_constructible F>
|
| 6636 |
+
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 6637 |
+
O ranges::generate(Ep&& exec, O first, S last, F gen);
|
| 6638 |
+
template<execution-policy Ep, sized-random-access-range R, copy_constructible F>
|
| 6639 |
+
requires invocable<F&> && indirectly_writable<iterator_t<R>, invoke_result_t<F&>>
|
| 6640 |
+
borrowed_iterator_t<R> ranges::generate(Ep&& exec, R&& r, F gen);
|
| 6641 |
+
template<execution-policy Ep, random_access_iterator O, copy_constructible F>
|
| 6642 |
+
requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
|
| 6643 |
+
O ranges::generate_n(Ep&& exec, O first, iter_difference_t<O> n, F gen);
|
| 6644 |
```
|
| 6645 |
|
| 6646 |
Let N be max(0, `n`) for the `generate_n` algorithms, and `last - first`
|
| 6647 |
for the `generate` algorithms.
|
| 6648 |
|
|
|
|
| 6654 |
|
| 6655 |
*Returns:* `first + `N.
|
| 6656 |
|
| 6657 |
*Complexity:* Exactly N evaluations of `gen()` and assignments.
|
| 6658 |
|
| 6659 |
+
*Remarks:* `gen` may modify objects via its arguments for parallel
|
| 6660 |
+
algorithm overloads [[algorithms.parallel.user]].
|
| 6661 |
+
|
| 6662 |
### Remove <a id="alg.remove">[[alg.remove]]</a>
|
| 6663 |
|
| 6664 |
``` cpp
|
| 6665 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 6666 |
constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last,
|
| 6667 |
const T& value);
|
| 6668 |
+
template<class ExecutionPolicy, class ForwardIterator,
|
| 6669 |
+
class T = iterator_traits<ForwardIterator>::value_type>
|
| 6670 |
ForwardIterator remove(ExecutionPolicy&& exec,
|
| 6671 |
ForwardIterator first, ForwardIterator last,
|
| 6672 |
const T& value);
|
| 6673 |
|
| 6674 |
template<class ForwardIterator, class Predicate>
|
|
|
|
| 6677 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 6678 |
ForwardIterator remove_if(ExecutionPolicy&& exec,
|
| 6679 |
ForwardIterator first, ForwardIterator last,
|
| 6680 |
Predicate pred);
|
| 6681 |
|
| 6682 |
+
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 6683 |
+
class T = projected_value_t<I, Proj>>
|
| 6684 |
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 6685 |
constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {});
|
| 6686 |
+
template<forward_range R, class Proj = identity,
|
| 6687 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 6688 |
requires permutable<iterator_t<R>> &&
|
| 6689 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 6690 |
constexpr borrowed_subrange_t<R>
|
| 6691 |
ranges::remove(R&& r, const T& value, Proj proj = {});
|
| 6692 |
+
|
| 6693 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6694 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 6695 |
+
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 6696 |
+
subrange<I>
|
| 6697 |
+
ranges::remove(Ep&& exec, I first, S last, const T& value, Proj proj = {});
|
| 6698 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 6699 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 6700 |
+
requires permutable<iterator_t<R>> &&
|
| 6701 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 6702 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 6703 |
+
borrowed_subrange_t<R>
|
| 6704 |
+
ranges::remove(Ep&& exec, R&& r, const T& value, Proj proj = {});
|
| 6705 |
+
|
| 6706 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 6707 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6708 |
constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {});
|
| 6709 |
template<forward_range R, class Proj = identity,
|
| 6710 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6711 |
requires permutable<iterator_t<R>>
|
| 6712 |
constexpr borrowed_subrange_t<R>
|
| 6713 |
ranges::remove_if(R&& r, Pred pred, Proj proj = {});
|
| 6714 |
+
|
| 6715 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6716 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6717 |
+
subrange<I>
|
| 6718 |
+
ranges::remove_if(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 6719 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 6720 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6721 |
+
requires permutable<iterator_t<R>>
|
| 6722 |
+
borrowed_subrange_t<R>
|
| 6723 |
+
ranges::remove_if(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 6724 |
```
|
| 6725 |
|
| 6726 |
Let E be
|
| 6727 |
|
| 6728 |
- `bool(*i == value)` for `remove`;
|
|
|
|
| 6751 |
the returned value, has a valid but unspecified state, because the
|
| 6752 |
algorithms can eliminate elements by moving from elements that were
|
| 6753 |
originally in that range. — *end note*]
|
| 6754 |
|
| 6755 |
``` cpp
|
| 6756 |
+
template<class InputIterator, class OutputIterator,
|
| 6757 |
+
class T = iterator_traits<InputIterator>::value_type>
|
| 6758 |
constexpr OutputIterator
|
| 6759 |
remove_copy(InputIterator first, InputIterator last,
|
| 6760 |
OutputIterator result, const T& value);
|
| 6761 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 6762 |
+
class T = iterator_traits<ForwardIterator1>::value_type>
|
| 6763 |
ForwardIterator2
|
| 6764 |
remove_copy(ExecutionPolicy&& exec,
|
| 6765 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 6766 |
ForwardIterator2 result, const T& value);
|
| 6767 |
|
|
|
|
| 6774 |
ForwardIterator2
|
| 6775 |
remove_copy_if(ExecutionPolicy&& exec,
|
| 6776 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 6777 |
ForwardIterator2 result, Predicate pred);
|
| 6778 |
|
| 6779 |
+
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 6780 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 6781 |
requires indirectly_copyable<I, O> &&
|
| 6782 |
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 6783 |
constexpr ranges::remove_copy_result<I, O>
|
| 6784 |
ranges::remove_copy(I first, S last, O result, const T& value, Proj proj = {});
|
| 6785 |
+
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 6786 |
+
class T = projected_value_t<iterator_t<R>, Proj>>
|
| 6787 |
requires indirectly_copyable<iterator_t<R>, O> &&
|
| 6788 |
indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
|
| 6789 |
constexpr ranges::remove_copy_result<borrowed_iterator_t<R>, O>
|
| 6790 |
ranges::remove_copy(R&& r, O result, const T& value, Proj proj = {});
|
| 6791 |
+
|
| 6792 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6793 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 6794 |
+
class Proj = identity, class T = projected_value_t<I, Proj>>
|
| 6795 |
+
requires indirectly_copyable<I, O> &&
|
| 6796 |
+
indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
|
| 6797 |
+
ranges::remove_copy_result<I, O>
|
| 6798 |
+
ranges::remove_copy(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 6799 |
+
const T& value, Proj proj = {});
|
| 6800 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6801 |
+
class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>>
|
| 6802 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>> &&
|
| 6803 |
+
indirect_binary_predicate<ranges::equal_to,
|
| 6804 |
+
projected<iterator_t<R>, Proj>, const T*>
|
| 6805 |
+
ranges::remove_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6806 |
+
ranges::remove_copy(Ep&& exec, R&& r, OutR&& result_r, const T& value, Proj proj = {});
|
| 6807 |
+
|
| 6808 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 6809 |
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6810 |
requires indirectly_copyable<I, O>
|
| 6811 |
constexpr ranges::remove_copy_if_result<I, O>
|
| 6812 |
ranges::remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {});
|
| 6813 |
template<input_range R, weakly_incrementable O, class Proj = identity,
|
| 6814 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6815 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 6816 |
constexpr ranges::remove_copy_if_result<borrowed_iterator_t<R>, O>
|
| 6817 |
ranges::remove_copy_if(R&& r, O result, Pred pred, Proj proj = {});
|
| 6818 |
+
|
| 6819 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6820 |
+
random_access_iterator O, sized_sentinel_for<O> OutS,
|
| 6821 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 6822 |
+
requires indirectly_copyable<I, O>
|
| 6823 |
+
ranges::remove_copy_if_result<I, O>
|
| 6824 |
+
ranges::remove_copy_if(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 6825 |
+
Pred pred, Proj proj = {});
|
| 6826 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6827 |
+
class Proj = identity,
|
| 6828 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 6829 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 6830 |
+
ranges::remove_copy_if_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6831 |
+
ranges::remove_copy_if(Ep&& exec, R&& r, OutR&& result_r, Pred pred, Proj proj = {});
|
| 6832 |
```
|
| 6833 |
|
| 6834 |
+
Let E(`i`) be
|
| 6835 |
|
| 6836 |
- `bool(*i == value)` for `remove_copy`;
|
| 6837 |
- `bool(pred(*i))` for `remove_copy_if`;
|
| 6838 |
- `bool(invoke(proj, *i) == value)` for `ranges::remove_copy`;
|
| 6839 |
- `bool(invoke(pred, invoke(proj, *i)))` for `ranges::remove_copy_if`.
|
| 6840 |
|
| 6841 |
+
Let:
|
| 6842 |
+
|
| 6843 |
+
- M be the number of iterators `i` in \[`first`, `last`) for which
|
| 6844 |
+
E(`i`) is `false`;
|
| 6845 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 6846 |
+
`result_last` or `result_r`;
|
| 6847 |
+
- N be min(M, `result_last - result`).
|
| 6848 |
|
| 6849 |
*Mandates:* `*first` is writable [[iterator.requirements.general]] to
|
| 6850 |
`result`.
|
| 6851 |
|
| 6852 |
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 6853 |
+
`result + `N) do not overlap.
|
| 6854 |
|
| 6855 |
+
[*Note 2*: For the parallel algorithm overloads in namespace `std`,
|
| 6856 |
+
there can be a performance cost if
|
| 6857 |
+
`iterator_traits<ForwardIterator1>::value_type` does not meet the
|
| 6858 |
+
*Cpp17MoveConstructible* ([[cpp17.moveconstructible]]) requirements.
|
| 6859 |
+
For the parallel algorithm overloads in namespace `ranges`, there can be
|
| 6860 |
+
a performance cost if `iter_value_t<I>` does not model
|
| 6861 |
+
`move_constructible`. — *end note*]
|
| 6862 |
|
| 6863 |
+
*Effects:* Copies the first N elements referred to by the iterator `i`
|
| 6864 |
+
in the range \[`first`, `last`) for which E(`i`) is `false` into the
|
| 6865 |
+
range \[`result`, `result + `N).
|
| 6866 |
|
| 6867 |
*Returns:*
|
| 6868 |
|
| 6869 |
- `result + `N, for the algorithms in namespace `std`.
|
| 6870 |
+
- `{last, result + `N`}`, for the algorithms in namespace `ranges`, if N
|
| 6871 |
+
is equal to M.
|
| 6872 |
+
- Otherwise, `{j, result_last}`, for the algorithms in namespace
|
| 6873 |
+
`ranges`, where `j` is the iterator in \[`first`, `last`) for which
|
| 6874 |
+
E(`j`) is `false` and there are exactly N iterators `i` in \[`first`,
|
| 6875 |
+
`j`) for which E(`i`) is `false`.
|
| 6876 |
|
| 6877 |
+
*Complexity:* At most `last - first` applications of the corresponding
|
| 6878 |
predicate and any projection.
|
| 6879 |
|
| 6880 |
*Remarks:* Stable [[algorithm.stable]].
|
| 6881 |
|
| 6882 |
### Unique <a id="alg.unique">[[alg.unique]]</a>
|
|
|
|
| 6902 |
template<forward_range R, class Proj = identity,
|
| 6903 |
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 6904 |
requires permutable<iterator_t<R>>
|
| 6905 |
constexpr borrowed_subrange_t<R>
|
| 6906 |
ranges::unique(R&& r, C comp = {}, Proj proj = {});
|
| 6907 |
+
|
| 6908 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6909 |
+
class Proj = identity,
|
| 6910 |
+
indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
|
| 6911 |
+
requires permutable<I>
|
| 6912 |
+
subrange<I> ranges::unique(Ep&& exec, I first, S last, C comp = {}, Proj proj = {});
|
| 6913 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 6914 |
+
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 6915 |
+
requires permutable<iterator_t<R>>
|
| 6916 |
+
borrowed_subrange_t<R> ranges::unique(Ep&& exec, R&& r, C comp = {}, Proj proj = {});
|
| 6917 |
```
|
| 6918 |
|
| 6919 |
Let `pred` be `equal_to{}` for the overloads with no parameter `pred`,
|
| 6920 |
and let E be
|
| 6921 |
|
|
|
|
| 6977 |
(forward_iterator<iterator_t<R>> ||
|
| 6978 |
(input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
|
| 6979 |
indirectly_copyable_storable<iterator_t<R>, O>)
|
| 6980 |
constexpr ranges::unique_copy_result<borrowed_iterator_t<R>, O>
|
| 6981 |
ranges::unique_copy(R&& r, O result, C comp = {}, Proj proj = {});
|
| 6982 |
+
|
| 6983 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 6984 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Proj = identity,
|
| 6985 |
+
indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
|
| 6986 |
+
requires indirectly_copyable<I, O>
|
| 6987 |
+
ranges::unique_copy_result<I, O>
|
| 6988 |
+
ranges::unique_copy(Ep&& exec, I first, S last, O result, OutS result_last,
|
| 6989 |
+
C comp = {}, Proj proj = {});
|
| 6990 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
|
| 6991 |
+
class Proj = identity,
|
| 6992 |
+
indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
|
| 6993 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 6994 |
+
ranges::unique_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 6995 |
+
ranges::unique_copy(Ep&& exec, R&& r, OutR&& result_r, C comp = {}, Proj proj = {});
|
| 6996 |
```
|
| 6997 |
|
| 6998 |
Let `pred` be `equal_to{}` for the overloads in namespace `std` with no
|
| 6999 |
+
parameter `pred`, and let E(`i`) be
|
| 7000 |
|
| 7001 |
- `bool(pred(*i, *(i - 1)))` for the overloads in namespace `std`;
|
| 7002 |
- `bool(invoke(comp, invoke(proj, *i), invoke(proj, *(i - 1))))` for the
|
| 7003 |
overloads in namespace `ranges`.
|
| 7004 |
|
| 7005 |
+
Let:
|
| 7006 |
+
|
| 7007 |
+
- M be the number of iterators `i` in the range \[`first + 1`, `last`)
|
| 7008 |
+
for which E(`i`) is `false`;
|
| 7009 |
+
- `result_last` be `result + `M` + 1` for the overloads with no
|
| 7010 |
+
parameter `result_last` or `result_r`;
|
| 7011 |
+
- N be min(M + 1, `result_last - result`).
|
| 7012 |
+
|
| 7013 |
*Mandates:* `*first` is writable [[iterator.requirements.general]] to
|
| 7014 |
`result`.
|
| 7015 |
|
| 7016 |
*Preconditions:*
|
| 7017 |
|
| 7018 |
+
- The ranges \[`first`, `last`) and \[`result`, `result + `N) do not
|
| 7019 |
+
overlap.
|
| 7020 |
- For the overloads in namespace `std`:
|
| 7021 |
- The comparison function is an equivalence relation.
|
| 7022 |
- For the overloads with no `ExecutionPolicy`, let `T` be the value
|
| 7023 |
type of `InputIterator`. If `InputIterator` models
|
| 7024 |
`forward_iterator` [[iterator.concept.forward]], then there are no
|
| 7025 |
additional requirements for `T`. Otherwise, if `OutputIterator`
|
| 7026 |
meets the *Cpp17ForwardIterator* requirements and its value type is
|
| 7027 |
the same as `T`, then `T` meets the *Cpp17CopyAssignable*
|
| 7028 |
([[cpp17.copyassignable]]) requirements. Otherwise, `T` meets both
|
| 7029 |
the *Cpp17CopyConstructible* ([[cpp17.copyconstructible]]) and
|
| 7030 |
+
*Cpp17CopyAssignable* requirements.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7031 |
|
| 7032 |
+
[*Note 1*: For the parallel algorithm overloads in namespace `std`,
|
| 7033 |
+
there can be a performance cost if the value type of `ForwardIterator1`
|
| 7034 |
+
does not meet both the *Cpp17CopyConstructible* and
|
| 7035 |
+
*Cpp17CopyAssignable* requirements. For the parallel algorithm overloads
|
| 7036 |
+
in namespace `ranges`, there can be a performance cost if
|
| 7037 |
+
`iter_value_t<I>` does not model `copyable`. — *end note*]
|
| 7038 |
+
|
| 7039 |
+
*Effects:* Copies only the first element from N consecutive groups of
|
| 7040 |
+
equivalent elements referred to by the iterator `i` in the range
|
| 7041 |
+
\[`first + 1`, `last`) for which E(`i`) holds into the range \[`result`,
|
| 7042 |
+
`result + `N).
|
| 7043 |
|
| 7044 |
*Returns:*
|
| 7045 |
|
| 7046 |
- `result + `N for the overloads in namespace `std`.
|
| 7047 |
+
- `{last, result + `N`}` for the overloads in namespace `ranges`, if N
|
| 7048 |
+
is equal to M + 1.
|
| 7049 |
+
- Otherwise, `{j, result_last}` for the overloads in namespace `ranges`,
|
| 7050 |
+
where `j` is the iterator in \[`first + 1`, `last`) for which E(`j`)
|
| 7051 |
+
is `false` and there are exactly N - 1 iterators `i` in \[`first + 1`,
|
| 7052 |
+
`j`) for which E(`i`) is `false`.
|
| 7053 |
|
| 7054 |
+
*Complexity:* At most `last - first - 1` applications of the
|
| 7055 |
corresponding predicate and no more than twice as many applications of
|
| 7056 |
any projection.
|
| 7057 |
|
| 7058 |
### Reverse <a id="alg.reverse">[[alg.reverse]]</a>
|
| 7059 |
|
|
|
|
| 7068 |
requires permutable<I>
|
| 7069 |
constexpr I ranges::reverse(I first, S last);
|
| 7070 |
template<bidirectional_range R>
|
| 7071 |
requires permutable<iterator_t<R>>
|
| 7072 |
constexpr borrowed_iterator_t<R> ranges::reverse(R&& r);
|
| 7073 |
+
|
| 7074 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 7075 |
+
requires permutable<I>
|
| 7076 |
+
I ranges::reverse(Ep&& exec, I first, S last);
|
| 7077 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 7078 |
+
requires permutable<iterator_t<R>>
|
| 7079 |
+
borrowed_iterator_t<R> ranges::reverse(Ep&& exec, R&& r);
|
| 7080 |
```
|
| 7081 |
|
| 7082 |
*Preconditions:* For the overloads in namespace `std`,
|
| 7083 |
`BidirectionalIterator` meets the *Cpp17ValueSwappable*
|
| 7084 |
requirements [[swappable.requirements]].
|
|
|
|
| 7128 |
- `result + `N for the overloads in namespace `std`.
|
| 7129 |
- `{last, result + `N`}` for the overloads in namespace `ranges`.
|
| 7130 |
|
| 7131 |
*Complexity:* Exactly N assignments.
|
| 7132 |
|
| 7133 |
+
``` cpp
|
| 7134 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7135 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 7136 |
+
requires indirectly_copyable<I, O>
|
| 7137 |
+
ranges::reverse_copy_truncated_result<I, O>
|
| 7138 |
+
ranges::reverse_copy(Ep&& exec, I first, S last, O result,
|
| 7139 |
+
OutS result_last);
|
| 7140 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 7141 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 7142 |
+
ranges::reverse_copy_truncated_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 7143 |
+
ranges::reverse_copy(Ep&& exec, R&& r, OutR&& result_r);
|
| 7144 |
+
```
|
| 7145 |
+
|
| 7146 |
+
Let N be min(`last - first`, `result_last - result`), and let
|
| 7147 |
+
*NEW_FIRST* be `first + (last - first) - `N.
|
| 7148 |
+
|
| 7149 |
+
*Preconditions:* The ranges \[`first`, `last`) and \[`result`,
|
| 7150 |
+
`result + `N) do not overlap.
|
| 7151 |
+
|
| 7152 |
+
*Effects:* Copies the range \[*`NEW_FIRST`*, `last`) to the range
|
| 7153 |
+
\[`result`, `result + `N) such that for every non-negative integer i < N
|
| 7154 |
+
the following assignment takes place:
|
| 7155 |
+
`*(result + `N` - 1 - `i`) = *(`*`NEW_FIRST`*` + `i`)`.
|
| 7156 |
+
|
| 7157 |
+
*Returns:* `{last, `*`NEW_FIRST`*`, result + `N`}`.
|
| 7158 |
+
|
| 7159 |
+
*Complexity:* Exactly N assignments.
|
| 7160 |
+
|
| 7161 |
### Rotate <a id="alg.rotate">[[alg.rotate]]</a>
|
| 7162 |
|
| 7163 |
``` cpp
|
| 7164 |
template<class ForwardIterator>
|
| 7165 |
constexpr ForwardIterator
|
|
|
|
| 7169 |
rotate(ExecutionPolicy&& exec,
|
| 7170 |
ForwardIterator first, ForwardIterator middle, ForwardIterator last);
|
| 7171 |
|
| 7172 |
template<permutable I, sentinel_for<I> S>
|
| 7173 |
constexpr subrange<I> ranges::rotate(I first, I middle, S last);
|
| 7174 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 7175 |
+
requires permutable<I>
|
| 7176 |
+
subrange<I> ranges::rotate(Ep&& exec, I first, I middle, S last);
|
| 7177 |
```
|
| 7178 |
|
| 7179 |
*Preconditions:* \[`first`, `middle`) and \[`middle`, `last`) are valid
|
| 7180 |
ranges. For the overloads in namespace `std`, `ForwardIterator` meets
|
| 7181 |
the *Cpp17ValueSwappable* requirements [[swappable.requirements]], and
|
|
|
|
| 7204 |
```
|
| 7205 |
|
| 7206 |
*Effects:* Equivalent to:
|
| 7207 |
`return ranges::rotate(ranges::begin(r), middle, ranges::end(r));`
|
| 7208 |
|
| 7209 |
+
``` cpp
|
| 7210 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 7211 |
+
requires permutable<iterator_t<R>>
|
| 7212 |
+
borrowed_subrange_t<R> ranges::rotate(Ep&& exec, R&& r, iterator_t<R> middle);
|
| 7213 |
+
```
|
| 7214 |
+
|
| 7215 |
+
*Effects:* Equivalent to:
|
| 7216 |
+
|
| 7217 |
+
``` cpp
|
| 7218 |
+
return ranges::rotate(std::forward<Ep>(exec), ranges::begin(r), middle, ranges::end(r));
|
| 7219 |
+
```
|
| 7220 |
+
|
| 7221 |
``` cpp
|
| 7222 |
template<class ForwardIterator, class OutputIterator>
|
| 7223 |
constexpr OutputIterator
|
| 7224 |
rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last,
|
| 7225 |
OutputIterator result);
|
|
|
|
| 7251 |
- `result + `N for the overloads in namespace `std`.
|
| 7252 |
- `{last, result + `N`}` for the overload in namespace `ranges`.
|
| 7253 |
|
| 7254 |
*Complexity:* Exactly N assignments.
|
| 7255 |
|
| 7256 |
+
``` cpp
|
| 7257 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7258 |
+
random_access_iterator O, sized_sentinel_for<O> OutS>
|
| 7259 |
+
requires indirectly_copyable<I, O>
|
| 7260 |
+
ranges::rotate_copy_truncated_result<I, O>
|
| 7261 |
+
ranges::rotate_copy(Ep&& exec, I first, I middle, S last, O result, OutS result_last);
|
| 7262 |
+
```
|
| 7263 |
+
|
| 7264 |
+
Let M be `last - first` and N be min(M, `result_last - result`).
|
| 7265 |
+
|
| 7266 |
+
*Preconditions:* \[`first`, `middle`) and \[`middle`, `last`) are valid
|
| 7267 |
+
ranges. The ranges \[`first`, `last`) and \[`result`, `result + `N) do
|
| 7268 |
+
not overlap.
|
| 7269 |
+
|
| 7270 |
+
*Effects:* Copies the range \[`first`, `last`) to the range \[`result`,
|
| 7271 |
+
`result + `N) such that for each non-negative integer i < N the
|
| 7272 |
+
following assignment takes place:
|
| 7273 |
+
`*(result + `i`) = *(first + (`i` + (middle - first)) % `M`)`.
|
| 7274 |
+
|
| 7275 |
+
*Returns:*
|
| 7276 |
+
|
| 7277 |
+
- `{middle + `N`, first, result + `N`}` if N is less than
|
| 7278 |
+
`last - middle`.
|
| 7279 |
+
- Otherwise,
|
| 7280 |
+
`{last, first + (`N` + (middle - first)) % `M`, result + `N`}`.
|
| 7281 |
+
|
| 7282 |
+
*Complexity:* Exactly N assignments.
|
| 7283 |
+
|
| 7284 |
``` cpp
|
| 7285 |
template<forward_range R, weakly_incrementable O>
|
| 7286 |
requires indirectly_copyable<iterator_t<R>, O>
|
| 7287 |
constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
|
| 7288 |
ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);
|
|
|
|
| 7292 |
|
| 7293 |
``` cpp
|
| 7294 |
return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), std::move(result));
|
| 7295 |
```
|
| 7296 |
|
| 7297 |
+
``` cpp
|
| 7298 |
+
template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR>
|
| 7299 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR>>
|
| 7300 |
+
ranges::rotate_copy_truncated_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
|
| 7301 |
+
ranges::rotate_copy(Ep&& exec, R&& r, iterator_t<R> middle, OutR&& result_r);
|
| 7302 |
+
```
|
| 7303 |
+
|
| 7304 |
+
*Effects:* Equivalent to:
|
| 7305 |
+
|
| 7306 |
+
``` cpp
|
| 7307 |
+
return ranges::rotate_copy(std::forward<Ep>(exec), ranges::begin(r), middle, ranges::end(r),
|
| 7308 |
+
ranges::begin(result_r), ranges::end(result_r));
|
| 7309 |
+
```
|
| 7310 |
+
|
| 7311 |
### Sample <a id="alg.random.sample">[[alg.random.sample]]</a>
|
| 7312 |
|
| 7313 |
``` cpp
|
| 7314 |
template<class PopulationIterator, class SampleIterator,
|
| 7315 |
class Distance, class UniformRandomBitGenerator>
|
|
|
|
| 7418 |
|
| 7419 |
template<permutable I, sentinel_for<I> S>
|
| 7420 |
constexpr subrange<I> ranges::shift_left(I first, S last, iter_difference_t<I> n);
|
| 7421 |
template<forward_range R>
|
| 7422 |
requires permutable<iterator_t<R>>
|
| 7423 |
+
constexpr borrowed_subrange_t<R> ranges::shift_left(R&& r, range_difference_t<R> n);
|
| 7424 |
+
|
| 7425 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 7426 |
+
requires permutable<I>
|
| 7427 |
+
subrange<I>
|
| 7428 |
+
ranges::shift_left(Ep&& exec, I first, S last, iter_difference_t<I> n);
|
| 7429 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 7430 |
+
requires permutable<iterator_t<R>>
|
| 7431 |
+
borrowed_subrange_t<R>
|
| 7432 |
+
ranges::shift_left(Ep&& exec, R&& r, range_difference_t<R> n);
|
| 7433 |
```
|
| 7434 |
|
| 7435 |
*Preconditions:* `n >= 0` is `true`. For the overloads in namespace
|
| 7436 |
`std`, the type of `*first` meets the *Cpp17MoveAssignable*
|
| 7437 |
requirements.
|
| 7438 |
|
| 7439 |
*Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
|
| 7440 |
moves the element from position `first + n + i` into position
|
| 7441 |
`first + i` for each non-negative integer `i < (last - first) - n`. For
|
| 7442 |
+
the non-parallel algorithm overloads, does so in order starting from
|
| 7443 |
+
`i = 0` and proceeding to `i = (last - first) - n - 1`.
|
|
|
|
| 7444 |
|
| 7445 |
*Returns:* Let *NEW_LAST* be `first + (last - first - n)` if
|
| 7446 |
+
`n < last - first`, otherwise `first`. Returns:
|
| 7447 |
|
| 7448 |
- *NEW_LAST* for the overloads in namespace `std`.
|
| 7449 |
- `{first, `*`NEW_LAST`*`}` for the overloads in namespace `ranges`.
|
| 7450 |
|
| 7451 |
*Complexity:* At most `(last - first) - n` assignments.
|
|
|
|
| 7463 |
template<permutable I, sentinel_for<I> S>
|
| 7464 |
constexpr subrange<I> ranges::shift_right(I first, S last, iter_difference_t<I> n);
|
| 7465 |
template<forward_range R>
|
| 7466 |
requires permutable<iterator_t<R>>
|
| 7467 |
constexpr borrowed_subrange_t<R> ranges::shift_right(R&& r, range_difference_t<R> n);
|
| 7468 |
+
|
| 7469 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S>
|
| 7470 |
+
requires permutable<I>
|
| 7471 |
+
subrange<I>
|
| 7472 |
+
ranges::shift_right(Ep&& exec, I first, S last, iter_difference_t<I> n);
|
| 7473 |
+
template<execution-policy Ep, sized-random-access-range R>
|
| 7474 |
+
requires permutable<iterator_t<R>>
|
| 7475 |
+
borrowed_subrange_t<R>
|
| 7476 |
+
ranges::shift_right(Ep&& exec, R&& r, range_difference_t<R> n);
|
| 7477 |
```
|
| 7478 |
|
| 7479 |
*Preconditions:* `n >= 0` is `true`. For the overloads in namespace
|
| 7480 |
`std`, the type of `*first` meets the *Cpp17MoveAssignable*
|
| 7481 |
requirements, and `ForwardIterator` meets the
|
|
|
|
| 7484 |
|
| 7485 |
*Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
|
| 7486 |
moves the element from position `first + i` into position
|
| 7487 |
`first + n + i` for each non-negative integer `i < (last - first) - n`.
|
| 7488 |
Does so in order starting from `i = (last - first) - n - 1` and
|
| 7489 |
+
proceeding to `i = 0` if
|
| 7490 |
|
| 7491 |
+
- for the non-parallel algorithm overload in namespace `std`,
|
| 7492 |
+
`ForwardIterator` meets the *Cpp17BidirectionalIterator* requirements,
|
| 7493 |
+
- for the non-parallel algorithm overloads in namespace `ranges`, `I`
|
| 7494 |
+
models `bidirectional_iterator`.
|
|
|
|
| 7495 |
|
| 7496 |
*Returns:* Let *NEW_FIRST* be `first + n` if `n < last - first`,
|
| 7497 |
+
otherwise `last`. Returns:
|
| 7498 |
|
| 7499 |
- *NEW_FIRST* for the overloads in namespace `std`.
|
| 7500 |
- `{`*`NEW_FIRST`*`, last}` for the overloads in namespace `ranges`.
|
| 7501 |
|
| 7502 |
*Complexity:* At most `(last - first) - n` assignments or swaps.
|
|
|
|
| 7597 |
ranges::sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7598 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 7599 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 7600 |
constexpr borrowed_iterator_t<R>
|
| 7601 |
ranges::sort(R&& r, Comp comp = {}, Proj proj = {});
|
| 7602 |
+
|
| 7603 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7604 |
+
class Comp = ranges::less, class Proj = identity>
|
| 7605 |
+
requires sortable<I, Comp, Proj>
|
| 7606 |
+
I ranges::sort(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 7607 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 7608 |
+
class Proj = identity>
|
| 7609 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 7610 |
+
borrowed_iterator_t<R> ranges::sort(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 7611 |
```
|
| 7612 |
|
| 7613 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7614 |
no parameters by those names.
|
| 7615 |
|
|
|
|
| 7629 |
|
| 7630 |
#### `stable_sort` <a id="stable.sort">[[stable.sort]]</a>
|
| 7631 |
|
| 7632 |
``` cpp
|
| 7633 |
template<class RandomAccessIterator>
|
| 7634 |
+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last);
|
| 7635 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 7636 |
void stable_sort(ExecutionPolicy&& exec,
|
| 7637 |
RandomAccessIterator first, RandomAccessIterator last);
|
| 7638 |
|
| 7639 |
template<class RandomAccessIterator, class Compare>
|
| 7640 |
+
constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last,
|
| 7641 |
Compare comp);
|
| 7642 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 7643 |
void stable_sort(ExecutionPolicy&& exec,
|
| 7644 |
RandomAccessIterator first, RandomAccessIterator last,
|
| 7645 |
Compare comp);
|
| 7646 |
|
| 7647 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 7648 |
class Proj = identity>
|
| 7649 |
requires sortable<I, Comp, Proj>
|
| 7650 |
+
constexpr I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7651 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 7652 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 7653 |
+
constexpr borrowed_iterator_t<R>
|
| 7654 |
ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});
|
| 7655 |
+
|
| 7656 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7657 |
+
class Comp = ranges::less, class Proj = identity>
|
| 7658 |
+
requires sortable<I, Comp, Proj>
|
| 7659 |
+
I ranges::stable_sort(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 7660 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 7661 |
+
class Proj = identity>
|
| 7662 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 7663 |
+
borrowed_iterator_t<R>
|
| 7664 |
+
ranges::stable_sort(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 7665 |
```
|
| 7666 |
|
| 7667 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7668 |
no parameters by those names.
|
| 7669 |
|
|
|
|
| 7713 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 7714 |
class Proj = identity>
|
| 7715 |
requires sortable<I, Comp, Proj>
|
| 7716 |
constexpr I
|
| 7717 |
ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
| 7718 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7719 |
+
class Comp = ranges::less, class Proj = identity>
|
| 7720 |
+
requires sortable<I, Comp, Proj>
|
| 7721 |
+
I ranges::partial_sort(Ep&& exec, I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
| 7722 |
```
|
| 7723 |
|
| 7724 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7725 |
no parameters by those names.
|
| 7726 |
|
|
|
|
| 7752 |
|
| 7753 |
``` cpp
|
| 7754 |
return ranges::partial_sort(ranges::begin(r), middle, ranges::end(r), comp, proj);
|
| 7755 |
```
|
| 7756 |
|
| 7757 |
+
``` cpp
|
| 7758 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 7759 |
+
class Comp = ranges::less, class Proj = identity>
|
| 7760 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 7761 |
+
borrowed_iterator_t<R>
|
| 7762 |
+
ranges::partial_sort(Ep&& exec, R&& r, iterator_t<R> middle, Comp comp = {},
|
| 7763 |
+
Proj proj = {});
|
| 7764 |
+
```
|
| 7765 |
+
|
| 7766 |
+
*Effects:* Equivalent to:
|
| 7767 |
+
|
| 7768 |
+
``` cpp
|
| 7769 |
+
return ranges::partial_sort(std::forward<Ep>(exec), ranges::begin(r), middle,
|
| 7770 |
+
ranges::end(r), comp, proj);
|
| 7771 |
+
```
|
| 7772 |
+
|
| 7773 |
#### `partial_sort_copy` <a id="partial.sort.copy">[[partial.sort.copy]]</a>
|
| 7774 |
|
| 7775 |
``` cpp
|
| 7776 |
template<class InputIterator, class RandomAccessIterator>
|
| 7777 |
constexpr RandomAccessIterator
|
|
|
|
| 7815 |
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 7816 |
projected<iterator_t<R2>, Proj2>>
|
| 7817 |
constexpr ranges::partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 7818 |
ranges::partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
|
| 7819 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 7820 |
+
|
| 7821 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 7822 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 7823 |
+
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 7824 |
+
requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
|
| 7825 |
+
indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
|
| 7826 |
+
ranges::partial_sort_copy_result<I1, I2>
|
| 7827 |
+
ranges::partial_sort_copy(Ep&& exec, I1 first, S1 last, I2 result_first, S2 result_last,
|
| 7828 |
+
Comp comp = {}, Proj1 proj1 = {},
|
| 7829 |
+
Proj2 proj2 = {});
|
| 7830 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 7831 |
+
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 7832 |
+
requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
|
| 7833 |
+
sortable<iterator_t<R2>, Comp, Proj2> &&
|
| 7834 |
+
indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
|
| 7835 |
+
projected<iterator_t<R2>, Proj2>>
|
| 7836 |
+
ranges::partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
|
| 7837 |
+
ranges::partial_sort_copy(Ep&& exec, R1&& r, R2&& result_r, Comp comp = {},
|
| 7838 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 7839 |
```
|
| 7840 |
|
| 7841 |
Let N be min(`last - first`, `result_last - result_first`). Let `comp`
|
| 7842 |
be `less{}`, and `proj1` and `proj2` be `identity{}` for the overloads
|
| 7843 |
with no parameters by those names.
|
|
|
|
| 7934 |
```
|
| 7935 |
|
| 7936 |
*Effects:* Equivalent to:
|
| 7937 |
`return ranges::is_sorted_until(first, last, comp, proj) == last;`
|
| 7938 |
|
| 7939 |
+
``` cpp
|
| 7940 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7941 |
+
class Proj = identity,
|
| 7942 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 7943 |
+
bool ranges::is_sorted(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 7944 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 7945 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7946 |
+
bool ranges::is_sorted(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 7947 |
+
```
|
| 7948 |
+
|
| 7949 |
+
*Effects:* Equivalent to:
|
| 7950 |
+
|
| 7951 |
+
``` cpp
|
| 7952 |
+
return ranges::is_sorted_until(std::forward<Ep>(exec), first, last, comp, proj) == last;
|
| 7953 |
+
```
|
| 7954 |
+
|
| 7955 |
``` cpp
|
| 7956 |
template<class ForwardIterator>
|
| 7957 |
constexpr ForwardIterator
|
| 7958 |
is_sorted_until(ForwardIterator first, ForwardIterator last);
|
| 7959 |
template<class ExecutionPolicy, class ForwardIterator>
|
|
|
|
| 7976 |
constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 7977 |
template<forward_range R, class Proj = identity,
|
| 7978 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7979 |
constexpr borrowed_iterator_t<R>
|
| 7980 |
ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {});
|
| 7981 |
+
|
| 7982 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 7983 |
+
class Proj = identity,
|
| 7984 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 7985 |
+
I ranges::is_sorted_until(Ep&& exec, I first, S last, Comp comp = {},
|
| 7986 |
+
Proj proj = {});
|
| 7987 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 7988 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 7989 |
+
borrowed_iterator_t<R>
|
| 7990 |
+
ranges::is_sorted_until(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 7991 |
```
|
| 7992 |
|
| 7993 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 7994 |
no parameters by those names.
|
| 7995 |
|
|
|
|
| 8020 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 8021 |
class Proj = identity>
|
| 8022 |
requires sortable<I, Comp, Proj>
|
| 8023 |
constexpr I
|
| 8024 |
ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 8025 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8026 |
+
class Comp = ranges::less, class Proj = identity>
|
| 8027 |
+
requires sortable<I, Comp, Proj>
|
| 8028 |
+
I ranges::nth_element(Ep&& exec, I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 8029 |
```
|
| 8030 |
|
| 8031 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 8032 |
no parameters by those names.
|
| 8033 |
|
|
|
|
| 8045 |
iterator `j` in the range \[`nth`, `last`) it holds that:
|
| 8046 |
`bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))` is `false`.
|
| 8047 |
|
| 8048 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 8049 |
|
| 8050 |
+
*Complexity:* For the non-parallel algorithm overloads, linear on
|
| 8051 |
+
average. For the parallel algorithm overloads, 𝑂(N) applications of the
|
| 8052 |
+
predicate, and 𝑂(N log N) swaps, where N = `last - first`.
|
| 8053 |
|
| 8054 |
``` cpp
|
| 8055 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 8056 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 8057 |
constexpr borrowed_iterator_t<R>
|
|
|
|
| 8062 |
|
| 8063 |
``` cpp
|
| 8064 |
return ranges::nth_element(ranges::begin(r), nth, ranges::end(r), comp, proj);
|
| 8065 |
```
|
| 8066 |
|
| 8067 |
+
``` cpp
|
| 8068 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 8069 |
+
class Proj = identity>
|
| 8070 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 8071 |
+
borrowed_iterator_t<R>
|
| 8072 |
+
ranges::nth_element(Ep&& exec, R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});
|
| 8073 |
+
```
|
| 8074 |
+
|
| 8075 |
+
*Effects:* Equivalent to:
|
| 8076 |
+
|
| 8077 |
+
``` cpp
|
| 8078 |
+
return ranges::nth_element(std::forward<Ep>(exec), ranges::begin(r), nth, ranges::end(r),
|
| 8079 |
+
comp, proj);
|
| 8080 |
+
```
|
| 8081 |
+
|
| 8082 |
### Binary search <a id="alg.binary.search">[[alg.binary.search]]</a>
|
| 8083 |
|
| 8084 |
#### General <a id="alg.binary.search.general">[[alg.binary.search.general]]</a>
|
| 8085 |
|
| 8086 |
All of the algorithms in [[alg.binary.search]] are versions of binary
|
|
|
|
| 8094 |
a linear number of steps.
|
| 8095 |
|
| 8096 |
#### `lower_bound` <a id="lower.bound">[[lower.bound]]</a>
|
| 8097 |
|
| 8098 |
``` cpp
|
| 8099 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 8100 |
constexpr ForwardIterator
|
| 8101 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 8102 |
const T& value);
|
| 8103 |
|
| 8104 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 8105 |
+
class Compare>
|
| 8106 |
constexpr ForwardIterator
|
| 8107 |
lower_bound(ForwardIterator first, ForwardIterator last,
|
| 8108 |
const T& value, Compare comp);
|
| 8109 |
|
| 8110 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 8111 |
+
class T = projected_value_t<I, Proj>,
|
| 8112 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 8113 |
constexpr I ranges::lower_bound(I first, S last, const T& value, Comp comp = {},
|
| 8114 |
Proj proj = {});
|
| 8115 |
+
template<forward_range R, class Proj = identity,
|
| 8116 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 8117 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 8118 |
ranges::less>
|
| 8119 |
constexpr borrowed_iterator_t<R>
|
| 8120 |
ranges::lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 8121 |
```
|
|
|
|
| 8135 |
projections.
|
| 8136 |
|
| 8137 |
#### `upper_bound` <a id="upper.bound">[[upper.bound]]</a>
|
| 8138 |
|
| 8139 |
``` cpp
|
| 8140 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 8141 |
constexpr ForwardIterator
|
| 8142 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 8143 |
const T& value);
|
| 8144 |
|
| 8145 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 8146 |
+
class Compare>
|
| 8147 |
constexpr ForwardIterator
|
| 8148 |
upper_bound(ForwardIterator first, ForwardIterator last,
|
| 8149 |
const T& value, Compare comp);
|
| 8150 |
|
| 8151 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 8152 |
+
class T = projected_value_t<I, Proj>,
|
| 8153 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 8154 |
constexpr I ranges::upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 8155 |
+
template<forward_range R, class Proj = identity,
|
| 8156 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 8157 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 8158 |
ranges::less>
|
| 8159 |
constexpr borrowed_iterator_t<R>
|
| 8160 |
ranges::upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 8161 |
```
|
|
|
|
| 8175 |
projections.
|
| 8176 |
|
| 8177 |
#### `equal_range` <a id="equal.range">[[equal.range]]</a>
|
| 8178 |
|
| 8179 |
``` cpp
|
| 8180 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 8181 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 8182 |
equal_range(ForwardIterator first,
|
| 8183 |
ForwardIterator last, const T& value);
|
| 8184 |
|
| 8185 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 8186 |
+
class Compare>
|
| 8187 |
constexpr pair<ForwardIterator, ForwardIterator>
|
| 8188 |
equal_range(ForwardIterator first,
|
| 8189 |
ForwardIterator last, const T& value,
|
| 8190 |
Compare comp);
|
| 8191 |
|
| 8192 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 8193 |
+
class T = projected_value_t<I, Proj>,
|
| 8194 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 8195 |
constexpr subrange<I>
|
| 8196 |
ranges::equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
|
| 8197 |
+
template<forward_range R, class Proj = identity,
|
| 8198 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 8199 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 8200 |
ranges::less>
|
| 8201 |
constexpr borrowed_subrange_t<R>
|
| 8202 |
ranges::equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {});
|
| 8203 |
```
|
|
|
|
| 8207 |
|
| 8208 |
*Preconditions:* The elements `e` of \[`first`, `last`) are partitioned
|
| 8209 |
with respect to the expressions
|
| 8210 |
`bool(invoke(comp, invoke(proj, e), value))` and
|
| 8211 |
`!bool(invoke(comp, value, invoke(proj, e)))`. Also, for all elements
|
| 8212 |
+
`e` of \[`first`, `last`), `bool(comp(e, value))` implies
|
| 8213 |
`!bool(comp(value, e))` for the overloads in namespace `std`.
|
| 8214 |
|
| 8215 |
*Returns:*
|
| 8216 |
|
| 8217 |
- For the overloads in namespace `std`:
|
|
|
|
| 8229 |
projections.
|
| 8230 |
|
| 8231 |
#### `binary_search` <a id="binary.search">[[binary.search]]</a>
|
| 8232 |
|
| 8233 |
``` cpp
|
| 8234 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type>
|
| 8235 |
constexpr bool
|
| 8236 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 8237 |
const T& value);
|
| 8238 |
|
| 8239 |
+
template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type,
|
| 8240 |
+
class Compare>
|
| 8241 |
constexpr bool
|
| 8242 |
binary_search(ForwardIterator first, ForwardIterator last,
|
| 8243 |
const T& value, Compare comp);
|
| 8244 |
|
| 8245 |
+
template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 8246 |
+
class T = projected_value_t<I, Proj>,
|
| 8247 |
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
|
| 8248 |
constexpr bool ranges::binary_search(I first, S last, const T& value, Comp comp = {},
|
| 8249 |
Proj proj = {});
|
| 8250 |
+
template<forward_range R, class Proj = identity,
|
| 8251 |
+
class T = projected_value_t<iterator_t<R>, Proj>,
|
| 8252 |
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
|
| 8253 |
ranges::less>
|
| 8254 |
constexpr bool ranges::binary_search(R&& r, const T& value, Comp comp = {},
|
| 8255 |
Proj proj = {});
|
| 8256 |
```
|
|
|
|
| 8260 |
|
| 8261 |
*Preconditions:* The elements `e` of \[`first`, `last`) are partitioned
|
| 8262 |
with respect to the expressions
|
| 8263 |
`bool(invoke(comp, invoke(proj, e), value))` and
|
| 8264 |
`!bool(invoke(comp, value, invoke(proj, e)))`. Also, for all elements
|
| 8265 |
+
`e` of \[`first`, `last`), `bool(comp(e, value))` implies
|
| 8266 |
`!bool(comp(value, e))` for the overloads in namespace `std`.
|
| 8267 |
|
| 8268 |
*Returns:* `true` if and only if for some iterator `i` in the range
|
| 8269 |
\[`first`, `last`),
|
| 8270 |
`!bool(invoke(comp, invoke(proj, *i), value)) && !bool(invoke(comp, value, invoke(proj, *i)))`
|
|
|
|
| 8286 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8287 |
constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {});
|
| 8288 |
template<input_range R, class Proj = identity,
|
| 8289 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8290 |
constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {});
|
| 8291 |
+
|
| 8292 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8293 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8294 |
+
bool ranges::is_partitioned(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 8295 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 8296 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8297 |
+
bool ranges::is_partitioned(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 8298 |
```
|
| 8299 |
|
| 8300 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 8301 |
`proj`.
|
| 8302 |
|
|
|
|
| 8311 |
template<class ForwardIterator, class Predicate>
|
| 8312 |
constexpr ForwardIterator
|
| 8313 |
partition(ForwardIterator first, ForwardIterator last, Predicate pred);
|
| 8314 |
template<class ExecutionPolicy, class ForwardIterator, class Predicate>
|
| 8315 |
ForwardIterator
|
| 8316 |
+
partition(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, Predicate pred);
|
|
|
|
| 8317 |
|
| 8318 |
template<permutable I, sentinel_for<I> S, class Proj = identity,
|
| 8319 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8320 |
constexpr subrange<I>
|
| 8321 |
ranges::partition(I first, S last, Pred pred, Proj proj = {});
|
| 8322 |
template<forward_range R, class Proj = identity,
|
| 8323 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8324 |
requires permutable<iterator_t<R>>
|
| 8325 |
constexpr borrowed_subrange_t<R>
|
| 8326 |
ranges::partition(R&& r, Pred pred, Proj proj = {});
|
| 8327 |
+
|
| 8328 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8329 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8330 |
+
subrange<I> ranges::partition(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 8331 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 8332 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8333 |
+
requires permutable<iterator_t<R>>
|
| 8334 |
+
borrowed_subrange_t<R> ranges::partition(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 8335 |
```
|
| 8336 |
|
| 8337 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 8338 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 8339 |
|
|
|
|
| 8350 |
- `i` for the overloads in namespace `std`.
|
| 8351 |
- `{i, last}` for the overloads in namespace `ranges`.
|
| 8352 |
|
| 8353 |
*Complexity:* Let N = `last - first`:
|
| 8354 |
|
| 8355 |
+
- For the non-parallel algorithm overloads, exactly N applications of
|
| 8356 |
the predicate and projection. At most N / 2 swaps if the type of
|
| 8357 |
`first` meets the *Cpp17BidirectionalIterator* requirements for the
|
| 8358 |
overloads in namespace `std` or models `bidirectional_iterator` for
|
| 8359 |
the overloads in namespace `ranges`, and at most N swaps otherwise.
|
| 8360 |
+
- For the parallel algorithm overloads, 𝑂(N log N) swaps and 𝑂(N)
|
| 8361 |
applications of the predicate.
|
| 8362 |
|
| 8363 |
``` cpp
|
| 8364 |
template<class BidirectionalIterator, class Predicate>
|
| 8365 |
BidirectionalIterator
|
| 8366 |
+
constexpr stable_partition(BidirectionalIterator first, BidirectionalIterator last,
|
| 8367 |
+
Predicate pred);
|
| 8368 |
template<class ExecutionPolicy, class BidirectionalIterator, class Predicate>
|
| 8369 |
BidirectionalIterator
|
| 8370 |
stable_partition(ExecutionPolicy&& exec,
|
| 8371 |
BidirectionalIterator first, BidirectionalIterator last, Predicate pred);
|
| 8372 |
|
| 8373 |
template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
|
| 8374 |
indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8375 |
requires permutable<I>
|
| 8376 |
+
constexpr subrange<I> ranges::stable_partition(I first, S last, Pred pred, Proj proj = {});
|
| 8377 |
template<bidirectional_range R, class Proj = identity,
|
| 8378 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8379 |
requires permutable<iterator_t<R>>
|
| 8380 |
+
constexpr borrowed_subrange_t<R> ranges::stable_partition(R&& r, Pred pred, Proj proj = {});
|
| 8381 |
+
|
| 8382 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8383 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8384 |
+
requires permutable<I>
|
| 8385 |
+
subrange<I>
|
| 8386 |
+
ranges::stable_partition(Ep&& exec, I first, S last, Pred pred, Proj proj = {});
|
| 8387 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 8388 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8389 |
+
requires permutable<iterator_t<R>>
|
| 8390 |
+
borrowed_subrange_t<R>
|
| 8391 |
+
ranges::stable_partition(Ep&& exec, R&& r, Pred pred, Proj proj = {});
|
| 8392 |
```
|
| 8393 |
|
| 8394 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 8395 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 8396 |
|
|
|
|
| 8411 |
- `i` for the overloads in namespace `std`.
|
| 8412 |
- `{i, last}` for the overloads in namespace `ranges`.
|
| 8413 |
|
| 8414 |
*Complexity:* Let N = `last - first`:
|
| 8415 |
|
| 8416 |
+
- For the non-parallel algorithm overloads, at most N log₂ N swaps, but
|
| 8417 |
+
only 𝑂(N) swaps if there is enough extra memory. Exactly N
|
| 8418 |
applications of the predicate and projection.
|
| 8419 |
+
- For the parallel algorithm overloads, 𝑂(N log N) swaps and 𝑂(N)
|
| 8420 |
applications of the predicate.
|
| 8421 |
|
| 8422 |
``` cpp
|
| 8423 |
template<class InputIterator, class OutputIterator1, class OutputIterator2, class Predicate>
|
| 8424 |
constexpr pair<OutputIterator1, OutputIterator2>
|
|
|
|
| 8442 |
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8443 |
requires indirectly_copyable<iterator_t<R>, O1> &&
|
| 8444 |
indirectly_copyable<iterator_t<R>, O2>
|
| 8445 |
constexpr ranges::partition_copy_result<borrowed_iterator_t<R>, O1, O2>
|
| 8446 |
ranges::partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {});
|
| 8447 |
+
|
| 8448 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8449 |
+
random_access_iterator O1, sized_sentinel_for<O1> OutS1,
|
| 8450 |
+
random_access_iterator O2, sized_sentinel_for<O2> OutS2,
|
| 8451 |
+
class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
|
| 8452 |
+
requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
|
| 8453 |
+
ranges::partition_copy_result<I, O1, O2>
|
| 8454 |
+
ranges::partition_copy(Ep&& exec, I first, S last, O1 out_true, OutS1 last_true,
|
| 8455 |
+
O2 out_false, OutS2 last_false, Pred pred, Proj proj = {});
|
| 8456 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 8457 |
+
sized-random-access-range OutR1, sized-random-access-range OutR2,
|
| 8458 |
+
class Proj = identity,
|
| 8459 |
+
indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
|
| 8460 |
+
requires indirectly_copyable<iterator_t<R>, iterator_t<OutR1>> &&
|
| 8461 |
+
indirectly_copyable<iterator_t<R>, iterator_t<OutR2>>
|
| 8462 |
+
ranges::partition_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR1>,
|
| 8463 |
+
borrowed_iterator_t<OutR2>>
|
| 8464 |
+
ranges::partition_copy(Ep&& exec, R&& r, OutR1&& out_true_r, OutR2&& out_false_r,
|
| 8465 |
+
Pred pred, Proj proj = {});
|
| 8466 |
```
|
| 8467 |
|
| 8468 |
Let `proj` be `identity{}` for the overloads with no parameter named
|
| 8469 |
`proj` and let E(x) be `bool(invoke(pred, invoke(proj, `x`)))`.
|
| 8470 |
|
| 8471 |
+
For the overloads with no parameters `last_true`, `last_false`,
|
| 8472 |
+
`out_true_r`, or `out_false_r`, let
|
| 8473 |
+
|
| 8474 |
+
- M be the number of iterators `i` in \[`first`, `last`) for which
|
| 8475 |
+
E(`*i`) is `true`, and K be `last - first - `M;
|
| 8476 |
+
- `last_true` be `out_true + `M, and `last_false` be `out_false + `K.
|
| 8477 |
+
|
| 8478 |
+
For the overloads with parameters `last_true`, `last_false`,
|
| 8479 |
+
`out_true_r`, or `out_false_r`, let M be `last_true - out_true` and K be
|
| 8480 |
+
`last_false - out_false`.
|
| 8481 |
+
|
| 8482 |
+
Let:
|
| 8483 |
+
|
| 8484 |
+
- `i1` be the iterator in \[`first`, `last`) for which E(`*i1`) is
|
| 8485 |
+
`true` and there are exactly M iterators `j` in \[`first`, `i1`) for
|
| 8486 |
+
which E(`*j`) is `true`, or `last` if no such iterator exists;
|
| 8487 |
+
- `i2` be the iterator in \[`first`, `last`) for which E(`*i2`) is
|
| 8488 |
+
`false` and there are exactly K iterators `j` in \[`first`, `i2`) for
|
| 8489 |
+
which E(`*j`) is `false`, or `last` if no such iterator exists;
|
| 8490 |
+
- N be min(`i1 - first`, `i2 - first`).
|
| 8491 |
+
|
| 8492 |
*Mandates:* For the overloads in namespace `std`, the expression
|
| 8493 |
`*first` is writable [[iterator.requirements.general]] to `out_true` and
|
| 8494 |
`out_false`.
|
| 8495 |
|
| 8496 |
*Preconditions:* The input range and output ranges do not overlap.
|
| 8497 |
|
| 8498 |
+
[*Note 1*: For the parallel algorithm overload in namespace `std`,
|
| 8499 |
+
there can be a performance cost if `first`’s value type does not meet
|
| 8500 |
+
the *Cpp17CopyConstructible* requirements. For the parallel algorithm
|
| 8501 |
+
overloads in namespace `ranges`, there can be a performance cost if
|
| 8502 |
+
`first`’s value type does not model `copy_constructible`. — *end note*]
|
| 8503 |
|
| 8504 |
+
*Effects:* For each iterator `i` in \[`first`, `first + `N), copies `*i`
|
| 8505 |
+
to the output range \[`out_true`, `last_true`) if E(`*i`) is `true`, or
|
| 8506 |
+
to the output range \[`out_false`, `last_false`) otherwise.
|
| 8507 |
|
| 8508 |
+
*Returns:* Let `o1` be the iterator past the last copied element in the
|
| 8509 |
+
output range \[`out_true`, `last_true`), and `o2` be the iterator past
|
| 8510 |
+
the last copied element in the output range \[`out_false`,
|
| 8511 |
+
`last_false`). Returns:
|
| 8512 |
|
| 8513 |
- `{o1, o2}` for the overloads in namespace `std`.
|
| 8514 |
+
- `{first + `N`, o1, o2}` for the overloads in namespace `ranges`.
|
| 8515 |
|
| 8516 |
+
*Complexity:* At most `last - first` applications of `pred` and `proj`.
|
| 8517 |
|
| 8518 |
``` cpp
|
| 8519 |
template<class ForwardIterator, class Predicate>
|
| 8520 |
constexpr ForwardIterator
|
| 8521 |
partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
|
|
|
|
| 8583 |
class Proj1 = identity, class Proj2 = identity>
|
| 8584 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 8585 |
constexpr ranges::merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 8586 |
ranges::merge(R1&& r1, R2&& r2, O result,
|
| 8587 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8588 |
+
|
| 8589 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 8590 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 8591 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 8592 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8593 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 8594 |
+
ranges::merge_result<I1, I2, O>
|
| 8595 |
+
ranges::merge(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2, O result, OutS result_last,
|
| 8596 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8597 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 8598 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 8599 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8600 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 8601 |
+
ranges::merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, borrowed_iterator_t<OutR>>
|
| 8602 |
+
ranges::merge(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
|
| 8603 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8604 |
```
|
| 8605 |
|
| 8606 |
+
Let:
|
| 8607 |
+
|
| 8608 |
+
- N be:
|
| 8609 |
+
- `(last1 - first1) + (last2 - first2)` for the overloads with no
|
| 8610 |
+
parameter `result_last` or `result_r`;
|
| 8611 |
+
- min(`(last1 - first1) + (last2 - first2)`, `result_last - result`)
|
| 8612 |
+
for the overloads with parameters `result_last` or `result_r`;
|
| 8613 |
+
- `comp` be `less{}`, `proj1` be `identity{}`, and `proj2` be
|
| 8614 |
+
`identity{}`, for the overloads with no parameters by those names;
|
| 8615 |
+
- E(`e1`, `e1`) be
|
| 8616 |
+
`bool(invoke(comp, invoke(proj2, e2), invoke(proj1, e1)))`;
|
| 8617 |
+
- K be the smallest integer in \[`0`, `last1 - first1`) such that for
|
| 8618 |
+
the element `e1` in the position `first1 + `K there are at least N - K
|
| 8619 |
+
elements `e2` in \[`first2`, `last2`) for which E(`e1`, `e1`) holds,
|
| 8620 |
+
and be equal to `last1 - first1` if no such integer exists.
|
| 8621 |
+
\[*Note 1*: `first1 + `K points to the position past the last element
|
| 8622 |
+
to be copied. — *end note*]
|
| 8623 |
|
| 8624 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 8625 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 8626 |
respectively. The resulting range does not overlap with either of the
|
| 8627 |
original ranges.
|
| 8628 |
|
| 8629 |
+
*Effects:* Copies the first K elements of the range \[`first1`, `last1`)
|
| 8630 |
+
and the first N - K elements of the range \[`first2`, `last2`) into the
|
| 8631 |
+
range \[`result`, `result + `N). If an element `a` precedes `b` in an
|
| 8632 |
+
input range, `a` is copied into the output range before `b`. If `e1` is
|
| 8633 |
+
an element of \[`first1`, `last1`) and `e2` of \[`first2`, `last2`),
|
| 8634 |
+
`e2` is copied into the output range before `e1` if and only if
|
| 8635 |
+
E(`e1`, `e1`) is `true`.
|
|
|
|
| 8636 |
|
| 8637 |
*Returns:*
|
| 8638 |
|
| 8639 |
+
- `result + `N for the overloads in namespace `std`.
|
| 8640 |
+
- `{first1 + `K`, first2 + `N` - `K`, result + `N`}` for the overloads
|
| 8641 |
+
in namespace `ranges`.
|
| 8642 |
|
| 8643 |
*Complexity:*
|
| 8644 |
|
| 8645 |
+
- For the non-parallel algorithm overloads, at most N - 1 comparisons
|
| 8646 |
and applications of each projection.
|
| 8647 |
+
- For the parallel algorithm overloads, 𝑂(N) comparisons and
|
| 8648 |
+
applications of each projection.
|
| 8649 |
|
| 8650 |
*Remarks:* Stable [[algorithm.stable]].
|
| 8651 |
|
| 8652 |
``` cpp
|
| 8653 |
template<class BidirectionalIterator>
|
| 8654 |
+
constexpr void inplace_merge(BidirectionalIterator first,
|
| 8655 |
BidirectionalIterator middle,
|
| 8656 |
BidirectionalIterator last);
|
| 8657 |
template<class ExecutionPolicy, class BidirectionalIterator>
|
| 8658 |
void inplace_merge(ExecutionPolicy&& exec,
|
| 8659 |
BidirectionalIterator first,
|
| 8660 |
BidirectionalIterator middle,
|
| 8661 |
BidirectionalIterator last);
|
| 8662 |
|
| 8663 |
template<class BidirectionalIterator, class Compare>
|
| 8664 |
+
constexpr void inplace_merge(BidirectionalIterator first,
|
| 8665 |
BidirectionalIterator middle,
|
| 8666 |
BidirectionalIterator last, Compare comp);
|
| 8667 |
template<class ExecutionPolicy, class BidirectionalIterator, class Compare>
|
| 8668 |
void inplace_merge(ExecutionPolicy&& exec,
|
| 8669 |
BidirectionalIterator first,
|
|
|
|
| 8671 |
BidirectionalIterator last, Compare comp);
|
| 8672 |
|
| 8673 |
template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 8674 |
class Proj = identity>
|
| 8675 |
requires sortable<I, Comp, Proj>
|
| 8676 |
+
constexpr I ranges::inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
| 8677 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 8678 |
+
class Comp = ranges::less, class Proj = identity>
|
| 8679 |
+
requires sortable<I, Comp, Proj>
|
| 8680 |
+
I ranges::inplace_merge(Ep&& exec, I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
| 8681 |
```
|
| 8682 |
|
| 8683 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 8684 |
no parameters by those names.
|
| 8685 |
|
|
|
|
| 8697 |
|
| 8698 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 8699 |
|
| 8700 |
*Complexity:* Let N = `last - first`:
|
| 8701 |
|
| 8702 |
+
- For the non-parallel algorithm overloads, and if enough additional
|
| 8703 |
+
memory is available, at most N - 1 comparisons.
|
| 8704 |
- Otherwise, 𝑂(N log N) comparisons.
|
| 8705 |
|
| 8706 |
In either case, twice as many projections as comparisons.
|
| 8707 |
|
| 8708 |
*Remarks:* Stable [[algorithm.stable]].
|
| 8709 |
|
| 8710 |
``` cpp
|
| 8711 |
template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
|
| 8712 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 8713 |
+
constexpr borrowed_iterator_t<R>
|
| 8714 |
ranges::inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});
|
| 8715 |
```
|
| 8716 |
|
| 8717 |
*Effects:* Equivalent to:
|
| 8718 |
|
| 8719 |
``` cpp
|
| 8720 |
return ranges::inplace_merge(ranges::begin(r), middle, ranges::end(r), comp, proj);
|
| 8721 |
```
|
| 8722 |
|
| 8723 |
+
``` cpp
|
| 8724 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 8725 |
+
class Proj = identity>
|
| 8726 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 8727 |
+
borrowed_iterator_t<R>
|
| 8728 |
+
ranges::inplace_merge(Ep&& exec, R&& r, iterator_t<R> middle, Comp comp = {},
|
| 8729 |
+
Proj proj = {});
|
| 8730 |
+
```
|
| 8731 |
+
|
| 8732 |
+
*Effects:* Equivalent to:
|
| 8733 |
+
|
| 8734 |
+
``` cpp
|
| 8735 |
+
return ranges::inplace_merge(std::forward<Ep>(exec), ranges::begin(r), middle,
|
| 8736 |
+
ranges::end(r), comp, proj);
|
| 8737 |
+
```
|
| 8738 |
+
|
| 8739 |
### Set operations on sorted structures <a id="alg.set.operations">[[alg.set.operations]]</a>
|
| 8740 |
|
| 8741 |
#### General <a id="alg.set.operations.general">[[alg.set.operations.general]]</a>
|
| 8742 |
|
| 8743 |
Subclause [[alg.set.operations]] defines all the basic set operations on
|
|
|
|
| 8778 |
class Proj2 = identity,
|
| 8779 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 8780 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 8781 |
constexpr bool ranges::includes(R1&& r1, R2&& r2, Comp comp = {},
|
| 8782 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8783 |
+
|
| 8784 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 8785 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 8786 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 8787 |
+
indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
|
| 8788 |
+
ranges::less>
|
| 8789 |
+
bool ranges::includes(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 8790 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8791 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 8792 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 8793 |
+
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 8794 |
+
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 8795 |
+
bool ranges::includes(Ep&& exec, R1&& r1, R2&& r2,
|
| 8796 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8797 |
```
|
| 8798 |
|
| 8799 |
Let `comp` be `less{}`, `proj1` be `identity{}`, and `proj2` be
|
| 8800 |
`identity{}`, for the overloads with no parameters by those names.
|
| 8801 |
|
|
|
|
| 8853 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 8854 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 8855 |
constexpr ranges::set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 8856 |
ranges::set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 8857 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8858 |
+
|
| 8859 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 8860 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 8861 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 8862 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8863 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 8864 |
+
ranges::set_union_result<I1, I2, O>
|
| 8865 |
+
ranges::set_union(Ep&& exec, I1 first1, S1 last1,
|
| 8866 |
+
I2 first2, S2 last2, O result, OutS result_last,
|
| 8867 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8868 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 8869 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 8870 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8871 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 8872 |
+
ranges::set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 8873 |
+
borrowed_iterator_t<OutR>>
|
| 8874 |
+
ranges::set_union(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 8875 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8876 |
```
|
| 8877 |
|
| 8878 |
+
Let:
|
| 8879 |
+
|
| 8880 |
+
- `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
|
| 8881 |
+
overloads with no parameters by those names;
|
| 8882 |
+
- M be `last1 - first1` plus the number of elements in \[`first2`,
|
| 8883 |
+
`last2`) that are not present in \[`first1`, `last1`);
|
| 8884 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 8885 |
+
`result_last` or `result_r`;
|
| 8886 |
+
- N be min(M, `result_last - result`).
|
| 8887 |
|
| 8888 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 8889 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 8890 |
respectively. The resulting range does not overlap with either of the
|
| 8891 |
original ranges.
|
| 8892 |
|
| 8893 |
+
*Effects:* Constructs a sorted union of N elements from the two ranges;
|
| 8894 |
+
that is, the set of elements that are present in one or both of the
|
| 8895 |
+
ranges.
|
| 8896 |
|
| 8897 |
+
*Returns:*
|
|
|
|
| 8898 |
|
| 8899 |
- `result_last` for the overloads in namespace `std`.
|
| 8900 |
+
- `{last1, last2, result + `N`}` for the overloads in namespace
|
| 8901 |
+
`ranges`, if N is equal to M.
|
| 8902 |
+
- Otherwise, `{j1, j2, result_last}` for the overloads in namespace
|
| 8903 |
+
`ranges`, where the iterators `j1` and `j2` point to positions past
|
| 8904 |
+
the last copied or skipped elements in \[`first1`, `last1`) and
|
| 8905 |
+
\[`first2`, `last2`), respectively.
|
| 8906 |
|
| 8907 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 8908 |
comparisons and applications of each projection.
|
| 8909 |
|
| 8910 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
|
|
| 8956 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 8957 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 8958 |
constexpr ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 8959 |
ranges::set_intersection(R1&& r1, R2&& r2, O result,
|
| 8960 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8961 |
+
|
| 8962 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 8963 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 8964 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 8965 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8966 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 8967 |
+
ranges::set_intersection_result<I1, I2, O>
|
| 8968 |
+
ranges::set_intersection(Ep&& exec, I1 first1, S1 last1,
|
| 8969 |
+
I2 first2, S2 last2, O result, OutS result_last,
|
| 8970 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8971 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 8972 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 8973 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 8974 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 8975 |
+
ranges::set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 8976 |
+
borrowed_iterator_t<OutR>>
|
| 8977 |
+
ranges::set_intersection(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 8978 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 8979 |
```
|
| 8980 |
|
| 8981 |
+
Let:
|
| 8982 |
+
|
| 8983 |
+
- `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
|
| 8984 |
+
overloads with no parameters by those names;
|
| 8985 |
+
- M be the number of elements in \[`first1`, `last1`) that are present
|
| 8986 |
+
in \[`first2`, `last2`);
|
| 8987 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 8988 |
+
`result_last` or `result_r`;
|
| 8989 |
+
- N be min(M, `result_last - result`).
|
| 8990 |
|
| 8991 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 8992 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 8993 |
respectively. The resulting range does not overlap with either of the
|
| 8994 |
original ranges.
|
| 8995 |
|
| 8996 |
+
*Effects:* Constructs a sorted intersection of N elements from the two
|
| 8997 |
ranges; that is, the set of elements that are present in both of the
|
| 8998 |
ranges.
|
| 8999 |
|
| 9000 |
+
*Returns:*
|
|
|
|
| 9001 |
|
| 9002 |
- `result_last` for the overloads in namespace `std`.
|
| 9003 |
+
- `{last1, last2, result + `N`}` for the overloads in namespace
|
| 9004 |
+
`ranges`, if N is equal to M.
|
| 9005 |
+
- Otherwise, `{j1, j2, result_last}` for the overloads in namespace
|
| 9006 |
+
`ranges`, where the iterators `j1` and `j2` point to positions past
|
| 9007 |
+
the last copied or skipped elements in \[`first1`, `last1`) and
|
| 9008 |
+
\[`first2`, `last2`), respectively.
|
| 9009 |
|
| 9010 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 9011 |
comparisons and applications of each projection.
|
| 9012 |
|
| 9013 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
|
|
| 9057 |
class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
|
| 9058 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 9059 |
constexpr ranges::set_difference_result<borrowed_iterator_t<R1>, O>
|
| 9060 |
ranges::set_difference(R1&& r1, R2&& r2, O result,
|
| 9061 |
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9062 |
+
|
| 9063 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 9064 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 9065 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 9066 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 9067 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 9068 |
+
ranges::set_difference_result<I1, O>
|
| 9069 |
+
ranges::set_difference(Ep&& exec, I1 first1, S1 last1,
|
| 9070 |
+
I2 first2, S2 last2, O result, OutS result_last,
|
| 9071 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9072 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 9073 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 9074 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 9075 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 9076 |
+
ranges::set_difference_result<borrowed_iterator_t<R1>, borrowed_iterator_t<OutR>>
|
| 9077 |
+
ranges::set_difference(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r, Comp comp = {},
|
| 9078 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9079 |
```
|
| 9080 |
|
| 9081 |
+
Let:
|
| 9082 |
+
|
| 9083 |
+
- `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
|
| 9084 |
+
overloads with no parameters by those names;
|
| 9085 |
+
- M be the number of elements in \[`first1`, `last1`) that are not
|
| 9086 |
+
present in \[`first2`, `last2`);
|
| 9087 |
+
- `result_last` be `result + `M for the overloads with no parameter
|
| 9088 |
+
`result_last` or `result_r`;
|
| 9089 |
+
- N be min(M, `result_last - result`).
|
| 9090 |
|
| 9091 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 9092 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 9093 |
respectively. The resulting range does not overlap with either of the
|
| 9094 |
original ranges.
|
| 9095 |
|
| 9096 |
+
*Effects:* Copies N elements of the range \[`first1`, `last1`) which are
|
| 9097 |
+
not present in the range \[`first2`, `last2`) to the range \[`result`,
|
| 9098 |
+
`result + `N). The elements in the constructed range are sorted.
|
| 9099 |
|
| 9100 |
+
*Returns:*
|
|
|
|
| 9101 |
|
| 9102 |
- `result_last` for the overloads in namespace `std`.
|
| 9103 |
+
- `{last1, result + `N`}` for the overloads in namespace `ranges`, if N
|
| 9104 |
+
is equal to M.
|
| 9105 |
+
- Otherwise, `{j1, result_last}` for the overloads in namespace
|
| 9106 |
+
`ranges`, where the iterator `j1` points to the position past the last
|
| 9107 |
+
copied or skipped element in \[`first1`, `last1`).
|
| 9108 |
|
| 9109 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 9110 |
comparisons and applications of each projection.
|
| 9111 |
|
| 9112 |
*Remarks:* If \[`first1`, `last1`) contains m elements that are
|
|
|
|
| 9158 |
requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
|
| 9159 |
constexpr ranges::set_symmetric_difference_result<borrowed_iterator_t<R1>,
|
| 9160 |
borrowed_iterator_t<R2>, O>
|
| 9161 |
ranges::set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
|
| 9162 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9163 |
+
|
| 9164 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 9165 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 9166 |
+
random_access_iterator O, sized_sentinel_for<O> OutS, class Comp = ranges::less,
|
| 9167 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 9168 |
+
requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
|
| 9169 |
+
ranges::set_symmetric_difference_result<I1, I2, O>
|
| 9170 |
+
ranges::set_symmetric_difference(Ep&& exec, I1 first1, S1 last1,
|
| 9171 |
+
I2 first2, S2 last2, O result, OutS result_last,
|
| 9172 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9173 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 9174 |
+
sized-random-access-range OutR, class Comp = ranges::less,
|
| 9175 |
+
class Proj1 = identity, class Proj2 = identity>
|
| 9176 |
+
requires mergeable<iterator_t<R1>, iterator_t<R2>, iterator_t<OutR>, Comp, Proj1, Proj2>
|
| 9177 |
+
ranges::set_symmetric_difference_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
|
| 9178 |
+
borrowed_iterator_t<OutR>>
|
| 9179 |
+
ranges::set_symmetric_difference(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
|
| 9180 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9181 |
```
|
| 9182 |
|
| 9183 |
+
Let:
|
| 9184 |
+
|
| 9185 |
+
- `comp` be `less{}`, and `proj1` and `proj2` be `identity{}` for the
|
| 9186 |
+
overloads with no parameters by those names;
|
| 9187 |
+
- K be the number of elements in \[`first1`, `last1`) that are not
|
| 9188 |
+
present in \[`first2`, `last2`).
|
| 9189 |
+
- M be the number of elements in \[`first2`, `last2`) that are not
|
| 9190 |
+
present in \[`first1`, `last1`).
|
| 9191 |
+
- `result_last` be `result + `M` + `K for the overloads with no
|
| 9192 |
+
parameter `result_last` or `result_r`;
|
| 9193 |
+
- N be min(K + M, `result_last - result`).
|
| 9194 |
|
| 9195 |
*Preconditions:* The ranges \[`first1`, `last1`) and \[`first2`,
|
| 9196 |
`last2`) are sorted with respect to `comp` and `proj1` or `proj2`,
|
| 9197 |
respectively. The resulting range does not overlap with either of the
|
| 9198 |
original ranges.
|
| 9199 |
|
| 9200 |
*Effects:* Copies the elements of the range \[`first1`, `last1`) that
|
| 9201 |
are not present in the range \[`first2`, `last2`), and the elements of
|
| 9202 |
the range \[`first2`, `last2`) that are not present in the range
|
| 9203 |
+
\[`first1`, `last1`) to the range \[`result`, `result + `N). The
|
| 9204 |
+
elements in the constructed range are sorted.
|
| 9205 |
|
| 9206 |
+
*Returns:*
|
|
|
|
| 9207 |
|
| 9208 |
- `result_last` for the overloads in namespace `std`.
|
| 9209 |
+
- `{last1, last2, result + `N`}` for the overloads in namespace
|
| 9210 |
+
`ranges`, if N is equal to M + K.
|
| 9211 |
+
- Otherwise, `{j1, j2, result_last}` for the overloads in namespace
|
| 9212 |
+
`ranges`, where the iterators `j1` and `j2` point to positions past
|
| 9213 |
+
the last copied or skipped elements in \[`first1`, `last1`) and
|
| 9214 |
+
\[`first2`, `last2`), respectively.
|
| 9215 |
|
| 9216 |
*Complexity:* At most `2 * ((last1 - first1) + (last2 - first2)) - 1`
|
| 9217 |
comparisons and applications of each projection.
|
| 9218 |
|
| 9219 |
*Remarks:* Stable [[algorithm.stable]]. If \[`first1`, `last1`) contains
|
|
|
|
| 9452 |
```
|
| 9453 |
|
| 9454 |
*Effects:* Equivalent to:
|
| 9455 |
`return ranges::is_heap_until(first, last, comp, proj) == last;`
|
| 9456 |
|
| 9457 |
+
``` cpp
|
| 9458 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 9459 |
+
class Proj = identity,
|
| 9460 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 9461 |
+
bool ranges::is_heap(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 9462 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9463 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9464 |
+
bool ranges::is_heap(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9465 |
+
```
|
| 9466 |
+
|
| 9467 |
+
*Effects:* Equivalent to:
|
| 9468 |
+
|
| 9469 |
+
``` cpp
|
| 9470 |
+
return ranges::is_heap_until(std::forward<Ep>(exec), first, last, comp, proj) == last;
|
| 9471 |
+
```
|
| 9472 |
+
|
| 9473 |
``` cpp
|
| 9474 |
template<class RandomAccessIterator>
|
| 9475 |
constexpr RandomAccessIterator
|
| 9476 |
is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
|
| 9477 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
|
|
|
| 9494 |
constexpr I ranges::is_heap_until(I first, S last, Comp comp = {}, Proj proj = {});
|
| 9495 |
template<random_access_range R, class Proj = identity,
|
| 9496 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9497 |
constexpr borrowed_iterator_t<R>
|
| 9498 |
ranges::is_heap_until(R&& r, Comp comp = {}, Proj proj = {});
|
| 9499 |
+
|
| 9500 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 9501 |
+
class Proj = identity,
|
| 9502 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 9503 |
+
I ranges::is_heap_until(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 9504 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9505 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9506 |
+
borrowed_iterator_t<R>
|
| 9507 |
+
ranges::is_heap_until(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9508 |
```
|
| 9509 |
|
| 9510 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 9511 |
no parameters by those names.
|
| 9512 |
|
|
|
|
| 9552 |
template<input_range R, class Proj = identity,
|
| 9553 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9554 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9555 |
constexpr range_value_t<R>
|
| 9556 |
ranges::min(R&& r, Comp comp = {}, Proj proj = {});
|
| 9557 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9558 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9559 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9560 |
+
range_value_t<R>
|
| 9561 |
+
ranges::min(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9562 |
```
|
| 9563 |
|
| 9564 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 9565 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 9566 |
For the first form, `T` meets the *Cpp17LessThanComparable* requirements
|
|
|
|
| 9610 |
template<input_range R, class Proj = identity,
|
| 9611 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9612 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9613 |
constexpr range_value_t<R>
|
| 9614 |
ranges::max(R&& r, Comp comp = {}, Proj proj = {});
|
| 9615 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9616 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9617 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9618 |
+
range_value_t<R>
|
| 9619 |
+
ranges::max(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9620 |
```
|
| 9621 |
|
| 9622 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 9623 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 9624 |
For the first form, `T` meets the *Cpp17LessThanComparable* requirements
|
|
|
|
| 9669 |
template<input_range R, class Proj = identity,
|
| 9670 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9671 |
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9672 |
constexpr ranges::minmax_result<range_value_t<R>>
|
| 9673 |
ranges::minmax(R&& r, Comp comp = {}, Proj proj = {});
|
| 9674 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9675 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9676 |
+
requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
|
| 9677 |
+
ranges::minmax_result<range_value_t<R>>
|
| 9678 |
+
ranges::minmax(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9679 |
```
|
| 9680 |
|
| 9681 |
*Preconditions:* `ranges::distance(r) > 0`. For the overloads in
|
| 9682 |
namespace `std`, `T` meets the *Cpp17CopyConstructible* requirements.
|
| 9683 |
For the first form, type `T` meets the *Cpp17LessThanComparable*
|
|
|
|
| 9714 |
constexpr I ranges::min_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 9715 |
template<forward_range R, class Proj = identity,
|
| 9716 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9717 |
constexpr borrowed_iterator_t<R>
|
| 9718 |
ranges::min_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 9719 |
+
|
| 9720 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 9721 |
+
class Proj = identity,
|
| 9722 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 9723 |
+
I ranges::min_element(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 9724 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 9725 |
+
class Proj = identity,
|
| 9726 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9727 |
+
borrowed_iterator_t<R>
|
| 9728 |
+
ranges::min_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9729 |
```
|
| 9730 |
|
| 9731 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 9732 |
no parameters by those names.
|
| 9733 |
|
|
|
|
| 9763 |
constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 9764 |
template<forward_range R, class Proj = identity,
|
| 9765 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9766 |
constexpr borrowed_iterator_t<R>
|
| 9767 |
ranges::max_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 9768 |
+
|
| 9769 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 9770 |
+
class Proj = identity,
|
| 9771 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 9772 |
+
I ranges::max_element(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 9773 |
+
template<execution-policy Ep, sized-random-access-range R,
|
| 9774 |
+
class Proj = identity,
|
| 9775 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9776 |
+
borrowed_iterator_t<R>
|
| 9777 |
+
ranges::max_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9778 |
```
|
| 9779 |
|
| 9780 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 9781 |
no parameters by those names.
|
| 9782 |
|
|
|
|
| 9815 |
ranges::minmax_element(I first, S last, Comp comp = {}, Proj proj = {});
|
| 9816 |
template<forward_range R, class Proj = identity,
|
| 9817 |
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9818 |
constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
|
| 9819 |
ranges::minmax_element(R&& r, Comp comp = {}, Proj proj = {});
|
| 9820 |
+
|
| 9821 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 9822 |
+
class Proj = identity,
|
| 9823 |
+
indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
|
| 9824 |
+
ranges::minmax_element_result<I>
|
| 9825 |
+
ranges::minmax_element(Ep&& exec, I first, S last, Comp comp = {}, Proj proj = {});
|
| 9826 |
+
template<execution-policy Ep, sized-random-access-range R, class Proj = identity,
|
| 9827 |
+
indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
|
| 9828 |
+
ranges::minmax_element_result<borrowed_iterator_t<R>>
|
| 9829 |
+
ranges::minmax_element(Ep&& exec, R&& r, Comp comp = {}, Proj proj = {});
|
| 9830 |
```
|
| 9831 |
|
| 9832 |
*Returns:* `{first, first}` if \[`first`, `last`) is empty, otherwise
|
| 9833 |
`{m, M}`, where `m` is the first iterator in \[`first`, `last`) such
|
| 9834 |
that no iterator in the range refers to a smaller element, and where `M`
|
|
|
|
| 9911 |
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 9912 |
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 9913 |
constexpr bool
|
| 9914 |
ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
|
| 9915 |
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9916 |
+
|
| 9917 |
+
template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
|
| 9918 |
+
random_access_iterator I2, sized_sentinel_for<I2> S2,
|
| 9919 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 9920 |
+
indirect_strict_weak_order<projected<I1, Proj1>,
|
| 9921 |
+
projected<I2, Proj2>> Comp = ranges::less>
|
| 9922 |
+
bool ranges::lexicographical_compare(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
|
| 9923 |
+
Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9924 |
+
template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
|
| 9925 |
+
class Proj1 = identity, class Proj2 = identity,
|
| 9926 |
+
indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
|
| 9927 |
+
projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
|
| 9928 |
+
bool ranges::lexicographical_compare(Ep&& exec, R1&& r1, R2&& r2, Comp comp = {},
|
| 9929 |
+
Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 9930 |
```
|
| 9931 |
|
| 9932 |
*Returns:* `true` if and only if the sequence of elements defined by the
|
| 9933 |
range \[`first1`, `last1`) is lexicographically less than the sequence
|
| 9934 |
of elements defined by the range \[`first2`, `last2`).
|
|
|
|
| 10087 |
*Complexity:* At most `(last - first) / 2` swaps.
|
| 10088 |
|
| 10089 |
## Header `<numeric>` synopsis <a id="numeric.ops.overview">[[numeric.ops.overview]]</a>
|
| 10090 |
|
| 10091 |
``` cpp
|
| 10092 |
+
// mostly freestanding
|
| 10093 |
namespace std {
|
| 10094 |
// [accumulate], accumulate
|
| 10095 |
template<class InputIterator, class T>
|
| 10096 |
constexpr T accumulate(InputIterator first, InputIterator last, T init);
|
| 10097 |
template<class InputIterator, class T, class BinaryOperation>
|
|
|
|
| 10107 |
template<class InputIterator, class T, class BinaryOperation>
|
| 10108 |
constexpr T reduce(InputIterator first, InputIterator last, T init,
|
| 10109 |
BinaryOperation binary_op);
|
| 10110 |
template<class ExecutionPolicy, class ForwardIterator>
|
| 10111 |
typename iterator_traits<ForwardIterator>::value_type
|
| 10112 |
+
reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10113 |
ForwardIterator first, ForwardIterator last);
|
| 10114 |
template<class ExecutionPolicy, class ForwardIterator, class T>
|
| 10115 |
+
T reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10116 |
ForwardIterator first, ForwardIterator last, T init);
|
| 10117 |
template<class ExecutionPolicy, class ForwardIterator, class T, class BinaryOperation>
|
| 10118 |
+
T reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10119 |
ForwardIterator first, ForwardIterator last, T init, BinaryOperation binary_op);
|
| 10120 |
|
| 10121 |
// [inner.product], inner product
|
| 10122 |
template<class InputIterator1, class InputIterator2, class T>
|
| 10123 |
constexpr T inner_product(InputIterator1 first1, InputIterator1 last1,
|
|
|
|
| 10141 |
class BinaryOperation, class UnaryOperation>
|
| 10142 |
constexpr T transform_reduce(InputIterator first, InputIterator last, T init,
|
| 10143 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 10144 |
template<class ExecutionPolicy,
|
| 10145 |
class ForwardIterator1, class ForwardIterator2, class T>
|
| 10146 |
+
T transform_reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10147 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 10148 |
ForwardIterator2 first2, T init);
|
| 10149 |
template<class ExecutionPolicy,
|
| 10150 |
class ForwardIterator1, class ForwardIterator2, class T,
|
| 10151 |
class BinaryOperation1, class BinaryOperation2>
|
| 10152 |
+
T transform_reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10153 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 10154 |
ForwardIterator2 first2, T init,
|
| 10155 |
BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
|
| 10156 |
template<class ExecutionPolicy, class ForwardIterator, class T,
|
| 10157 |
class BinaryOperation, class UnaryOperation>
|
| 10158 |
+
T transform_reduce(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10159 |
ForwardIterator first, ForwardIterator last, T init,
|
| 10160 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 10161 |
|
| 10162 |
// [partial.sum], partial sum
|
| 10163 |
template<class InputIterator, class OutputIterator>
|
|
|
|
| 10178 |
constexpr OutputIterator
|
| 10179 |
exclusive_scan(InputIterator first, InputIterator last,
|
| 10180 |
OutputIterator result, T init, BinaryOperation binary_op);
|
| 10181 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T>
|
| 10182 |
ForwardIterator2
|
| 10183 |
+
exclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10184 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10185 |
ForwardIterator2 result, T init);
|
| 10186 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T,
|
| 10187 |
class BinaryOperation>
|
| 10188 |
ForwardIterator2
|
| 10189 |
+
exclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10190 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10191 |
ForwardIterator2 result, T init, BinaryOperation binary_op);
|
| 10192 |
|
| 10193 |
// [inclusive.scan], inclusive scan
|
| 10194 |
template<class InputIterator, class OutputIterator>
|
|
|
|
| 10203 |
constexpr OutputIterator
|
| 10204 |
inclusive_scan(InputIterator first, InputIterator last,
|
| 10205 |
OutputIterator result, BinaryOperation binary_op, T init);
|
| 10206 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 10207 |
ForwardIterator2
|
| 10208 |
+
inclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10209 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10210 |
ForwardIterator2 result);
|
| 10211 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10212 |
class BinaryOperation>
|
| 10213 |
ForwardIterator2
|
| 10214 |
+
inclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10215 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10216 |
ForwardIterator2 result, BinaryOperation binary_op);
|
| 10217 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10218 |
class BinaryOperation, class T>
|
| 10219 |
ForwardIterator2
|
| 10220 |
+
inclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10221 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10222 |
ForwardIterator2 result, BinaryOperation binary_op, T init);
|
| 10223 |
|
| 10224 |
// [transform.exclusive.scan], transform exclusive scan
|
| 10225 |
template<class InputIterator, class OutputIterator, class T,
|
|
|
|
| 10229 |
OutputIterator result, T init,
|
| 10230 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 10231 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class T,
|
| 10232 |
class BinaryOperation, class UnaryOperation>
|
| 10233 |
ForwardIterator2
|
| 10234 |
+
transform_exclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10235 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10236 |
ForwardIterator2 result, T init,
|
| 10237 |
BinaryOperation binary_op, UnaryOperation unary_op);
|
| 10238 |
|
| 10239 |
// [transform.inclusive.scan], transform inclusive scan
|
|
|
|
| 10250 |
OutputIterator result,
|
| 10251 |
BinaryOperation binary_op, UnaryOperation unary_op, T init);
|
| 10252 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10253 |
class BinaryOperation, class UnaryOperation>
|
| 10254 |
ForwardIterator2
|
| 10255 |
+
transform_inclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10256 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10257 |
ForwardIterator2 result, BinaryOperation binary_op,
|
| 10258 |
UnaryOperation unary_op);
|
| 10259 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10260 |
class BinaryOperation, class UnaryOperation, class T>
|
| 10261 |
ForwardIterator2
|
| 10262 |
+
transform_inclusive_scan(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10263 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10264 |
ForwardIterator2 result,
|
| 10265 |
BinaryOperation binary_op, UnaryOperation unary_op, T init);
|
| 10266 |
|
| 10267 |
// [adjacent.difference], adjacent difference
|
|
|
|
| 10273 |
constexpr OutputIterator
|
| 10274 |
adjacent_difference(InputIterator first, InputIterator last,
|
| 10275 |
OutputIterator result, BinaryOperation binary_op);
|
| 10276 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 10277 |
ForwardIterator2
|
| 10278 |
+
adjacent_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10279 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10280 |
ForwardIterator2 result);
|
| 10281 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10282 |
class BinaryOperation>
|
| 10283 |
ForwardIterator2
|
| 10284 |
+
adjacent_difference(ExecutionPolicy&& exec, // freestanding-deleted, see [algorithms.parallel.overloads]
|
| 10285 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 10286 |
ForwardIterator2 result, BinaryOperation binary_op);
|
| 10287 |
|
| 10288 |
// [numeric.iota], iota
|
| 10289 |
template<class ForwardIterator, class T>
|
|
|
|
| 10312 |
// [numeric.ops.midpoint], midpoint
|
| 10313 |
template<class T>
|
| 10314 |
constexpr T midpoint(T a, T b) noexcept;
|
| 10315 |
template<class T>
|
| 10316 |
constexpr T* midpoint(T* a, T* b);
|
| 10317 |
+
|
| 10318 |
+
// [numeric.sat], saturation arithmetic
|
| 10319 |
+
template<class T>
|
| 10320 |
+
constexpr T add_sat(T x, T y) noexcept;
|
| 10321 |
+
template<class T>
|
| 10322 |
+
constexpr T sub_sat(T x, T y) noexcept;
|
| 10323 |
+
template<class T>
|
| 10324 |
+
constexpr T mul_sat(T x, T y) noexcept;
|
| 10325 |
+
template<class T>
|
| 10326 |
+
constexpr T div_sat(T x, T y) noexcept;
|
| 10327 |
+
template<class T, class U>
|
| 10328 |
+
constexpr T saturate_cast(U x) noexcept;
|
| 10329 |
}
|
| 10330 |
```
|
| 10331 |
|
| 10332 |
## Generalized numeric operations <a id="numeric.ops">[[numeric.ops]]</a>
|
| 10333 |
|
|
|
|
| 10337 |
specify requirements throughout [[numeric.ops]] is
|
| 10338 |
intentional. — *end note*]
|
| 10339 |
|
| 10340 |
### Definitions <a id="numerics.defns">[[numerics.defns]]</a>
|
| 10341 |
|
| 10342 |
+
Define `GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aN)` as follows:
|
| 10343 |
|
| 10344 |
- `a1` when `N` is `1`, otherwise
|
| 10345 |
+
- `op(GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aK),`
|
| 10346 |
+
`\phantom{op(}GENERALIZED_NONCOMMUTATIVE_SUM(op, aM, …, aN))` for any
|
| 10347 |
+
`K` where 1 < K+1 = M ≤ N.
|
| 10348 |
|
| 10349 |
+
Define `GENERALIZED_SUM(op, a1, …, aN)` as
|
| 10350 |
+
`GENERALIZED_NONCOMMUTATIVE_SUM(op, b1, …, bN)`, where `b1, …, bN` may
|
| 10351 |
+
be any permutation of `a1, …, aN`.
|
| 10352 |
|
| 10353 |
### Accumulate <a id="accumulate">[[accumulate]]</a>
|
| 10354 |
|
| 10355 |
``` cpp
|
| 10356 |
template<class InputIterator, class T>
|
|
|
|
| 10447 |
- `T` meets the *Cpp17MoveConstructible* ([[cpp17.moveconstructible]])
|
| 10448 |
requirements.
|
| 10449 |
- `binary_op` neither invalidates iterators or subranges, nor modifies
|
| 10450 |
elements in the range \[`first`, `last`\].
|
| 10451 |
|
| 10452 |
+
*Returns:* *GENERALIZED_SUM*(binary_op, init, \*i, …) for every `i` in
|
| 10453 |
\[`first`, `last`).
|
| 10454 |
|
| 10455 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
| 10456 |
|
| 10457 |
[*Note 1*: The difference between `reduce` and `accumulate` is that
|
|
|
|
| 10555 |
`first2 + (last1 - first1)`\].
|
| 10556 |
|
| 10557 |
*Returns:*
|
| 10558 |
|
| 10559 |
``` cpp
|
| 10560 |
+
GENERALIZED_SUM(binary_op1, init, binary_op2(*i, *(first2 + (i - first1))), …)
|
| 10561 |
```
|
| 10562 |
|
| 10563 |
for every iterator `i` in \[`first1`, `last1`).
|
| 10564 |
|
| 10565 |
*Complexity:* 𝑂(`last1 - first1`) applications each of `binary_op1` and
|
|
|
|
| 10595 |
elements in the range \[`first`, `last`\].
|
| 10596 |
|
| 10597 |
*Returns:*
|
| 10598 |
|
| 10599 |
``` cpp
|
| 10600 |
+
GENERALIZED_SUM(binary_op, init, unary_op(*i), …)
|
| 10601 |
```
|
| 10602 |
|
| 10603 |
for every iterator `i` in \[`first`, `last`).
|
| 10604 |
|
| 10605 |
*Complexity:* 𝑂(`last - first`) applications each of `unary_op` and
|
|
|
|
| 10707 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 10708 |
through `result + K` the value of:
|
| 10709 |
|
| 10710 |
``` cpp
|
| 10711 |
GENERALIZED_NONCOMMUTATIVE_SUM(
|
| 10712 |
+
binary_op, init, *(first + 0), *(first + 1), …, *(first + K - 1))
|
| 10713 |
```
|
| 10714 |
|
| 10715 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 10716 |
|
| 10717 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
|
|
|
| 10798 |
|
| 10799 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 10800 |
through `result + K` the value of
|
| 10801 |
|
| 10802 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 10803 |
+
binary_op, init, \*(first + 0), \*(first + 1), …, \*(first + K))
|
|
|
|
| 10804 |
if `init` is provided, or
|
| 10805 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 10806 |
+
binary_op, \*(first + 0), \*(first + 1), …, \*(first + K))
|
| 10807 |
otherwise.
|
| 10808 |
|
| 10809 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 10810 |
|
| 10811 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
|
|
|
| 10856 |
through `result + K` the value of:
|
| 10857 |
|
| 10858 |
``` cpp
|
| 10859 |
GENERALIZED_NONCOMMUTATIVE_SUM(
|
| 10860 |
binary_op, init,
|
| 10861 |
+
unary_op(*(first + 0)), unary_op(*(first + 1)), …, unary_op(*(first + K - 1)))
|
| 10862 |
```
|
| 10863 |
|
| 10864 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 10865 |
|
| 10866 |
*Complexity:* 𝑂(`last - first`) applications each of `unary_op` and
|
|
|
|
| 10933 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 10934 |
through `result + K` the value of
|
| 10935 |
|
| 10936 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 10937 |
binary_op, init,
|
| 10938 |
+
unary_op(\*(first + 0)), unary_op(\*(first + 1)), …,
|
| 10939 |
unary_op(\*(first + K)))
|
| 10940 |
if `init` is provided, or
|
| 10941 |
- *GENERALIZED_NONCOMMUTATIVE_SUM*(
|
| 10942 |
binary_op,
|
| 10943 |
+
unary_op(\*(first + 0)), unary_op(\*(first + 1)), …,
|
| 10944 |
unary_op(\*(first + K)))
|
| 10945 |
otherwise.
|
| 10946 |
|
| 10947 |
*Returns:* The end of the resulting range beginning at `result`.
|
| 10948 |
|
|
|
|
| 11012 |
`val` whose type is `T`, initializes it with `*i`, computes
|
| 11013 |
`binary_op(val, std::move(acc))`, assigns the result to
|
| 11014 |
`*(result + (i - first))`, and move assigns from `val` to `acc`.
|
| 11015 |
|
| 11016 |
For the overloads with an `ExecutionPolicy` and a non-empty range,
|
| 11017 |
+
performs `*result = *first`. Then, for every `d` in \[`1`,
|
| 11018 |
+
`last - first - 1`\], performs
|
| 11019 |
`*(result + d) = binary_op(*(first + d), *(first + (d - 1)))`.
|
| 11020 |
|
| 11021 |
*Returns:* `result + (last - first)`.
|
| 11022 |
|
| 11023 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
|
|
|
| 11136 |
n for this purpose. — *end note*]
|
| 11137 |
|
| 11138 |
*Returns:* A pointer to array element $i+\frac{j-i}{2}$ of `x`, where
|
| 11139 |
the result of the division is truncated towards zero.
|
| 11140 |
|
| 11141 |
+
### Saturation arithmetic <a id="numeric.sat">[[numeric.sat]]</a>
|
| 11142 |
+
|
| 11143 |
+
#### Arithmetic functions <a id="numeric.sat.func">[[numeric.sat.func]]</a>
|
| 11144 |
+
|
| 11145 |
+
In the following descriptions, an arithmetic operation is performed as a
|
| 11146 |
+
mathematical operation with infinite range and then it is determined
|
| 11147 |
+
whether the mathematical result fits into the result type.
|
| 11148 |
+
|
| 11149 |
+
``` cpp
|
| 11150 |
+
template<class T>
|
| 11151 |
+
constexpr T add_sat(T x, T y) noexcept;
|
| 11152 |
+
```
|
| 11153 |
+
|
| 11154 |
+
*Constraints:* `T` is a signed or unsigned integer
|
| 11155 |
+
type [[basic.fundamental]].
|
| 11156 |
+
|
| 11157 |
+
*Returns:* If `x` + `y` is representable as a value of type `T`,
|
| 11158 |
+
`x` + `y`; otherwise, either the largest or smallest representable value
|
| 11159 |
+
of type `T`, whichever is closer to the value of `x` + `y`.
|
| 11160 |
+
|
| 11161 |
+
``` cpp
|
| 11162 |
+
template<class T>
|
| 11163 |
+
constexpr T sub_sat(T x, T y) noexcept;
|
| 11164 |
+
```
|
| 11165 |
+
|
| 11166 |
+
*Constraints:* `T` is a signed or unsigned integer
|
| 11167 |
+
type [[basic.fundamental]].
|
| 11168 |
+
|
| 11169 |
+
*Returns:* If `x` - `y` is representable as a value of type `T`,
|
| 11170 |
+
`x` - `y`; otherwise, either the largest or smallest representable value
|
| 11171 |
+
of type `T`, whichever is closer to the value of `x` - `y`.
|
| 11172 |
+
|
| 11173 |
+
``` cpp
|
| 11174 |
+
template<class T>
|
| 11175 |
+
constexpr T mul_sat(T x, T y) noexcept;
|
| 11176 |
+
```
|
| 11177 |
+
|
| 11178 |
+
*Constraints:* `T` is a signed or unsigned integer
|
| 11179 |
+
type [[basic.fundamental]].
|
| 11180 |
+
|
| 11181 |
+
*Returns:* If `x` × `y` is representable as a value of type `T`,
|
| 11182 |
+
`x` × `y`; otherwise, either the largest or smallest representable value
|
| 11183 |
+
of type `T`, whichever is closer to the value of `x` × `y`.
|
| 11184 |
+
|
| 11185 |
+
``` cpp
|
| 11186 |
+
template<class T>
|
| 11187 |
+
constexpr T div_sat(T x, T y) noexcept;
|
| 11188 |
+
```
|
| 11189 |
+
|
| 11190 |
+
*Constraints:* `T` is a signed or unsigned integer
|
| 11191 |
+
type [[basic.fundamental]].
|
| 11192 |
+
|
| 11193 |
+
*Preconditions:* `y != 0` is `true`.
|
| 11194 |
+
|
| 11195 |
+
*Returns:* If `T` is a signed integer type and
|
| 11196 |
+
`x == numeric_limits<T>::min() && y == -1` is `true`,
|
| 11197 |
+
`numeric_limits<T>::max()`, otherwise, `x / y`.
|
| 11198 |
+
|
| 11199 |
+
*Remarks:* A function call expression that violates the precondition in
|
| 11200 |
+
the *Preconditions* element is not a core constant
|
| 11201 |
+
expression [[expr.const]].
|
| 11202 |
+
|
| 11203 |
+
#### Casting <a id="numeric.sat.cast">[[numeric.sat.cast]]</a>
|
| 11204 |
+
|
| 11205 |
+
``` cpp
|
| 11206 |
+
template<class R, class T>
|
| 11207 |
+
constexpr R saturate_cast(T x) noexcept;
|
| 11208 |
+
```
|
| 11209 |
+
|
| 11210 |
+
*Constraints:* `R` and `T` are signed or unsigned integer
|
| 11211 |
+
types [[basic.fundamental]].
|
| 11212 |
+
|
| 11213 |
+
*Returns:* If `x` is representable as a value of type `R`, `x`;
|
| 11214 |
+
otherwise, either the largest or smallest representable value of type
|
| 11215 |
+
`R`, whichever is closer to the value of `x`.
|
| 11216 |
+
|
| 11217 |
## Specialized `<memory>` algorithms <a id="specialized.algorithms">[[specialized.algorithms]]</a>
|
| 11218 |
|
| 11219 |
### General <a id="specialized.algorithms.general">[[specialized.algorithms.general]]</a>
|
| 11220 |
|
| 11221 |
The contents specified in [[specialized.algorithms]] are declared in the
|
|
|
|
| 11224 |
Unless otherwise specified, if an exception is thrown in the following
|
| 11225 |
algorithms, objects constructed by a placement *new-expression*
|
| 11226 |
[[expr.new]] are destroyed in an unspecified order before allowing the
|
| 11227 |
exception to propagate.
|
| 11228 |
|
| 11229 |
+
[*Note 1*: When new objects are created by the algorithms specified in
|
| 11230 |
+
[[specialized.algorithms]], the lifetime ends for any existing objects
|
| 11231 |
+
(including potentially-overlapping subobjects [[intro.object]]) in
|
| 11232 |
+
storage that is reused [[basic.life]]. — *end note*]
|
| 11233 |
+
|
| 11234 |
Some algorithms specified in [[specialized.algorithms]] make use of the
|
| 11235 |
+
following exposition-only function templates:
|
| 11236 |
|
| 11237 |
``` cpp
|
| 11238 |
template<class T>
|
| 11239 |
constexpr void* voidify(T& obj) noexcept {
|
| 11240 |
return addressof(obj);
|
| 11241 |
}
|
| 11242 |
+
|
| 11243 |
+
template<class I>
|
| 11244 |
+
decltype(auto) deref-move(I& it) {
|
| 11245 |
+
if constexpr (is_lvalue_reference_v<decltype(*it)>)
|
| 11246 |
+
return std::move(*it);
|
| 11247 |
+
else
|
| 11248 |
+
return *it;
|
| 11249 |
+
}
|
| 11250 |
```
|
| 11251 |
|
| 11252 |
### Special memory concepts <a id="special.mem.concepts">[[special.mem.concepts]]</a>
|
| 11253 |
|
| 11254 |
Some algorithms in this subclause are constrained with the following
|
|
|
|
| 11281 |
|
| 11282 |
[*Note 2*: This concept allows some `sentinel_for`
|
| 11283 |
[[iterator.concept.sentinel]] operations to throw
|
| 11284 |
exceptions. — *end note*]
|
| 11285 |
|
| 11286 |
+
``` cpp
|
| 11287 |
+
template<class S, class I>
|
| 11288 |
+
concept nothrow-sized-sentinel-for = // exposition only
|
| 11289 |
+
nothrow-sentinel-for<S, I> &&
|
| 11290 |
+
sized_sentinel_for<S, I>;
|
| 11291 |
+
```
|
| 11292 |
+
|
| 11293 |
+
Types `S` and `I` model `nothrow-sized-sentinel-for` only if no
|
| 11294 |
+
exceptions are thrown from the `-` operator for valid values of type `I`
|
| 11295 |
+
and `S`.
|
| 11296 |
+
|
| 11297 |
+
[*Note 3*: This concept allows some `sized_sentinel_for`
|
| 11298 |
+
[[iterator.concept.sizedsentinel]] operations to throw
|
| 11299 |
+
exceptions. — *end note*]
|
| 11300 |
+
|
| 11301 |
``` cpp
|
| 11302 |
template<class R>
|
| 11303 |
concept nothrow-input-range = // exposition only
|
| 11304 |
range<R> &&
|
| 11305 |
nothrow-input-iterator<iterator_t<R>> &&
|
|
|
|
| 11316 |
nothrow-input-iterator<I> &&
|
| 11317 |
forward_iterator<I> &&
|
| 11318 |
nothrow-sentinel-for<I, I>;
|
| 11319 |
```
|
| 11320 |
|
| 11321 |
+
[*Note 4*: This concept allows some `forward_iterator`
|
| 11322 |
[[iterator.concept.forward]] operations to throw
|
| 11323 |
exceptions. — *end note*]
|
| 11324 |
|
| 11325 |
``` cpp
|
| 11326 |
template<class R>
|
| 11327 |
concept nothrow-forward-range = // exposition only
|
| 11328 |
nothrow-input-range<R> &&
|
| 11329 |
nothrow-forward-iterator<iterator_t<R>>;
|
| 11330 |
```
|
| 11331 |
|
| 11332 |
+
``` cpp
|
| 11333 |
+
template<class I>
|
| 11334 |
+
concept nothrow-bidirectional-iterator = // exposition only
|
| 11335 |
+
nothrow-forward-iterator<I> &&
|
| 11336 |
+
bidirectional_iterator<I>;
|
| 11337 |
+
```
|
| 11338 |
+
|
| 11339 |
+
A type `I` models `nothrow-bidirectional-iterator` only if no exceptions
|
| 11340 |
+
are thrown from decrementing valid iterators.
|
| 11341 |
+
|
| 11342 |
+
[*Note 5*: This concept allows some `bidirectional_iterator`
|
| 11343 |
+
[[iterator.concept.bidir]] operations to throw
|
| 11344 |
+
exceptions. — *end note*]
|
| 11345 |
+
|
| 11346 |
+
``` cpp
|
| 11347 |
+
template<class R>
|
| 11348 |
+
concept nothrow-bidirectional-range = // exposition only
|
| 11349 |
+
nothrow-forward-range<R> &&
|
| 11350 |
+
nothrow-bidirectional-iterator<iterator_t<R>>;
|
| 11351 |
+
```
|
| 11352 |
+
|
| 11353 |
+
``` cpp
|
| 11354 |
+
template<class I>
|
| 11355 |
+
concept nothrow-random-access-iterator = // exposition only
|
| 11356 |
+
nothrow-bidirectional-iterator<I> &&
|
| 11357 |
+
random_access_iterator<I> &&
|
| 11358 |
+
nothrow-sized-sentinel-for<I, I>;
|
| 11359 |
+
```
|
| 11360 |
+
|
| 11361 |
+
A type `I` models `nothrow-random-access-iterator` only if no exceptions
|
| 11362 |
+
are thrown from comparisons of valid iterators, or the `-`, `+`, `-=`,
|
| 11363 |
+
`+=`, `[]` operators on valid values of type `I` and
|
| 11364 |
+
`iter_difference_t<I>`.
|
| 11365 |
+
|
| 11366 |
+
[*Note 6*: This concept allows some `random_access_iterator`
|
| 11367 |
+
[[iterator.concept.random.access]] operations to throw
|
| 11368 |
+
exceptions. — *end note*]
|
| 11369 |
+
|
| 11370 |
+
``` cpp
|
| 11371 |
+
template<class R>
|
| 11372 |
+
concept nothrow-random-access-range = // exposition only
|
| 11373 |
+
nothrow-bidirectional-range<R> &&
|
| 11374 |
+
nothrow-random-access-iterator<iterator_t<R>>;
|
| 11375 |
+
|
| 11376 |
+
template<class R>
|
| 11377 |
+
concept nothrow-sized-random-access-range = // exposition only
|
| 11378 |
+
nothrow-random-access-range<R> && sized_range<R>;
|
| 11379 |
+
```
|
| 11380 |
+
|
| 11381 |
+
A type `R` models `nothrow-sized-random-access-range` only if no
|
| 11382 |
+
exceptions are thrown from the call to `ranges::size` on an object of
|
| 11383 |
+
type `R`.
|
| 11384 |
+
|
| 11385 |
### `uninitialized_default_construct` <a id="uninitialized.construct.default">[[uninitialized.construct.default]]</a>
|
| 11386 |
|
| 11387 |
``` cpp
|
| 11388 |
template<class NoThrowForwardIterator>
|
| 11389 |
+
constexpr void uninitialized_default_construct(NoThrowForwardIterator first,
|
| 11390 |
+
NoThrowForwardIterator last);
|
| 11391 |
```
|
| 11392 |
|
| 11393 |
*Effects:* Equivalent to:
|
| 11394 |
|
| 11395 |
``` cpp
|
| 11396 |
for (; first != last; ++first)
|
| 11397 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type;
|
|
|
|
| 11398 |
```
|
| 11399 |
|
| 11400 |
``` cpp
|
| 11401 |
namespace ranges {
|
| 11402 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 11403 |
requires default_initializable<iter_value_t<I>>
|
| 11404 |
+
constexpr I uninitialized_default_construct(I first, S last);
|
| 11405 |
template<nothrow-forward-range R>
|
| 11406 |
requires default_initializable<range_value_t<R>>
|
| 11407 |
+
constexpr borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
|
| 11408 |
}
|
| 11409 |
```
|
| 11410 |
|
| 11411 |
*Effects:* Equivalent to:
|
| 11412 |
|
|
|
|
| 11416 |
return first;
|
| 11417 |
```
|
| 11418 |
|
| 11419 |
``` cpp
|
| 11420 |
template<class NoThrowForwardIterator, class Size>
|
| 11421 |
+
constexpr NoThrowForwardIterator
|
| 11422 |
+
uninitialized_default_construct_n(NoThrowForwardIterator first, Size n);
|
| 11423 |
```
|
| 11424 |
|
| 11425 |
*Effects:* Equivalent to:
|
| 11426 |
|
| 11427 |
``` cpp
|
| 11428 |
for (; n > 0; (void)++first, --n)
|
| 11429 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type;
|
|
|
|
| 11430 |
return first;
|
| 11431 |
```
|
| 11432 |
|
| 11433 |
``` cpp
|
| 11434 |
namespace ranges {
|
| 11435 |
template<nothrow-forward-iterator I>
|
| 11436 |
requires default_initializable<iter_value_t<I>>
|
| 11437 |
+
constexpr I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
|
| 11438 |
}
|
| 11439 |
```
|
| 11440 |
|
| 11441 |
*Effects:* Equivalent to:
|
| 11442 |
|
|
|
|
| 11447 |
|
| 11448 |
### `uninitialized_value_construct` <a id="uninitialized.construct.value">[[uninitialized.construct.value]]</a>
|
| 11449 |
|
| 11450 |
``` cpp
|
| 11451 |
template<class NoThrowForwardIterator>
|
| 11452 |
+
constexpr void uninitialized_value_construct(NoThrowForwardIterator first,
|
| 11453 |
+
NoThrowForwardIterator last);
|
| 11454 |
```
|
| 11455 |
|
| 11456 |
*Effects:* Equivalent to:
|
| 11457 |
|
| 11458 |
``` cpp
|
| 11459 |
for (; first != last; ++first)
|
| 11460 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type();
|
|
|
|
| 11461 |
```
|
| 11462 |
|
| 11463 |
``` cpp
|
| 11464 |
namespace ranges {
|
| 11465 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 11466 |
requires default_initializable<iter_value_t<I>>
|
| 11467 |
+
constexpr I uninitialized_value_construct(I first, S last);
|
| 11468 |
template<nothrow-forward-range R>
|
| 11469 |
requires default_initializable<range_value_t<R>>
|
| 11470 |
+
constexpr borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
|
| 11471 |
}
|
| 11472 |
```
|
| 11473 |
|
| 11474 |
*Effects:* Equivalent to:
|
| 11475 |
|
|
|
|
| 11479 |
return first;
|
| 11480 |
```
|
| 11481 |
|
| 11482 |
``` cpp
|
| 11483 |
template<class NoThrowForwardIterator, class Size>
|
| 11484 |
+
constexpr NoThrowForwardIterator
|
| 11485 |
+
uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
|
| 11486 |
```
|
| 11487 |
|
| 11488 |
*Effects:* Equivalent to:
|
| 11489 |
|
| 11490 |
``` cpp
|
| 11491 |
for (; n > 0; (void)++first, --n)
|
| 11492 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type();
|
|
|
|
| 11493 |
return first;
|
| 11494 |
```
|
| 11495 |
|
| 11496 |
``` cpp
|
| 11497 |
namespace ranges {
|
| 11498 |
template<nothrow-forward-iterator I>
|
| 11499 |
requires default_initializable<iter_value_t<I>>
|
| 11500 |
+
constexpr I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
|
| 11501 |
}
|
| 11502 |
```
|
| 11503 |
|
| 11504 |
*Effects:* Equivalent to:
|
| 11505 |
|
|
|
|
| 11510 |
|
| 11511 |
### `uninitialized_copy` <a id="uninitialized.copy">[[uninitialized.copy]]</a>
|
| 11512 |
|
| 11513 |
``` cpp
|
| 11514 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 11515 |
+
constexpr NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
|
| 11516 |
NoThrowForwardIterator result);
|
| 11517 |
```
|
| 11518 |
|
| 11519 |
*Preconditions:* `result`+\[0, `(last - first)`) does not overlap with
|
| 11520 |
\[`first`, `last`).
|
| 11521 |
|
| 11522 |
*Effects:* Equivalent to:
|
| 11523 |
|
| 11524 |
``` cpp
|
| 11525 |
for (; first != last; ++result, (void)++first)
|
| 11526 |
+
::new (voidify(*result)) iterator_traits<NoThrowForwardIterator>::value_type(*first);
|
|
|
|
| 11527 |
```
|
| 11528 |
|
| 11529 |
*Returns:* `result`.
|
| 11530 |
|
| 11531 |
``` cpp
|
| 11532 |
namespace ranges {
|
| 11533 |
template<input_iterator I, sentinel_for<I> S1,
|
| 11534 |
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 11535 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 11536 |
+
constexpr uninitialized_copy_result<I, O>
|
| 11537 |
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
|
| 11538 |
template<input_range IR, nothrow-forward-range OR>
|
| 11539 |
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
|
| 11540 |
+
constexpr uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 11541 |
uninitialized_copy(IR&& in_range, OR&& out_range);
|
| 11542 |
}
|
| 11543 |
```
|
| 11544 |
|
| 11545 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
|
|
|
|
| 11553 |
return {std::move(ifirst), ofirst};
|
| 11554 |
```
|
| 11555 |
|
| 11556 |
``` cpp
|
| 11557 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 11558 |
+
constexpr NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
|
| 11559 |
NoThrowForwardIterator result);
|
| 11560 |
```
|
| 11561 |
|
| 11562 |
*Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
|
| 11563 |
`n`).
|
| 11564 |
|
| 11565 |
*Effects:* Equivalent to:
|
| 11566 |
|
| 11567 |
``` cpp
|
| 11568 |
for (; n > 0; ++result, (void)++first, --n)
|
| 11569 |
+
::new (voidify(*result)) iterator_traits<NoThrowForwardIterator>::value_type(*first);
|
|
|
|
| 11570 |
```
|
| 11571 |
|
| 11572 |
*Returns:* `result`.
|
| 11573 |
|
| 11574 |
``` cpp
|
| 11575 |
namespace ranges {
|
| 11576 |
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 11577 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 11578 |
+
constexpr uninitialized_copy_n_result<I, O>
|
| 11579 |
uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
|
| 11580 |
}
|
| 11581 |
```
|
| 11582 |
|
| 11583 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with
|
|
|
|
| 11593 |
|
| 11594 |
### `uninitialized_move` <a id="uninitialized.move">[[uninitialized.move]]</a>
|
| 11595 |
|
| 11596 |
``` cpp
|
| 11597 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 11598 |
+
constexpr NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last,
|
| 11599 |
NoThrowForwardIterator result);
|
| 11600 |
```
|
| 11601 |
|
| 11602 |
*Preconditions:* `result`+\[0, `(last - first)`) does not overlap with
|
| 11603 |
\[`first`, `last`).
|
|
|
|
| 11605 |
*Effects:* Equivalent to:
|
| 11606 |
|
| 11607 |
``` cpp
|
| 11608 |
for (; first != last; (void)++result, ++first)
|
| 11609 |
::new (voidify(*result))
|
| 11610 |
+
iterator_traits<NoThrowForwardIterator>::value_type(deref-move(first));
|
| 11611 |
return result;
|
| 11612 |
```
|
| 11613 |
|
| 11614 |
``` cpp
|
| 11615 |
namespace ranges {
|
| 11616 |
template<input_iterator I, sentinel_for<I> S1,
|
| 11617 |
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 11618 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 11619 |
+
constexpr uninitialized_move_result<I, O>
|
| 11620 |
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
|
| 11621 |
template<input_range IR, nothrow-forward-range OR>
|
| 11622 |
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
|
| 11623 |
+
constexpr uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 11624 |
uninitialized_move(IR&& in_range, OR&& out_range);
|
| 11625 |
}
|
| 11626 |
```
|
| 11627 |
|
| 11628 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with \[`ifirst`,
|
|
|
|
| 11641 |
\[`ifirst`, `ilast`) are left in a valid, but unspecified
|
| 11642 |
state. — *end note*]
|
| 11643 |
|
| 11644 |
``` cpp
|
| 11645 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 11646 |
+
constexpr pair<InputIterator, NoThrowForwardIterator>
|
| 11647 |
uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
|
| 11648 |
```
|
| 11649 |
|
| 11650 |
*Preconditions:* `result`+\[0, `n`) does not overlap with `first`+\[0,
|
| 11651 |
`n`).
|
|
|
|
| 11653 |
*Effects:* Equivalent to:
|
| 11654 |
|
| 11655 |
``` cpp
|
| 11656 |
for (; n > 0; ++result, (void)++first, --n)
|
| 11657 |
::new (voidify(*result))
|
| 11658 |
+
iterator_traits<NoThrowForwardIterator>::value_type(deref-move(first));
|
| 11659 |
return {first, result};
|
| 11660 |
```
|
| 11661 |
|
| 11662 |
``` cpp
|
| 11663 |
namespace ranges {
|
| 11664 |
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 11665 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 11666 |
+
constexpr uninitialized_move_n_result<I, O>
|
| 11667 |
uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
|
| 11668 |
}
|
| 11669 |
```
|
| 11670 |
|
| 11671 |
*Preconditions:* \[`ofirst`, `olast`) does not overlap with
|
|
|
|
| 11685 |
|
| 11686 |
### `uninitialized_fill` <a id="uninitialized.fill">[[uninitialized.fill]]</a>
|
| 11687 |
|
| 11688 |
``` cpp
|
| 11689 |
template<class NoThrowForwardIterator, class T>
|
| 11690 |
+
constexpr void uninitialized_fill(NoThrowForwardIterator first,
|
| 11691 |
+
NoThrowForwardIterator last, const T& x);
|
| 11692 |
```
|
| 11693 |
|
| 11694 |
*Effects:* Equivalent to:
|
| 11695 |
|
| 11696 |
``` cpp
|
| 11697 |
for (; first != last; ++first)
|
| 11698 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type(x);
|
|
|
|
| 11699 |
```
|
| 11700 |
|
| 11701 |
``` cpp
|
| 11702 |
namespace ranges {
|
| 11703 |
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S, class T>
|
| 11704 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 11705 |
+
constexpr I uninitialized_fill(I first, S last, const T& x);
|
| 11706 |
template<nothrow-forward-range R, class T>
|
| 11707 |
requires constructible_from<range_value_t<R>, const T&>
|
| 11708 |
+
constexpr borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
|
| 11709 |
}
|
| 11710 |
```
|
| 11711 |
|
| 11712 |
*Effects:* Equivalent to:
|
| 11713 |
|
|
|
|
| 11717 |
return first;
|
| 11718 |
```
|
| 11719 |
|
| 11720 |
``` cpp
|
| 11721 |
template<class NoThrowForwardIterator, class Size, class T>
|
| 11722 |
+
constexpr NoThrowForwardIterator
|
| 11723 |
+
uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x);
|
| 11724 |
```
|
| 11725 |
|
| 11726 |
*Effects:* Equivalent to:
|
| 11727 |
|
| 11728 |
``` cpp
|
| 11729 |
for (; n--; ++first)
|
| 11730 |
+
::new (voidify(*first)) iterator_traits<NoThrowForwardIterator>::value_type(x);
|
|
|
|
| 11731 |
return first;
|
| 11732 |
```
|
| 11733 |
|
| 11734 |
``` cpp
|
| 11735 |
namespace ranges {
|
| 11736 |
template<nothrow-forward-iterator I, class T>
|
| 11737 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 11738 |
+
constexpr I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
|
| 11739 |
}
|
| 11740 |
```
|
| 11741 |
|
| 11742 |
*Effects:* Equivalent to:
|
| 11743 |
|
|
|
|
| 11755 |
template<class T, class... Args>
|
| 11756 |
constexpr T* construct_at(T* location, Args&&... args);
|
| 11757 |
}
|
| 11758 |
```
|
| 11759 |
|
| 11760 |
+
*Constraints:* `is_unbounded_array_v<T>` is `false`. The expression
|
| 11761 |
`::new (declval<void*>()) T(declval<Args>()...)` is well-formed when
|
| 11762 |
treated as an unevaluated operand [[term.unevaluated.operand]].
|
| 11763 |
|
| 11764 |
+
*Mandates:* If `is_array_v<T>` is `true`, `sizeof...(Args)` is zero.
|
| 11765 |
+
|
| 11766 |
*Effects:* Equivalent to:
|
| 11767 |
|
| 11768 |
``` cpp
|
| 11769 |
+
if constexpr (is_array_v<T>)
|
| 11770 |
+
return ::new (voidify(*location)) T[1]();
|
| 11771 |
+
else
|
| 11772 |
return ::new (voidify(*location)) T(std::forward<Args>(args)...);
|
| 11773 |
```
|
| 11774 |
|
| 11775 |
### `destroy` <a id="specialized.destroy">[[specialized.destroy]]</a>
|
| 11776 |
|
|
|
|
| 11845 |
|
| 11846 |
``` cpp
|
| 11847 |
return destroy(counted_iterator(std::move(first), n), default_sentinel).base();
|
| 11848 |
```
|
| 11849 |
|
| 11850 |
+
## Specialized `<random>` algorithms <a id="alg.rand">[[alg.rand]]</a>
|
| 11851 |
+
|
| 11852 |
+
### General <a id="alg.rand.general">[[alg.rand.general]]</a>
|
| 11853 |
+
|
| 11854 |
+
The contents specified in [[alg.rand]] are declared in the header
|
| 11855 |
+
`<random>`.
|
| 11856 |
+
|
| 11857 |
+
### `generate_random` <a id="alg.rand.generate">[[alg.rand.generate]]</a>
|
| 11858 |
+
|
| 11859 |
+
``` cpp
|
| 11860 |
+
template<class R, class G>
|
| 11861 |
+
requires output_range<R, invoke_result_t<G&>> && uniform_random_bit_generator<remove_cvref_t<G>>
|
| 11862 |
+
constexpr borrowed_iterator_t<R> ranges::generate_random(R&& r, G&& g);
|
| 11863 |
+
```
|
| 11864 |
+
|
| 11865 |
+
*Effects:*
|
| 11866 |
+
|
| 11867 |
+
- Calls `g.generate_random(std::forward<R>(r))` if this expression is
|
| 11868 |
+
well-formed.
|
| 11869 |
+
- Otherwise, if `R` models `sized_range`, fills `r` with
|
| 11870 |
+
`ranges::size(r)` values of type `invoke_result_t<G&>` by performing
|
| 11871 |
+
an unspecified number of invocations of the form `g()` or
|
| 11872 |
+
`g.generate_random(s)`, if such an expression is well-formed for a
|
| 11873 |
+
value `N` and an object `s` of type `span<invoke_result_t<G&>, N>`.
|
| 11874 |
+
\[*Note 1*: Values of `N` can differ between
|
| 11875 |
+
invocations. — *end note*]
|
| 11876 |
+
- Otherwise, calls `ranges::generate(std::forward<R>(r), ref(g))`.
|
| 11877 |
+
|
| 11878 |
+
*Returns:* `ranges::end(r)`.
|
| 11879 |
+
|
| 11880 |
+
*Remarks:* The effects of `generate_random(r, g)` shall be equivalent to
|
| 11881 |
+
`ranges::generate(std::forward<R>(r), ref(g))`.
|
| 11882 |
+
|
| 11883 |
+
[*Note 1*: This implies that `g.generate_random(a)` fills `a` with the
|
| 11884 |
+
same values as produced by invocation of `g()`. — *end note*]
|
| 11885 |
+
|
| 11886 |
+
``` cpp
|
| 11887 |
+
template<class G, output_iterator<invoke_result_t<G&>> O, sentinel_for<O> S>
|
| 11888 |
+
requires uniform_random_bit_generator<remove_cvref_t<G>>
|
| 11889 |
+
constexpr O ranges::generate_random(O first, S last, G&& g);
|
| 11890 |
+
```
|
| 11891 |
+
|
| 11892 |
+
*Effects:* Equivalent to:
|
| 11893 |
+
|
| 11894 |
+
``` cpp
|
| 11895 |
+
return generate_random(subrange<O, S>(std::move(first), last), g);
|
| 11896 |
+
```
|
| 11897 |
+
|
| 11898 |
+
``` cpp
|
| 11899 |
+
template<class R, class G, class D>
|
| 11900 |
+
requires output_range<R, invoke_result_t<D&, G&>> && invocable<D&, G&> &&
|
| 11901 |
+
uniform_random_bit_generator<remove_cvref_t<G>> &&
|
| 11902 |
+
is_arithmetic_v<invoke_result_t<D&, G&>>
|
| 11903 |
+
constexpr borrowed_iterator_t<R> ranges::generate_random(R&& r, G&& g, D&& d);
|
| 11904 |
+
```
|
| 11905 |
+
|
| 11906 |
+
*Effects:*
|
| 11907 |
+
|
| 11908 |
+
- Calls `d.generate_random(std::forward<R>(r), g)` if this expression is
|
| 11909 |
+
well-formed.
|
| 11910 |
+
- Otherwise, if `R` models `sized_range`, fills `r` with
|
| 11911 |
+
`ranges::size(r)` values of type `invoke_result_t<D&, G&>` by
|
| 11912 |
+
performing an unspecified number of invocations of the form
|
| 11913 |
+
`invoke(d, g)` or `d.generate_random(s, g)`, if such an expression is
|
| 11914 |
+
well-formed for a value `N` and an object `s` of type
|
| 11915 |
+
`span<invoke_result_t<D&, G&>, N>`. \[*Note 2*: Values of N can differ
|
| 11916 |
+
between invocations. — *end note*]
|
| 11917 |
+
- Otherwise, calls
|
| 11918 |
+
``` cpp
|
| 11919 |
+
ranges::generate(std::forward<R>(r), [&d, &g] { return invoke(d, g); });
|
| 11920 |
+
```
|
| 11921 |
+
|
| 11922 |
+
*Returns:* `ranges::end(r)`.
|
| 11923 |
+
|
| 11924 |
+
*Remarks:* The effects of `generate_random(r, g, d)` shall be equivalent
|
| 11925 |
+
to
|
| 11926 |
+
|
| 11927 |
+
``` cpp
|
| 11928 |
+
ranges::generate(std::forward<R>(r), [&d, &g] { return invoke(d, g); })
|
| 11929 |
+
```
|
| 11930 |
+
|
| 11931 |
+
[*Note 2*: This implies that `d.generate_random(a, g)` fills `a` with
|
| 11932 |
+
the values with the same random distribution as produced by invocation
|
| 11933 |
+
of `invoke(d, g)`. — *end note*]
|
| 11934 |
+
|
| 11935 |
+
``` cpp
|
| 11936 |
+
template<class G, class D, output_iterator<invoke_result_t<D&, G&>> O, sentinel_for<O> S>
|
| 11937 |
+
requires invocable<D&, G&> && uniform_random_bit_generator<remove_cvref_t<G>> &&
|
| 11938 |
+
is_arithmetic_v<invoke_result_t<D&, G&>>
|
| 11939 |
+
constexpr O ranges::generate_random(O first, S last, G&& g, D&& d);
|
| 11940 |
+
```
|
| 11941 |
+
|
| 11942 |
+
*Effects:* Equivalent to:
|
| 11943 |
+
|
| 11944 |
+
``` cpp
|
| 11945 |
+
return generate_random(subrange<O, S>(std::move(first), last), g, d);
|
| 11946 |
+
```
|
| 11947 |
+
|
| 11948 |
## C library algorithms <a id="alg.c.library">[[alg.c.library]]</a>
|
| 11949 |
|
| 11950 |
[*Note 1*: The header `<cstdlib>` declares the functions described in
|
| 11951 |
this subclause. — *end note*]
|
| 11952 |
|
| 11953 |
``` cpp
|
| 11954 |
+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
|
| 11955 |
c-compare-pred* compar);
|
| 11956 |
+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
|
| 11957 |
+
compare-pred* compar);
|
| 11958 |
+
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 11959 |
+
c-compare-pred* compar);
|
| 11960 |
+
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 11961 |
compare-pred* compar);
|
| 11962 |
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
|
| 11963 |
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
|
| 11964 |
```
|
| 11965 |
|
|
|
|
| 11970 |
standard library.
|
| 11971 |
|
| 11972 |
*Throws:* Any exception thrown by `compar`
|
| 11973 |
[[res.on.exception.handling]].
|
| 11974 |
|
| 11975 |
+
See also: ISO C 7.24.6
|
| 11976 |
|
| 11977 |
<!-- Link reference definitions -->
|
| 11978 |
[accumulate]: #accumulate
|
| 11979 |
[adjacent.difference]: #adjacent.difference
|
| 11980 |
[alg.adjacent.find]: #alg.adjacent.find
|
|
|
|
| 11994 |
[alg.find.end]: #alg.find.end
|
| 11995 |
[alg.find.first.of]: #alg.find.first.of
|
| 11996 |
[alg.find.last]: #alg.find.last
|
| 11997 |
[alg.fold]: #alg.fold
|
| 11998 |
[alg.foreach]: #alg.foreach
|
| 11999 |
+
[alg.func.obj]: library.md#alg.func.obj
|
| 12000 |
[alg.generate]: #alg.generate
|
| 12001 |
[alg.heap.operations]: #alg.heap.operations
|
| 12002 |
[alg.heap.operations.general]: #alg.heap.operations.general
|
| 12003 |
[alg.is.permutation]: #alg.is.permutation
|
| 12004 |
[alg.lex.comparison]: #alg.lex.comparison
|
| 12005 |
[alg.merge]: #alg.merge
|
| 12006 |
[alg.min.max]: #alg.min.max
|
| 12007 |
+
[alg.mismatch]: #alg.mismatch
|
| 12008 |
[alg.modifying.operations]: #alg.modifying.operations
|
| 12009 |
[alg.move]: #alg.move
|
| 12010 |
[alg.none.of]: #alg.none.of
|
| 12011 |
[alg.nonmodifying]: #alg.nonmodifying
|
| 12012 |
[alg.nth.element]: #alg.nth.element
|
| 12013 |
[alg.partitions]: #alg.partitions
|
| 12014 |
[alg.permutation.generators]: #alg.permutation.generators
|
| 12015 |
+
[alg.rand]: #alg.rand
|
| 12016 |
+
[alg.rand.general]: #alg.rand.general
|
| 12017 |
+
[alg.rand.generate]: #alg.rand.generate
|
| 12018 |
[alg.random.sample]: #alg.random.sample
|
| 12019 |
[alg.random.shuffle]: #alg.random.shuffle
|
| 12020 |
[alg.remove]: #alg.remove
|
| 12021 |
[alg.replace]: #alg.replace
|
| 12022 |
[alg.reverse]: #alg.reverse
|
|
|
|
| 12044 |
[algorithms.parallel.overloads]: #algorithms.parallel.overloads
|
| 12045 |
[algorithms.parallel.user]: #algorithms.parallel.user
|
| 12046 |
[algorithms.requirements]: #algorithms.requirements
|
| 12047 |
[algorithms.results]: #algorithms.results
|
| 12048 |
[algorithms.summary]: #algorithms.summary
|
| 12049 |
+
[atomics.order]: thread.md#atomics.order
|
| 12050 |
[basic.compound]: basic.md#basic.compound
|
| 12051 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 12052 |
+
[basic.life]: basic.md#basic.life
|
| 12053 |
[bidirectional.iterators]: iterators.md#bidirectional.iterators
|
| 12054 |
[binary.search]: #binary.search
|
| 12055 |
[class.conv]: class.md#class.conv
|
| 12056 |
[concept.booleantestable]: concepts.md#concept.booleantestable
|
| 12057 |
[containers]: containers.md#containers
|
|
|
|
| 12060 |
[cpp17.copyconstructible]: #cpp17.copyconstructible
|
| 12061 |
[cpp17.lessthancomparable]: #cpp17.lessthancomparable
|
| 12062 |
[cpp17.moveassignable]: #cpp17.moveassignable
|
| 12063 |
[cpp17.moveconstructible]: #cpp17.moveconstructible
|
| 12064 |
[equal.range]: #equal.range
|
| 12065 |
+
[except.terminate]: except.md#except.terminate
|
| 12066 |
[exclusive.scan]: #exclusive.scan
|
| 12067 |
+
[execpol]: #execpol
|
| 12068 |
+
[execpol.general]: #execpol.general
|
| 12069 |
+
[execpol.objects]: #execpol.objects
|
| 12070 |
+
[execpol.par]: #execpol.par
|
| 12071 |
+
[execpol.parunseq]: #execpol.parunseq
|
| 12072 |
+
[execpol.seq]: #execpol.seq
|
| 12073 |
+
[execpol.type]: #execpol.type
|
| 12074 |
+
[execpol.unseq]: #execpol.unseq
|
| 12075 |
+
[expr.const]: expr.md#expr.const
|
| 12076 |
[expr.new]: expr.md#expr.new
|
| 12077 |
[forward.iterators]: iterators.md#forward.iterators
|
| 12078 |
[function.objects]: utilities.md#function.objects
|
| 12079 |
[includes]: #includes
|
| 12080 |
[inclusive.scan]: #inclusive.scan
|
| 12081 |
[inner.product]: #inner.product
|
| 12082 |
[input.iterators]: iterators.md#input.iterators
|
| 12083 |
[intro.execution]: basic.md#intro.execution
|
| 12084 |
+
[intro.object]: basic.md#intro.object
|
| 12085 |
[intro.progress]: basic.md#intro.progress
|
| 12086 |
[is.heap]: #is.heap
|
| 12087 |
[is.sorted]: #is.sorted
|
| 12088 |
[iterator.concept.bidir]: iterators.md#iterator.concept.bidir
|
| 12089 |
[iterator.concept.forward]: iterators.md#iterator.concept.forward
|
|
|
|
| 12093 |
[iterator.concept.sizedsentinel]: iterators.md#iterator.concept.sizedsentinel
|
| 12094 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 12095 |
[iterator.requirements.general]: iterators.md#iterator.requirements.general
|
| 12096 |
[lower.bound]: #lower.bound
|
| 12097 |
[make.heap]: #make.heap
|
|
|
|
| 12098 |
[multiset]: containers.md#multiset
|
| 12099 |
[numeric.iota]: #numeric.iota
|
| 12100 |
[numeric.ops]: #numeric.ops
|
| 12101 |
[numeric.ops.gcd]: #numeric.ops.gcd
|
| 12102 |
[numeric.ops.general]: #numeric.ops.general
|
| 12103 |
[numeric.ops.lcm]: #numeric.ops.lcm
|
| 12104 |
[numeric.ops.midpoint]: #numeric.ops.midpoint
|
| 12105 |
[numeric.ops.overview]: #numeric.ops.overview
|
| 12106 |
+
[numeric.sat]: #numeric.sat
|
| 12107 |
+
[numeric.sat.cast]: #numeric.sat.cast
|
| 12108 |
+
[numeric.sat.func]: #numeric.sat.func
|
| 12109 |
[numerics.defns]: #numerics.defns
|
| 12110 |
[output.iterators]: iterators.md#output.iterators
|
| 12111 |
[partial.sort]: #partial.sort
|
| 12112 |
[partial.sort.copy]: #partial.sort.copy
|
| 12113 |
[partial.sum]: #partial.sum
|
|
|
|
| 12130 |
[specialized.algorithms.general]: #specialized.algorithms.general
|
| 12131 |
[specialized.construct]: #specialized.construct
|
| 12132 |
[specialized.destroy]: #specialized.destroy
|
| 12133 |
[stable.sort]: #stable.sort
|
| 12134 |
[swappable.requirements]: library.md#swappable.requirements
|
|
|
|
| 12135 |
[term.unevaluated.operand]: expr.md#term.unevaluated.operand
|
| 12136 |
[thread.jthread.class]: thread.md#thread.jthread.class
|
| 12137 |
[thread.thread.class]: thread.md#thread.thread.class
|
| 12138 |
[transform.exclusive.scan]: #transform.exclusive.scan
|
| 12139 |
[transform.inclusive.scan]: #transform.inclusive.scan
|