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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Modifiers <a id="forward.list.modifiers">[[forward.list.modifiers]]</a>
|
| 2 |
+
|
| 3 |
+
None of the overloads of `insert_after` shall affect the validity of
|
| 4 |
+
iterators and references, and `erase_after` shall invalidate only
|
| 5 |
+
iterators and references to the erased elements. If an exception is
|
| 6 |
+
thrown during `insert_after` there shall be no effect. Inserting `n`
|
| 7 |
+
elements into a `forward_list` is linear in `n`, and the number of calls
|
| 8 |
+
to the copy or move constructor of `T` is exactly equal to `n`. Erasing
|
| 9 |
+
`n` elements from a `forward_list` is linear in `n` and the number of
|
| 10 |
+
calls to the destructor of type `T` is exactly equal to `n`.
|
| 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()`).
|
| 49 |
+
|
| 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()`).
|
| 61 |
+
|
| 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()`).
|
| 73 |
+
|
| 74 |
+
*Effects:* Inserts `n` copies of `x` after `position`.
|
| 75 |
+
|
| 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, InputIterator first, InputIterator last);
|
| 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`
|
| 87 |
+
are iterators in `*this`.
|
| 88 |
+
|
| 89 |
+
*Effects:* Inserts copies of elements in \[`first`, `last`) after
|
| 90 |
+
`position`.
|
| 91 |
+
|
| 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
|
| 103 |
+
`*this` do not overlap.
|
| 104 |
+
|
| 105 |
+
*Effects:* Inserts copies of elements in the range `rg` after
|
| 106 |
+
`position`.
|
| 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()`).
|
| 126 |
+
|
| 127 |
+
*Effects:* Inserts an object of type `value_type`
|
| 128 |
+
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
|
| 140 |
+
`position`.
|
| 141 |
+
|
| 142 |
+
*Returns:* An iterator pointing to the element following the one that
|
| 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 |
+
|
| 154 |
+
*Effects:* Erases the elements in the range (`position`, `last`).
|
| 155 |
+
|
| 156 |
+
*Returns:* `last`.
|
| 157 |
+
|
| 158 |
+
*Throws:* Nothing.
|
| 159 |
+
|
| 160 |
+
``` cpp
|
| 161 |
+
void resize(size_type sz);
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `*this`.
|
| 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 `*this`.
|
| 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.
|
| 189 |
+
|