From Jason Turner

[unique.ptr.single.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8u1_gs1d/{from.md → to.md} +12 -8
tmp/tmp8u1_gs1d/{from.md → to.md} RENAMED
@@ -2,29 +2,33 @@
2
 
3
  ``` cpp
4
  pointer release() noexcept;
5
  ```
6
 
7
- `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
  *Requires:* The expression `get_deleter()(get())` shall be well formed,
16
  shall have well-defined behavior, and shall not throw exceptions.
17
 
18
- *Effects:* assigns `p` to the stored pointer, and then if the old value
19
- of the stored pointer, `old_p`, was not equal to `nullptr`, calls
20
- `get_deleter()(old_p)`. The order of these operations is significant
21
- because the call to `get_deleter()` may destroy `*this`.
22
 
23
- *Postconditions:* `get() == p`. The postcondition does not hold if the
24
- call to `get_deleter()` destroys `*this` since `this->get()` is no
25
- longer a valid expression.
 
 
 
 
 
26
 
27
  ``` cpp
28
  void swap(unique_ptr& u) noexcept;
29
  ```
30
 
 
2
 
3
  ``` cpp
4
  pointer release() noexcept;
5
  ```
6
 
7
+ *Postconditions:* `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
  *Requires:* The expression `get_deleter()(get())` shall be well formed,
16
  shall have well-defined behavior, and shall 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
+ *Postconditions:* `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