From Jason Turner

[unique.ptr.single.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpbompc6_3/{from.md → to.md} +10 -10
tmp/tmpbompc6_3/{from.md → to.md} RENAMED
@@ -1,37 +1,37 @@
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
 
 
1
  ##### Modifiers <a id="unique.ptr.single.modifiers">[[unique.ptr.single.modifiers]]</a>
2
 
3
  ``` cpp
4
+ constexpr 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
+ constexpr void reset(pointer p = pointer()) noexcept;
13
  ```
14
 
15
+ *Effects:* Assigns `p` to the stored pointer, and then, with the old
16
+ value of the stored pointer, `old_p`, evaluates
17
+ `if (old_p) get_deleter()(old_p);`
 
 
 
18
 
19
  [*Note 5*: The order of these operations is significant because the
20
+ call to `get_deleter()` might destroy `*this`. — *end note*]
21
 
22
  *Ensures:* `get() == p`.
23
 
24
  [*Note 6*: The postcondition does not hold if the call to
25
  `get_deleter()` destroys `*this` since `this->get()` is no longer a
26
  valid expression. — *end note*]
27
 
28
+ *Remarks:* The behavior is undefined if the evaluation of
29
+ `get_deleter()(old_p)` throws an exception.
30
+
31
  ``` cpp
32
+ constexpr 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