tmp/tmpaz3gc2jh/{from.md → to.md}
RENAMED
|
@@ -37,20 +37,30 @@ vector greater than the value of `capacity()`.
|
|
| 37 |
void shrink_to_fit();
|
| 38 |
```
|
| 39 |
|
| 40 |
*Requires:* `T` shall be `MoveInsertable` into `*this`.
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
*Complexity:* Linear in the size of the sequence.
|
| 43 |
|
| 44 |
-
*Remarks:*
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
other than by the move constructor of a non-`CopyInsertable` `T` there
|
| 48 |
-
are no effects.
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
-
void swap(vector& x)
|
|
|
|
|
|
|
| 52 |
```
|
| 53 |
|
| 54 |
*Effects:* Exchanges the contents and `capacity()` of `*this` with that
|
| 55 |
of `x`.
|
| 56 |
|
|
@@ -58,13 +68,13 @@ of `x`.
|
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
void resize(size_type sz);
|
| 61 |
```
|
| 62 |
|
| 63 |
-
*Effects:* If `sz <
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
*Requires:* `T` shall be `MoveInsertable` and `DefaultInsertable` into
|
| 68 |
`*this`.
|
| 69 |
|
| 70 |
*Remarks:* If an exception is thrown other than by the move constructor
|
|
@@ -72,13 +82,13 @@ of a non-`CopyInsertable` `T` there are no effects.
|
|
| 72 |
|
| 73 |
``` cpp
|
| 74 |
void resize(size_type sz, const T& c);
|
| 75 |
```
|
| 76 |
|
| 77 |
-
*Effects:* If `sz <
|
| 78 |
-
|
| 79 |
-
|
| 80 |
|
| 81 |
*Requires:* `T` shall be `CopyInsertable` into `*this`.
|
| 82 |
|
| 83 |
*Remarks:* If an exception is thrown there are no effects.
|
| 84 |
|
|
|
|
| 37 |
void shrink_to_fit();
|
| 38 |
```
|
| 39 |
|
| 40 |
*Requires:* `T` shall be `MoveInsertable` into `*this`.
|
| 41 |
|
| 42 |
+
*Effects:* `shrink_to_fit` is a non-binding request to reduce
|
| 43 |
+
`capacity()` to `size()`.
|
| 44 |
+
|
| 45 |
+
[*Note 1*: The request is non-binding to allow latitude for
|
| 46 |
+
implementation-specific optimizations. — *end note*]
|
| 47 |
+
|
| 48 |
+
It does not increase `capacity()`, but may reduce `capacity()` by
|
| 49 |
+
causing reallocation. If an exception is thrown other than by the move
|
| 50 |
+
constructor of a non-`CopyInsertable` `T` there are no effects.
|
| 51 |
+
|
| 52 |
*Complexity:* Linear in the size of the sequence.
|
| 53 |
|
| 54 |
+
*Remarks:* Reallocation invalidates all the references, pointers, and
|
| 55 |
+
iterators referring to the elements in the sequence as well as the
|
| 56 |
+
past-the-end iterator. If no reallocation happens, they remain valid.
|
|
|
|
|
|
|
| 57 |
|
| 58 |
``` cpp
|
| 59 |
+
void swap(vector& x)
|
| 60 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
|
| 61 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 62 |
```
|
| 63 |
|
| 64 |
*Effects:* Exchanges the contents and `capacity()` of `*this` with that
|
| 65 |
of `x`.
|
| 66 |
|
|
|
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
void resize(size_type sz);
|
| 71 |
```
|
| 72 |
|
| 73 |
+
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 74 |
+
the sequence. Otherwise, appends `sz - size()` default-inserted elements
|
| 75 |
+
to the sequence.
|
| 76 |
|
| 77 |
*Requires:* `T` shall be `MoveInsertable` and `DefaultInsertable` into
|
| 78 |
`*this`.
|
| 79 |
|
| 80 |
*Remarks:* If an exception is thrown other than by the move constructor
|
|
|
|
| 82 |
|
| 83 |
``` cpp
|
| 84 |
void resize(size_type sz, const T& c);
|
| 85 |
```
|
| 86 |
|
| 87 |
+
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 88 |
+
the sequence. Otherwise, appends `sz - size()` copies of `c` to the
|
| 89 |
+
sequence.
|
| 90 |
|
| 91 |
*Requires:* `T` shall be `CopyInsertable` into `*this`.
|
| 92 |
|
| 93 |
*Remarks:* If an exception is thrown there are no effects.
|
| 94 |
|