From Jason Turner

[expected.void.assign]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpguwblnwu/{from.md → to.md} +76 -0
tmp/tmpguwblnwu/{from.md → to.md} RENAMED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Assignment <a id="expected.void.assign">[[expected.void.assign]]</a>
2
+
3
+ ``` cpp
4
+ constexpr expected& operator=(const expected& rhs);
5
+ ```
6
+
7
+ *Effects:*
8
+
9
+ - If `this->has_value() && rhs.has_value()` is `true`, no effects.
10
+ - Otherwise, if `this->has_value()` is `true`, equivalent to:
11
+ `construct_at(addressof(`*`unex`*`), rhs.`*`unex`*`); `*`has_val`*` = false;`
12
+ - Otherwise, if `rhs.has_value()` is `true`, destroys *unex* and sets
13
+ *has_val* to `true`.
14
+ - Otherwise, equivalent to *`unex`*` = rhs.error()`.
15
+
16
+ *Returns:* `*this`.
17
+
18
+ *Remarks:* This operator is defined as deleted unless
19
+ `is_copy_assignable_v<E>` is `true` and `is_copy_constructible_v<E>` is
20
+ `true`.
21
+
22
+ ``` cpp
23
+ constexpr expected& operator=(expected&& rhs) noexcept(see below);
24
+ ```
25
+
26
+ *Effects:*
27
+
28
+ - If `this->has_value() && rhs.has_value()` is `true`, no effects.
29
+ - Otherwise, if `this->has_value()` is `true`, equivalent to:
30
+ ``` cpp
31
+ construct_at(addressof(unex), std::move(rhs.unex));
32
+ has_val = false;
33
+ ```
34
+ - Otherwise, if `rhs.has_value()` is `true`, destroys *unex* and sets
35
+ *has_val* to `true`.
36
+ - Otherwise, equivalent to *`unex`*` = std::move(rhs.error())`.
37
+
38
+ *Returns:* `*this`.
39
+
40
+ *Remarks:* The exception specification is equivalent to
41
+ `is_nothrow_move_constructible_v<E> && is_nothrow_move_assignable_v<E>`.
42
+
43
+ This operator is defined as deleted unless `is_move_constructible_v<E>`
44
+ is `true` and `is_move_assignable_v<E>` is `true`.
45
+
46
+ ``` cpp
47
+ template<class G>
48
+ constexpr expected& operator=(const unexpected<G>& e);
49
+ template<class G>
50
+ constexpr expected& operator=(unexpected<G>&& e);
51
+ ```
52
+
53
+ Let `GF` be `const G&` for the first overload and `G` for the second
54
+ overload.
55
+
56
+ *Constraints:* `is_constructible_v<E, GF>` is `true` and
57
+ `is_assignable_v<E&, GF>` is `true`.
58
+
59
+ *Effects:*
60
+
61
+ - If `has_value()` is `true`, equivalent to:
62
+ ``` cpp
63
+ construct_at(addressof(unex), std::forward<GF>(e.error()));
64
+ has_val = false;
65
+ ```
66
+ - Otherwise, equivalent to: *`unex`*` = std::forward<GF>(e.error());`
67
+
68
+ *Returns:* `*this`.
69
+
70
+ ``` cpp
71
+ constexpr void emplace() noexcept;
72
+ ```
73
+
74
+ *Effects:* If `has_value()` is `false`, destroys *unex* and sets
75
+ *has_val* to `true`.
76
+