From Jason Turner

[unique.ptr.single.asgn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3m1atj_2/{from.md → to.md} +22 -19
tmp/tmp3m1atj_2/{from.md → to.md} RENAMED
@@ -1,53 +1,56 @@
1
- ##### `unique_ptr` assignment <a id="unique.ptr.single.asgn">[[unique.ptr.single.asgn]]</a>
2
 
3
  ``` cpp
4
  unique_ptr& operator=(unique_ptr&& u) noexcept;
5
  ```
6
 
7
- *Requires:* If `D` is not a reference type, `D` shall satisfy the
8
- requirements of `MoveAssignable` (Table  [[tab:moveassignable]]) and
9
- assignment of the deleter from an rvalue of type `D` shall not throw an
 
 
10
  exception. Otherwise, `D` is a reference type; `remove_reference_t<D>`
11
- shall satisfy the `CopyAssignable` requirements and assignment of the
12
- deleter from an lvalue of type `D` shall not throw an exception.
13
 
14
- *Effects:* Transfers ownership from `u` to `*this` as if by calling
15
- `reset(u.release())` followed by
16
  `get_deleter() = std::forward<D>(u.get_deleter())`.
17
 
18
  *Returns:* `*this`.
19
 
 
 
20
  ``` cpp
21
  template<class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
22
  ```
23
 
24
- *Requires:* If `E` is not a reference type, assignment of the deleter
25
- from an rvalue of type `E` shall be well-formed and shall not throw an
26
- exception. Otherwise, `E` is a reference type and assignment of the
27
- deleter from an lvalue of type `E` shall be well-formed and shall not
28
- throw an exception.
29
-
30
- *Remarks:* This operator shall not participate in overload resolution
31
- unless:
32
 
33
  - `unique_ptr<U, E>::pointer` is implicitly convertible to `pointer`,
34
  and
35
  - `U` is not an array type, and
36
  - `is_assignable_v<D&, E&&>` is `true`.
37
 
38
- *Effects:* Transfers ownership from `u` to `*this` as if by calling
39
- `reset(u.release())` followed by
 
 
 
 
 
40
  `get_deleter() = std::forward<E>(u.get_deleter())`.
41
 
42
  *Returns:* `*this`.
43
 
 
 
44
  ``` cpp
45
  unique_ptr& operator=(nullptr_t) noexcept;
46
  ```
47
 
48
  *Effects:* As if by `reset()`.
49
 
50
- *Postconditions:* `get() == nullptr`.
51
 
52
  *Returns:* `*this`.
53
 
 
1
+ ##### Assignment <a id="unique.ptr.single.asgn">[[unique.ptr.single.asgn]]</a>
2
 
3
  ``` cpp
4
  unique_ptr& operator=(unique_ptr&& u) noexcept;
5
  ```
6
 
7
+ *Constraints:* `is_move_assignable_v<D>` is `true`.
8
+
9
+ *Preconditions:* If `D` is not a reference type, `D` meets the
10
+ *Cpp17MoveAssignable* requirements ([[cpp17.moveassignable]]) and
11
+ assignment of the deleter from an rvalue of type `D` does not throw an
12
  exception. Otherwise, `D` is a reference type; `remove_reference_t<D>`
13
+ meets the *Cpp17CopyAssignable* requirements and assignment of the
14
+ deleter from an lvalue of type `D` does not throw an exception.
15
 
16
+ *Effects:* Calls `reset(u.release())` followed by
 
17
  `get_deleter() = std::forward<D>(u.get_deleter())`.
18
 
19
  *Returns:* `*this`.
20
 
21
+ *Ensures:* `u.get() == nullptr`.
22
+
23
  ``` cpp
24
  template<class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
25
  ```
26
 
27
+ *Constraints:*
 
 
 
 
 
 
 
28
 
29
  - `unique_ptr<U, E>::pointer` is implicitly convertible to `pointer`,
30
  and
31
  - `U` is not an array type, and
32
  - `is_assignable_v<D&, E&&>` is `true`.
33
 
34
+ *Preconditions:* If `E` is not a reference type, assignment of the
35
+ deleter from an rvalue of type `E` is well-formed and does not throw an
36
+ exception. Otherwise, `E` is a reference type and assignment of the
37
+ deleter from an lvalue of type `E` is well-formed and does not throw an
38
+ exception.
39
+
40
+ *Effects:* Calls `reset(u.release())` followed by
41
  `get_deleter() = std::forward<E>(u.get_deleter())`.
42
 
43
  *Returns:* `*this`.
44
 
45
+ *Ensures:* `u.get() == nullptr`.
46
+
47
  ``` cpp
48
  unique_ptr& operator=(nullptr_t) noexcept;
49
  ```
50
 
51
  *Effects:* As if by `reset()`.
52
 
53
+ *Ensures:* `get() == nullptr`.
54
 
55
  *Returns:* `*this`.
56