tmp/tmp7knrnk1d/{from.md → to.md}
RENAMED
|
@@ -1,26 +1,28 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
void resize(size_type sz);
|
| 5 |
```
|
| 6 |
|
|
|
|
|
|
|
| 7 |
*Effects:* If `size() < sz`, appends `sz - size()` default-inserted
|
| 8 |
elements to the sequence. If `sz <= size()`, equivalent to:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
list<T>::iterator it = begin();
|
| 12 |
advance(it, sz);
|
| 13 |
erase(it, end());
|
| 14 |
```
|
| 15 |
|
| 16 |
-
*Requires:* `T` shall be `DefaultInsertable` into `*this`.
|
| 17 |
-
|
| 18 |
``` cpp
|
| 19 |
void resize(size_type sz, const T& c);
|
| 20 |
```
|
| 21 |
|
|
|
|
|
|
|
| 22 |
*Effects:* As if by:
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
if (sz > size())
|
| 26 |
insert(end(), sz-size(), c);
|
|
@@ -31,7 +33,5 @@ else if (sz < size()) {
|
|
| 31 |
}
|
| 32 |
else
|
| 33 |
; // do nothing
|
| 34 |
```
|
| 35 |
|
| 36 |
-
*Requires:* `T` shall be `CopyInsertable` into `*this`.
|
| 37 |
-
|
|
|
|
| 1 |
+
#### Capacity <a id="list.capacity">[[list.capacity]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
void resize(size_type sz);
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `*this`.
|
| 8 |
+
|
| 9 |
*Effects:* If `size() < sz`, appends `sz - size()` default-inserted
|
| 10 |
elements to the sequence. If `sz <= size()`, equivalent to:
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
list<T>::iterator it = begin();
|
| 14 |
advance(it, sz);
|
| 15 |
erase(it, end());
|
| 16 |
```
|
| 17 |
|
|
|
|
|
|
|
| 18 |
``` cpp
|
| 19 |
void resize(size_type sz, const T& c);
|
| 20 |
```
|
| 21 |
|
| 22 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `*this`.
|
| 23 |
+
|
| 24 |
*Effects:* As if by:
|
| 25 |
|
| 26 |
``` cpp
|
| 27 |
if (sz > size())
|
| 28 |
insert(end(), sz-size(), c);
|
|
|
|
| 33 |
}
|
| 34 |
else
|
| 35 |
; // do nothing
|
| 36 |
```
|
| 37 |
|
|
|
|
|
|