tmp/tmpdyhkwtgo/{from.md → to.md}
RENAMED
|
@@ -1,48 +1,49 @@
|
|
| 1 |
#### Modifiers <a id="forward.list.modifiers">[[forward.list.modifiers]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
iterators and references
|
| 5 |
-
iterators and references to the erased elements
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
-
template<class... Args> reference emplace_front(Args&&... args);
|
| 14 |
```
|
| 15 |
|
| 16 |
*Effects:* Inserts an object of type `value_type` constructed with
|
| 17 |
`value_type(std::forward<Args>(args)...)` at the beginning of the list.
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
-
void push_front(const T& x);
|
| 21 |
-
void push_front(T&& x);
|
| 22 |
```
|
| 23 |
|
| 24 |
*Effects:* Inserts a copy of `x` at the beginning of the list.
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
template<container-compatible-range<T> R>
|
| 28 |
-
void prepend_range(R&& rg);
|
| 29 |
```
|
| 30 |
|
| 31 |
*Effects:* Inserts a copy of each element of `rg` at the beginning of
|
| 32 |
the list.
|
| 33 |
|
| 34 |
[*Note 1*: The order of elements is not reversed. — *end note*]
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
-
void pop_front();
|
| 38 |
```
|
| 39 |
|
| 40 |
*Effects:* As if by `erase_after(before_begin())`.
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
-
iterator insert_after(const_iterator position, const T& x);
|
| 44 |
```
|
| 45 |
|
| 46 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `forward_list`.
|
| 47 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 48 |
range \[`begin()`, `end()`).
|
|
@@ -50,11 +51,11 @@ range \[`begin()`, `end()`).
|
|
| 50 |
*Effects:* Inserts a copy of `x` after `position`.
|
| 51 |
|
| 52 |
*Returns:* An iterator pointing to the copy of `x`.
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
-
iterator insert_after(const_iterator position, T&& x);
|
| 56 |
```
|
| 57 |
|
| 58 |
*Preconditions:* `T` is *Cpp17MoveInsertable* into `forward_list`.
|
| 59 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 60 |
range \[`begin()`, `end()`).
|
|
@@ -62,11 +63,11 @@ range \[`begin()`, `end()`).
|
|
| 62 |
*Effects:* Inserts a copy of `x` after `position`.
|
| 63 |
|
| 64 |
*Returns:* An iterator pointing to the copy of `x`.
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
-
iterator insert_after(const_iterator position, size_type n, const T& x);
|
| 68 |
```
|
| 69 |
|
| 70 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `forward_list`.
|
| 71 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 72 |
range \[`begin()`, `end()`).
|
|
@@ -76,11 +77,12 @@ range \[`begin()`, `end()`).
|
|
| 76 |
*Returns:* An iterator pointing to the last inserted copy of `x`, or
|
| 77 |
`position` if `n == 0` is `true`.
|
| 78 |
|
| 79 |
``` cpp
|
| 80 |
template<class InputIterator>
|
| 81 |
-
iterator insert_after(const_iterator position,
|
|
|
|
| 82 |
```
|
| 83 |
|
| 84 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 85 |
from `*first`. `position` is `before_begin()` or is a dereferenceable
|
| 86 |
iterator in the range \[`begin()`, `end()`). Neither `first` nor `last`
|
|
@@ -92,11 +94,11 @@ are iterators in `*this`.
|
|
| 92 |
*Returns:* An iterator pointing to the last inserted element, or
|
| 93 |
`position` if `first == last` is `true`.
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
template<container-compatible-range<T> R>
|
| 97 |
-
iterator insert_range_after(const_iterator position, R&& rg);
|
| 98 |
```
|
| 99 |
|
| 100 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 101 |
from `*ranges::begin(rg)`. `position` is `before_begin()` or is a
|
| 102 |
dereferenceable iterator in the range \[`begin()`, `end()`). `rg` and
|
|
@@ -107,19 +109,19 @@ dereferenceable iterator in the range \[`begin()`, `end()`). `rg` and
|
|
| 107 |
|
| 108 |
*Returns:* An iterator pointing to the last inserted element, or
|
| 109 |
`position` if `rg` is empty.
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
-
iterator insert_after(const_iterator position, initializer_list<T> il);
|
| 113 |
```
|
| 114 |
|
| 115 |
*Effects:* Equivalent to:
|
| 116 |
`return insert_after(position, il.begin(), il.end());`
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
template<class... Args>
|
| 120 |
-
iterator emplace_after(const_iterator position, Args&&... args);
|
| 121 |
```
|
| 122 |
|
| 123 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 124 |
from `std::forward<Args>(args)...`. `position` is `before_begin()` or is
|
| 125 |
a dereferenceable iterator in the range \[`begin()`, `end()`).
|
|
@@ -129,11 +131,11 @@ direct-non-list-initialized with `std::forward<Args>(args)...` after
|
|
| 129 |
`position`.
|
| 130 |
|
| 131 |
*Returns:* An iterator pointing to the new object.
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
-
iterator erase_after(const_iterator position);
|
| 135 |
```
|
| 136 |
|
| 137 |
*Preconditions:* The iterator following `position` is dereferenceable.
|
| 138 |
|
| 139 |
*Effects:* Erases the element pointed to by the iterator following
|
|
@@ -143,11 +145,11 @@ iterator erase_after(const_iterator position);
|
|
| 143 |
was erased, or `end()` if no such element exists.
|
| 144 |
|
| 145 |
*Throws:* Nothing.
|
| 146 |
|
| 147 |
``` cpp
|
| 148 |
-
iterator erase_after(const_iterator position, const_iterator last);
|
| 149 |
```
|
| 150 |
|
| 151 |
*Preconditions:* All iterators in the range (`position`, `last`) are
|
| 152 |
dereferenceable.
|
| 153 |
|
|
@@ -156,33 +158,33 @@ dereferenceable.
|
|
| 156 |
*Returns:* `last`.
|
| 157 |
|
| 158 |
*Throws:* Nothing.
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
-
void resize(size_type sz);
|
| 162 |
```
|
| 163 |
|
| 164 |
-
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `
|
| 165 |
|
| 166 |
*Effects:* If `sz < distance(begin(), end())`, erases the last
|
| 167 |
`distance(begin(), end()) - sz` elements from the list. Otherwise,
|
| 168 |
inserts `sz - distance(begin(), end())` default-inserted elements at the
|
| 169 |
end of the list.
|
| 170 |
|
| 171 |
``` cpp
|
| 172 |
-
void resize(size_type sz, const value_type& c);
|
| 173 |
```
|
| 174 |
|
| 175 |
-
*Preconditions:* `T` is *Cpp17CopyInsertable* into `
|
| 176 |
|
| 177 |
*Effects:* If `sz < distance(begin(), end())`, erases the last
|
| 178 |
`distance(begin(), end()) - sz` elements from the list. Otherwise,
|
| 179 |
inserts `sz - distance(begin(), end())` copies of `c` at the end of the
|
| 180 |
list.
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
-
void clear() noexcept;
|
| 184 |
```
|
| 185 |
|
| 186 |
*Effects:* Erases all elements in the range \[`begin()`, `end()`).
|
| 187 |
|
| 188 |
*Remarks:* Does not invalidate past-the-end iterators.
|
|
|
|
| 1 |
#### Modifiers <a id="forward.list.modifiers">[[forward.list.modifiers]]</a>
|
| 2 |
|
| 3 |
+
The member functions in this subclause do not affect the validity of
|
| 4 |
+
iterators and references when inserting elements, and when erasing
|
| 5 |
+
elements invalidate iterators and references to the erased elements
|
| 6 |
+
only. If an exception is thrown by any of these member functions there
|
| 7 |
+
is no effect on the container. Inserting `n` elements into a
|
| 8 |
+
`forward_list` is linear in `n`, and the number of calls to the copy or
|
| 9 |
+
move constructor of `T` is exactly equal to `n`. Erasing `n` elements
|
| 10 |
+
from a `forward_list` is linear in `n` and the number of calls to the
|
| 11 |
+
destructor of type `T` is exactly equal to `n`.
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
+
template<class... Args> constexpr reference emplace_front(Args&&... args);
|
| 15 |
```
|
| 16 |
|
| 17 |
*Effects:* Inserts an object of type `value_type` constructed with
|
| 18 |
`value_type(std::forward<Args>(args)...)` at the beginning of the list.
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
+
constexpr void push_front(const T& x);
|
| 22 |
+
constexpr void push_front(T&& x);
|
| 23 |
```
|
| 24 |
|
| 25 |
*Effects:* Inserts a copy of `x` at the beginning of the list.
|
| 26 |
|
| 27 |
``` cpp
|
| 28 |
template<container-compatible-range<T> R>
|
| 29 |
+
constexpr void prepend_range(R&& rg);
|
| 30 |
```
|
| 31 |
|
| 32 |
*Effects:* Inserts a copy of each element of `rg` at the beginning of
|
| 33 |
the list.
|
| 34 |
|
| 35 |
[*Note 1*: The order of elements is not reversed. — *end note*]
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
+
constexpr void pop_front();
|
| 39 |
```
|
| 40 |
|
| 41 |
*Effects:* As if by `erase_after(before_begin())`.
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
+
constexpr iterator insert_after(const_iterator position, const T& x);
|
| 45 |
```
|
| 46 |
|
| 47 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `forward_list`.
|
| 48 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 49 |
range \[`begin()`, `end()`).
|
|
|
|
| 51 |
*Effects:* Inserts a copy of `x` after `position`.
|
| 52 |
|
| 53 |
*Returns:* An iterator pointing to the copy of `x`.
|
| 54 |
|
| 55 |
``` cpp
|
| 56 |
+
constexpr iterator insert_after(const_iterator position, T&& x);
|
| 57 |
```
|
| 58 |
|
| 59 |
*Preconditions:* `T` is *Cpp17MoveInsertable* into `forward_list`.
|
| 60 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 61 |
range \[`begin()`, `end()`).
|
|
|
|
| 63 |
*Effects:* Inserts a copy of `x` after `position`.
|
| 64 |
|
| 65 |
*Returns:* An iterator pointing to the copy of `x`.
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
+
constexpr iterator insert_after(const_iterator position, size_type n, const T& x);
|
| 69 |
```
|
| 70 |
|
| 71 |
*Preconditions:* `T` is *Cpp17CopyInsertable* into `forward_list`.
|
| 72 |
`position` is `before_begin()` or is a dereferenceable iterator in the
|
| 73 |
range \[`begin()`, `end()`).
|
|
|
|
| 77 |
*Returns:* An iterator pointing to the last inserted copy of `x`, or
|
| 78 |
`position` if `n == 0` is `true`.
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
template<class InputIterator>
|
| 82 |
+
constexpr iterator insert_after(const_iterator position,
|
| 83 |
+
InputIterator first, InputIterator last);
|
| 84 |
```
|
| 85 |
|
| 86 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 87 |
from `*first`. `position` is `before_begin()` or is a dereferenceable
|
| 88 |
iterator in the range \[`begin()`, `end()`). Neither `first` nor `last`
|
|
|
|
| 94 |
*Returns:* An iterator pointing to the last inserted element, or
|
| 95 |
`position` if `first == last` is `true`.
|
| 96 |
|
| 97 |
``` cpp
|
| 98 |
template<container-compatible-range<T> R>
|
| 99 |
+
constexpr iterator insert_range_after(const_iterator position, R&& rg);
|
| 100 |
```
|
| 101 |
|
| 102 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 103 |
from `*ranges::begin(rg)`. `position` is `before_begin()` or is a
|
| 104 |
dereferenceable iterator in the range \[`begin()`, `end()`). `rg` and
|
|
|
|
| 109 |
|
| 110 |
*Returns:* An iterator pointing to the last inserted element, or
|
| 111 |
`position` if `rg` is empty.
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
+
constexpr iterator insert_after(const_iterator position, initializer_list<T> il);
|
| 115 |
```
|
| 116 |
|
| 117 |
*Effects:* Equivalent to:
|
| 118 |
`return insert_after(position, il.begin(), il.end());`
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
template<class... Args>
|
| 122 |
+
constexpr iterator emplace_after(const_iterator position, Args&&... args);
|
| 123 |
```
|
| 124 |
|
| 125 |
*Preconditions:* `T` is *Cpp17EmplaceConstructible* into `forward_list`
|
| 126 |
from `std::forward<Args>(args)...`. `position` is `before_begin()` or is
|
| 127 |
a dereferenceable iterator in the range \[`begin()`, `end()`).
|
|
|
|
| 131 |
`position`.
|
| 132 |
|
| 133 |
*Returns:* An iterator pointing to the new object.
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
+
constexpr iterator erase_after(const_iterator position);
|
| 137 |
```
|
| 138 |
|
| 139 |
*Preconditions:* The iterator following `position` is dereferenceable.
|
| 140 |
|
| 141 |
*Effects:* Erases the element pointed to by the iterator following
|
|
|
|
| 145 |
was erased, or `end()` if no such element exists.
|
| 146 |
|
| 147 |
*Throws:* Nothing.
|
| 148 |
|
| 149 |
``` cpp
|
| 150 |
+
constexpr iterator erase_after(const_iterator position, const_iterator last);
|
| 151 |
```
|
| 152 |
|
| 153 |
*Preconditions:* All iterators in the range (`position`, `last`) are
|
| 154 |
dereferenceable.
|
| 155 |
|
|
|
|
| 158 |
*Returns:* `last`.
|
| 159 |
|
| 160 |
*Throws:* Nothing.
|
| 161 |
|
| 162 |
``` cpp
|
| 163 |
+
constexpr void resize(size_type sz);
|
| 164 |
```
|
| 165 |
|
| 166 |
+
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `forward_list`.
|
| 167 |
|
| 168 |
*Effects:* If `sz < distance(begin(), end())`, erases the last
|
| 169 |
`distance(begin(), end()) - sz` elements from the list. Otherwise,
|
| 170 |
inserts `sz - distance(begin(), end())` default-inserted elements at the
|
| 171 |
end of the list.
|
| 172 |
|
| 173 |
``` cpp
|
| 174 |
+
constexpr void resize(size_type sz, const value_type& c);
|
| 175 |
```
|
| 176 |
|
| 177 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `forward_list`.
|
| 178 |
|
| 179 |
*Effects:* If `sz < distance(begin(), end())`, erases the last
|
| 180 |
`distance(begin(), end()) - sz` elements from the list. Otherwise,
|
| 181 |
inserts `sz - distance(begin(), end())` copies of `c` at the end of the
|
| 182 |
list.
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
+
constexpr void clear() noexcept;
|
| 186 |
```
|
| 187 |
|
| 188 |
*Effects:* Erases all elements in the range \[`begin()`, `end()`).
|
| 189 |
|
| 190 |
*Remarks:* Does not invalidate past-the-end iterators.
|