tmp/tmp5xiasnhd/{from.md → to.md}
RENAMED
|
@@ -14,12 +14,12 @@ those of `next(i, n)` and `prev(i, n)`, respectively. For `merge` and
|
|
| 14 |
from one list to another. The behavior of splice operations is undefined
|
| 15 |
if `get_allocator() !=
|
| 16 |
x.get_allocator()`.
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
-
void splice(const_iterator position, list& x);
|
| 20 |
-
void splice(const_iterator position, list&& x);
|
| 21 |
```
|
| 22 |
|
| 23 |
*Preconditions:* `addressof(x) != this` is `true`.
|
| 24 |
|
| 25 |
*Effects:* Inserts the contents of `x` before `position` and `x` becomes
|
|
@@ -31,12 +31,12 @@ now behave as iterators into `*this`, not into `x`.
|
|
| 31 |
*Throws:* Nothing.
|
| 32 |
|
| 33 |
*Complexity:* Constant time.
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
-
void splice(const_iterator position, list& x, const_iterator i);
|
| 37 |
-
void splice(const_iterator position, list&& x, const_iterator i);
|
| 38 |
```
|
| 39 |
|
| 40 |
*Preconditions:* `i` is a valid dereferenceable iterator of `x`.
|
| 41 |
|
| 42 |
*Effects:* Inserts an element pointed to by `i` from list `x` before
|
|
@@ -49,18 +49,18 @@ element, but now behave as iterators into `*this`, not into `x`.
|
|
| 49 |
*Throws:* Nothing.
|
| 50 |
|
| 51 |
*Complexity:* Constant time.
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
-
void splice(const_iterator position, list& x,
|
| 55 |
-
|
| 56 |
-
void splice(const_iterator position, list&& x,
|
| 57 |
-
|
| 58 |
```
|
| 59 |
|
| 60 |
-
*Preconditions:*
|
| 61 |
-
not an iterator in the range \[`first`, `last`).
|
| 62 |
|
| 63 |
*Effects:* Inserts elements in the range \[`first`, `last`) before
|
| 64 |
`position` and removes the elements from `x`. Pointers and references to
|
| 65 |
the moved elements of `x` now refer to those same elements but as
|
| 66 |
members of `*this`. Iterators referring to the moved elements will
|
|
@@ -71,12 +71,12 @@ into `*this`, not into `x`.
|
|
| 71 |
|
| 72 |
*Complexity:* Constant time if `addressof(x) == this`; otherwise, linear
|
| 73 |
time.
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
-
size_type remove(const T& value);
|
| 77 |
-
template<class Predicate> size_type remove_if(Predicate pred);
|
| 78 |
```
|
| 79 |
|
| 80 |
*Effects:* Erases all the elements in the list referred to by a list
|
| 81 |
iterator `i` for which the following conditions hold: `*i == value`,
|
| 82 |
`pred(*i) != false`. Invalidates only the iterators and references to
|
|
@@ -91,12 +91,12 @@ the erased elements.
|
|
| 91 |
predicate.
|
| 92 |
|
| 93 |
*Remarks:* Stable [[algorithm.stable]].
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
-
size_type unique();
|
| 97 |
-
template<class BinaryPredicate> size_type unique(BinaryPredicate binary_pred);
|
| 98 |
```
|
| 99 |
|
| 100 |
Let `binary_pred` be `equal_to<>{}` for the first overload.
|
| 101 |
|
| 102 |
*Preconditions:* `binary_pred` is an equivalence relation.
|
|
@@ -114,14 +114,14 @@ only the iterators and references to the erased elements.
|
|
| 114 |
*Complexity:* If `empty()` is `false`, exactly `size() - 1` applications
|
| 115 |
of the corresponding predicate, otherwise no applications of the
|
| 116 |
predicate.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
-
void merge(list& x);
|
| 120 |
-
void merge(list&& x);
|
| 121 |
-
template<class Compare> void merge(list& x, Compare comp);
|
| 122 |
-
template<class Compare> void merge(list&& x, Compare comp);
|
| 123 |
```
|
| 124 |
|
| 125 |
Let `comp` be `less<>` for the first two overloads.
|
| 126 |
|
| 127 |
*Preconditions:* `*this` and `x` are both sorted with respect to the
|
|
@@ -138,14 +138,14 @@ elements, but they now behave as iterators into `*this`, not into `x`.
|
|
| 138 |
*Complexity:* At most `size() + x.size() - 1` comparisons if
|
| 139 |
`addressof(x) != this`; otherwise, no comparisons are performed.
|
| 140 |
|
| 141 |
*Remarks:* Stable [[algorithm.stable]]. If `addressof(x) != this`, `x`
|
| 142 |
is empty after the merge. No elements are copied by this operation. If
|
| 143 |
-
an exception is thrown other than by a comparison there are no effects.
|
| 144 |
|
| 145 |
``` cpp
|
| 146 |
-
void reverse() noexcept;
|
| 147 |
```
|
| 148 |
|
| 149 |
*Effects:* Reverses the order of the elements in the list. Does not
|
| 150 |
affect the validity of iterators and references.
|
| 151 |
|
|
@@ -159,9 +159,9 @@ template<class Compare> void sort(Compare comp);
|
|
| 159 |
*Effects:* Sorts the list according to the `operator<` or a `Compare`
|
| 160 |
function object. If an exception is thrown, the order of the elements in
|
| 161 |
`*this` is unspecified. Does not affect the validity of iterators and
|
| 162 |
references.
|
| 163 |
|
| 164 |
-
*Complexity:* Approximately N log N comparisons, where
|
| 165 |
|
| 166 |
*Remarks:* Stable [[algorithm.stable]].
|
| 167 |
|
|
|
|
| 14 |
from one list to another. The behavior of splice operations is undefined
|
| 15 |
if `get_allocator() !=
|
| 16 |
x.get_allocator()`.
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
+
constexpr void splice(const_iterator position, list& x);
|
| 20 |
+
constexpr void splice(const_iterator position, list&& x);
|
| 21 |
```
|
| 22 |
|
| 23 |
*Preconditions:* `addressof(x) != this` is `true`.
|
| 24 |
|
| 25 |
*Effects:* Inserts the contents of `x` before `position` and `x` becomes
|
|
|
|
| 31 |
*Throws:* Nothing.
|
| 32 |
|
| 33 |
*Complexity:* Constant time.
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
+
constexpr void splice(const_iterator position, list& x, const_iterator i);
|
| 37 |
+
constexpr void splice(const_iterator position, list&& x, const_iterator i);
|
| 38 |
```
|
| 39 |
|
| 40 |
*Preconditions:* `i` is a valid dereferenceable iterator of `x`.
|
| 41 |
|
| 42 |
*Effects:* Inserts an element pointed to by `i` from list `x` before
|
|
|
|
| 49 |
*Throws:* Nothing.
|
| 50 |
|
| 51 |
*Complexity:* Constant time.
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
+
constexpr void splice(const_iterator position, list& x,
|
| 55 |
+
const_iterator first, const_iterator last);
|
| 56 |
+
constexpr void splice(const_iterator position, list&& x,
|
| 57 |
+
const_iterator first, const_iterator last);
|
| 58 |
```
|
| 59 |
|
| 60 |
+
*Preconditions:* \[`first`, `last`) is a valid range in `x`. `position`
|
| 61 |
+
is not an iterator in the range \[`first`, `last`).
|
| 62 |
|
| 63 |
*Effects:* Inserts elements in the range \[`first`, `last`) before
|
| 64 |
`position` and removes the elements from `x`. Pointers and references to
|
| 65 |
the moved elements of `x` now refer to those same elements but as
|
| 66 |
members of `*this`. Iterators referring to the moved elements will
|
|
|
|
| 71 |
|
| 72 |
*Complexity:* Constant time if `addressof(x) == this`; otherwise, linear
|
| 73 |
time.
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
+
constexpr size_type remove(const T& value);
|
| 77 |
+
template<class Predicate> constexpr size_type remove_if(Predicate pred);
|
| 78 |
```
|
| 79 |
|
| 80 |
*Effects:* Erases all the elements in the list referred to by a list
|
| 81 |
iterator `i` for which the following conditions hold: `*i == value`,
|
| 82 |
`pred(*i) != false`. Invalidates only the iterators and references to
|
|
|
|
| 91 |
predicate.
|
| 92 |
|
| 93 |
*Remarks:* Stable [[algorithm.stable]].
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
+
constexpr size_type unique();
|
| 97 |
+
template<class BinaryPredicate> constexpr size_type unique(BinaryPredicate binary_pred);
|
| 98 |
```
|
| 99 |
|
| 100 |
Let `binary_pred` be `equal_to<>{}` for the first overload.
|
| 101 |
|
| 102 |
*Preconditions:* `binary_pred` is an equivalence relation.
|
|
|
|
| 114 |
*Complexity:* If `empty()` is `false`, exactly `size() - 1` applications
|
| 115 |
of the corresponding predicate, otherwise no applications of the
|
| 116 |
predicate.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
+
constexpr void merge(list& x);
|
| 120 |
+
constexpr void merge(list&& x);
|
| 121 |
+
template<class Compare> constexpr void merge(list& x, Compare comp);
|
| 122 |
+
template<class Compare> constexpr void merge(list&& x, Compare comp);
|
| 123 |
```
|
| 124 |
|
| 125 |
Let `comp` be `less<>` for the first two overloads.
|
| 126 |
|
| 127 |
*Preconditions:* `*this` and `x` are both sorted with respect to the
|
|
|
|
| 138 |
*Complexity:* At most `size() + x.size() - 1` comparisons if
|
| 139 |
`addressof(x) != this`; otherwise, no comparisons are performed.
|
| 140 |
|
| 141 |
*Remarks:* Stable [[algorithm.stable]]. If `addressof(x) != this`, `x`
|
| 142 |
is empty after the merge. No elements are copied by this operation. If
|
| 143 |
+
an exception is thrown other than by a comparison, there are no effects.
|
| 144 |
|
| 145 |
``` cpp
|
| 146 |
+
constexpr void reverse() noexcept;
|
| 147 |
```
|
| 148 |
|
| 149 |
*Effects:* Reverses the order of the elements in the list. Does not
|
| 150 |
affect the validity of iterators and references.
|
| 151 |
|
|
|
|
| 159 |
*Effects:* Sorts the list according to the `operator<` or a `Compare`
|
| 160 |
function object. If an exception is thrown, the order of the elements in
|
| 161 |
`*this` is unspecified. Does not affect the validity of iterators and
|
| 162 |
references.
|
| 163 |
|
| 164 |
+
*Complexity:* Approximately N log N comparisons, where N is `size()`.
|
| 165 |
|
| 166 |
*Remarks:* Stable [[algorithm.stable]].
|
| 167 |
|