tmp/tmp07x4y9eo/{from.md → to.md}
RENAMED
|
@@ -11,11 +11,11 @@ requiring reallocation.
|
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
constexpr void reserve(size_type n);
|
| 14 |
```
|
| 15 |
|
| 16 |
-
*Preconditions:* `T` is *Cpp17MoveInsertable* into `
|
| 17 |
|
| 18 |
*Effects:* A directive that informs a `vector` of a planned change in
|
| 19 |
size, so that it can manage the storage allocation accordingly. After
|
| 20 |
`reserve()`, `capacity()` is greater or equal to the argument of
|
| 21 |
`reserve` if reallocation happens; and equal to the previous value of
|
|
@@ -24,16 +24,15 @@ if the current capacity is less than the argument of `reserve()`. If an
|
|
| 24 |
exception is thrown other than by the move constructor of a
|
| 25 |
non-*Cpp17CopyInsertable* type, there are no effects.
|
| 26 |
|
| 27 |
*Throws:* `length_error` if `n > max_size()`.[^4]
|
| 28 |
|
| 29 |
-
*Complexity:*
|
| 30 |
-
most linear time in the size of the sequence.
|
| 31 |
|
| 32 |
-
*Remarks:*
|
| 33 |
-
|
| 34 |
-
past-the-end iterator.
|
| 35 |
|
| 36 |
[*Note 1*: If no reallocation happens, they remain
|
| 37 |
valid. — *end note*]
|
| 38 |
|
| 39 |
No reallocation shall take place during insertions that happen after a
|
|
@@ -42,21 +41,21 @@ greater than the value of `capacity()`.
|
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
constexpr void shrink_to_fit();
|
| 45 |
```
|
| 46 |
|
| 47 |
-
*Preconditions:* `T` is *Cpp17MoveInsertable* into `
|
| 48 |
|
| 49 |
*Effects:* `shrink_to_fit` is a non-binding request to reduce
|
| 50 |
`capacity()` to `size()`.
|
| 51 |
|
| 52 |
[*Note 2*: The request is non-binding to allow latitude for
|
| 53 |
implementation-specific optimizations. — *end note*]
|
| 54 |
|
| 55 |
It does not increase `capacity()`, but may reduce `capacity()` by
|
| 56 |
causing reallocation. If an exception is thrown other than by the move
|
| 57 |
-
constructor of a non-*Cpp17CopyInsertable* `T` there are no effects.
|
| 58 |
|
| 59 |
*Complexity:* If reallocation happens, linear in the size of the
|
| 60 |
sequence.
|
| 61 |
|
| 62 |
*Remarks:* Reallocation invalidates all the references, pointers, and
|
|
@@ -80,26 +79,26 @@ of `x`.
|
|
| 80 |
``` cpp
|
| 81 |
constexpr void resize(size_type sz);
|
| 82 |
```
|
| 83 |
|
| 84 |
*Preconditions:* `T` is *Cpp17MoveInsertable* and
|
| 85 |
-
*Cpp17DefaultInsertable* into `
|
| 86 |
|
| 87 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 88 |
the sequence. Otherwise, appends `sz - size()` default-inserted elements
|
| 89 |
to the sequence.
|
| 90 |
|
| 91 |
*Remarks:* If an exception is thrown other than by the move constructor
|
| 92 |
-
of a non-*Cpp17CopyInsertable* `T` there are no effects.
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
constexpr void resize(size_type sz, const T& c);
|
| 96 |
```
|
| 97 |
|
| 98 |
-
*Preconditions:* `T` is *Cpp17CopyInsertable* into `
|
| 99 |
|
| 100 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 101 |
the sequence. Otherwise, appends `sz - size()` copies of `c` to the
|
| 102 |
sequence.
|
| 103 |
|
| 104 |
-
*Remarks:* If an exception is thrown there are no effects.
|
| 105 |
|
|
|
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
constexpr void reserve(size_type n);
|
| 14 |
```
|
| 15 |
|
| 16 |
+
*Preconditions:* `T` is *Cpp17MoveInsertable* into `vector`.
|
| 17 |
|
| 18 |
*Effects:* A directive that informs a `vector` of a planned change in
|
| 19 |
size, so that it can manage the storage allocation accordingly. After
|
| 20 |
`reserve()`, `capacity()` is greater or equal to the argument of
|
| 21 |
`reserve` if reallocation happens; and equal to the previous value of
|
|
|
|
| 24 |
exception is thrown other than by the move constructor of a
|
| 25 |
non-*Cpp17CopyInsertable* type, there are no effects.
|
| 26 |
|
| 27 |
*Throws:* `length_error` if `n > max_size()`.[^4]
|
| 28 |
|
| 29 |
+
*Complexity:* Linear in the size of the sequence.
|
|
|
|
| 30 |
|
| 31 |
+
*Remarks:* The size of the sequence is not changed. Reallocation
|
| 32 |
+
invalidates all the references, pointers, and iterators referring to the
|
| 33 |
+
elements in the sequence, as well as the past-the-end iterator.
|
| 34 |
|
| 35 |
[*Note 1*: If no reallocation happens, they remain
|
| 36 |
valid. — *end note*]
|
| 37 |
|
| 38 |
No reallocation shall take place during insertions that happen after a
|
|
|
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
constexpr void shrink_to_fit();
|
| 44 |
```
|
| 45 |
|
| 46 |
+
*Preconditions:* `T` is *Cpp17MoveInsertable* into `vector`.
|
| 47 |
|
| 48 |
*Effects:* `shrink_to_fit` is a non-binding request to reduce
|
| 49 |
`capacity()` to `size()`.
|
| 50 |
|
| 51 |
[*Note 2*: The request is non-binding to allow latitude for
|
| 52 |
implementation-specific optimizations. — *end note*]
|
| 53 |
|
| 54 |
It does not increase `capacity()`, but may reduce `capacity()` by
|
| 55 |
causing reallocation. If an exception is thrown other than by the move
|
| 56 |
+
constructor of a non-*Cpp17CopyInsertable* `T`, there are no effects.
|
| 57 |
|
| 58 |
*Complexity:* If reallocation happens, linear in the size of the
|
| 59 |
sequence.
|
| 60 |
|
| 61 |
*Remarks:* Reallocation invalidates all the references, pointers, and
|
|
|
|
| 79 |
``` cpp
|
| 80 |
constexpr void resize(size_type sz);
|
| 81 |
```
|
| 82 |
|
| 83 |
*Preconditions:* `T` is *Cpp17MoveInsertable* and
|
| 84 |
+
*Cpp17DefaultInsertable* into `vector`.
|
| 85 |
|
| 86 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 87 |
the sequence. Otherwise, appends `sz - size()` default-inserted elements
|
| 88 |
to the sequence.
|
| 89 |
|
| 90 |
*Remarks:* If an exception is thrown other than by the move constructor
|
| 91 |
+
of a non-*Cpp17CopyInsertable* `T`, there are no effects.
|
| 92 |
|
| 93 |
``` cpp
|
| 94 |
constexpr void resize(size_type sz, const T& c);
|
| 95 |
```
|
| 96 |
|
| 97 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `vector`.
|
| 98 |
|
| 99 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 100 |
the sequence. Otherwise, appends `sz - size()` copies of `c` to the
|
| 101 |
sequence.
|
| 102 |
|
| 103 |
+
*Remarks:* If an exception is thrown, there are no effects.
|
| 104 |
|