tmp/tmpr8t6peve/{from.md → to.md}
RENAMED
|
@@ -1,51 +1,78 @@
|
|
| 1 |
### Unique <a id="alg.unique">[[alg.unique]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class ForwardIterator>
|
| 5 |
ForwardIterator unique(ForwardIterator first, ForwardIterator last);
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
template<class ForwardIterator, class BinaryPredicate>
|
| 8 |
ForwardIterator unique(ForwardIterator first, ForwardIterator last,
|
| 9 |
BinaryPredicate pred);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
```
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
*Effects:* For a nonempty range, eliminates all but the first element
|
| 13 |
from every consecutive group of equivalent elements referred to by the
|
| 14 |
iterator `i` in the range \[`first + 1`, `last`) for which the following
|
| 15 |
conditions hold: `*(i - 1) == *i` or `pred(*(i - 1), *i) != false`.
|
| 16 |
|
| 17 |
-
*Requires:* The comparison function shall be an equivalence relation.
|
| 18 |
-
The type of `*first` shall satisfy the `MoveAssignable` requirements
|
| 19 |
-
(Table [[moveassignable]]).
|
| 20 |
-
|
| 21 |
*Returns:* The end of the resulting range.
|
| 22 |
|
| 23 |
*Complexity:* For nonempty ranges, exactly `(last - first) - 1`
|
| 24 |
applications of the corresponding predicate.
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
template<class InputIterator, class OutputIterator>
|
| 28 |
OutputIterator
|
| 29 |
unique_copy(InputIterator first, InputIterator last,
|
| 30 |
OutputIterator result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
template<class InputIterator, class OutputIterator,
|
| 33 |
class BinaryPredicate>
|
| 34 |
OutputIterator
|
| 35 |
unique_copy(InputIterator first, InputIterator last,
|
| 36 |
OutputIterator result, BinaryPredicate pred);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
```
|
| 38 |
|
| 39 |
-
*Requires:*
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
*Effects:* Copies only the first element from every consecutive group of
|
| 49 |
equal elements referred to by the iterator `i` in the range \[`first`,
|
| 50 |
`last`) for which the following corresponding conditions hold:
|
| 51 |
`*i == *(i - 1)` or `pred(*i, *(i - 1)) != false`.
|
|
|
|
| 1 |
### Unique <a id="alg.unique">[[alg.unique]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class ForwardIterator>
|
| 5 |
ForwardIterator unique(ForwardIterator first, ForwardIterator last);
|
| 6 |
+
template<class ExecutionPolicy, class ForwardIterator>
|
| 7 |
+
ForwardIterator unique(ExecutionPolicy&& exec,
|
| 8 |
+
ForwardIterator first, ForwardIterator last);
|
| 9 |
|
| 10 |
template<class ForwardIterator, class BinaryPredicate>
|
| 11 |
ForwardIterator unique(ForwardIterator first, ForwardIterator last,
|
| 12 |
BinaryPredicate pred);
|
| 13 |
+
template<class ExecutionPolicy, class ForwardIterator, class BinaryPredicate>
|
| 14 |
+
ForwardIterator unique(ExecutionPolicy&& exec,
|
| 15 |
+
ForwardIterator first, ForwardIterator last,
|
| 16 |
+
BinaryPredicate pred);
|
| 17 |
```
|
| 18 |
|
| 19 |
+
*Requires:* The comparison function shall be an equivalence relation.
|
| 20 |
+
The type of `*first` shall satisfy the `MoveAssignable` requirements
|
| 21 |
+
(Table [[tab:moveassignable]]).
|
| 22 |
+
|
| 23 |
*Effects:* For a nonempty range, eliminates all but the first element
|
| 24 |
from every consecutive group of equivalent elements referred to by the
|
| 25 |
iterator `i` in the range \[`first + 1`, `last`) for which the following
|
| 26 |
conditions hold: `*(i - 1) == *i` or `pred(*(i - 1), *i) != false`.
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
*Returns:* The end of the resulting range.
|
| 29 |
|
| 30 |
*Complexity:* For nonempty ranges, exactly `(last - first) - 1`
|
| 31 |
applications of the corresponding predicate.
|
| 32 |
|
| 33 |
``` cpp
|
| 34 |
template<class InputIterator, class OutputIterator>
|
| 35 |
OutputIterator
|
| 36 |
unique_copy(InputIterator first, InputIterator last,
|
| 37 |
OutputIterator result);
|
| 38 |
+
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 39 |
+
ForwardIterator2
|
| 40 |
+
unique_copy(ExecutionPolicy&& exec,
|
| 41 |
+
ForwardIterator1 first, ForwardIterator1 last,
|
| 42 |
+
ForwardIterator2 result);
|
| 43 |
|
| 44 |
template<class InputIterator, class OutputIterator,
|
| 45 |
class BinaryPredicate>
|
| 46 |
OutputIterator
|
| 47 |
unique_copy(InputIterator first, InputIterator last,
|
| 48 |
OutputIterator result, BinaryPredicate pred);
|
| 49 |
+
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 50 |
+
class BinaryPredicate>
|
| 51 |
+
ForwardIterator2
|
| 52 |
+
unique_copy(ExecutionPolicy&& exec,
|
| 53 |
+
ForwardIterator1 first, ForwardIterator1 last,
|
| 54 |
+
ForwardIterator2 result, BinaryPredicate pred);
|
| 55 |
```
|
| 56 |
|
| 57 |
+
*Requires:*
|
| 58 |
+
|
| 59 |
+
- The comparison function shall be an equivalence relation.
|
| 60 |
+
- The ranges \[`first`, `last`) and \[`result`, `result+(last-first)`)
|
| 61 |
+
shall not overlap.
|
| 62 |
+
- The expression `*result = *first` shall be valid.
|
| 63 |
+
- For the overloads with no `ExecutionPolicy`, let `T` be the value type
|
| 64 |
+
of `InputIterator`. If `InputIterator` meets the forward iterator
|
| 65 |
+
requirements, then there are no additional requirements for `T`.
|
| 66 |
+
Otherwise, if `OutputIterator` meets the forward iterator requirements
|
| 67 |
+
and its value type is the same as `T`, then `T` shall be
|
| 68 |
+
`CopyAssignable` (Table [[tab:copyassignable]]). Otherwise, `T` shall
|
| 69 |
+
be both `CopyConstructible` (Table [[tab:copyconstructible]]) and
|
| 70 |
+
`CopyAssignable`. \[*Note 1*: For the overloads with an
|
| 71 |
+
`ExecutionPolicy`, there may be a performance cost if the value type
|
| 72 |
+
of `ForwardIterator1` is not both `CopyConstructible` and
|
| 73 |
+
`CopyAssignable`. — *end note*]
|
| 74 |
|
| 75 |
*Effects:* Copies only the first element from every consecutive group of
|
| 76 |
equal elements referred to by the iterator `i` in the range \[`first`,
|
| 77 |
`last`) for which the following corresponding conditions hold:
|
| 78 |
`*i == *(i - 1)` or `pred(*i, *(i - 1)) != false`.
|