tmp/tmpvzpqfy9t/{from.md → to.md}
RENAMED
|
@@ -1,41 +1,40 @@
|
|
| 1 |
-
#####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
pointer release() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*
|
| 8 |
|
| 9 |
*Returns:* The value `get()` had at the start of the call to `release`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
void reset(pointer p = pointer()) noexcept;
|
| 13 |
```
|
| 14 |
|
| 15 |
-
*
|
| 16 |
-
|
| 17 |
|
| 18 |
*Effects:* Assigns `p` to the stored pointer, and then if and only if
|
| 19 |
the old value of the stored pointer, `old_p`, was not equal to
|
| 20 |
`nullptr`, calls `get_deleter()(old_p)`.
|
| 21 |
|
| 22 |
[*Note 5*: The order of these operations is significant because the
|
| 23 |
call to `get_deleter()` may destroy `*this`. — *end note*]
|
| 24 |
|
| 25 |
-
*
|
| 26 |
|
| 27 |
[*Note 6*: The postcondition does not hold if the call to
|
| 28 |
`get_deleter()` destroys `*this` since `this->get()` is no longer a
|
| 29 |
valid expression. — *end note*]
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
void swap(unique_ptr& u) noexcept;
|
| 33 |
```
|
| 34 |
|
| 35 |
-
*
|
| 36 |
-
|
| 37 |
-
under `swap`.
|
| 38 |
|
| 39 |
*Effects:* Invokes `swap` on the stored pointers and on the stored
|
| 40 |
deleters of `*this` and `u`.
|
| 41 |
|
|
|
|
| 1 |
+
##### Modifiers <a id="unique.ptr.single.modifiers">[[unique.ptr.single.modifiers]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
pointer release() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Ensures:* `get() == nullptr`.
|
| 8 |
|
| 9 |
*Returns:* The value `get()` had at the start of the call to `release`.
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
void reset(pointer p = pointer()) noexcept;
|
| 13 |
```
|
| 14 |
|
| 15 |
+
*Preconditions:* The expression `get_deleter()(get())` is well-formed,
|
| 16 |
+
has well-defined behavior, and does not throw exceptions.
|
| 17 |
|
| 18 |
*Effects:* Assigns `p` to the stored pointer, and then if and only if
|
| 19 |
the old value of the stored pointer, `old_p`, was not equal to
|
| 20 |
`nullptr`, calls `get_deleter()(old_p)`.
|
| 21 |
|
| 22 |
[*Note 5*: The order of these operations is significant because the
|
| 23 |
call to `get_deleter()` may destroy `*this`. — *end note*]
|
| 24 |
|
| 25 |
+
*Ensures:* `get() == p`.
|
| 26 |
|
| 27 |
[*Note 6*: The postcondition does not hold if the call to
|
| 28 |
`get_deleter()` destroys `*this` since `this->get()` is no longer a
|
| 29 |
valid expression. — *end note*]
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
void swap(unique_ptr& u) noexcept;
|
| 33 |
```
|
| 34 |
|
| 35 |
+
*Preconditions:* `get_deleter()` is swappable [[swappable.requirements]]
|
| 36 |
+
and does not throw an exception under `swap`.
|
|
|
|
| 37 |
|
| 38 |
*Effects:* Invokes `swap` on the stored pointers and on the stored
|
| 39 |
deleters of `*this` and `u`.
|
| 40 |
|