From Jason Turner

[expected.void.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphkkevsst/{from.md → to.md} +124 -0
tmp/tmphkkevsst/{from.md → to.md} RENAMED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Constructors <a id="expected.void.cons">[[expected.void.cons]]</a>
2
+
3
+ ``` cpp
4
+ constexpr expected() noexcept;
5
+ ```
6
+
7
+ *Ensures:* `has_value()` is `true`.
8
+
9
+ ``` cpp
10
+ constexpr expected(const expected& rhs);
11
+ ```
12
+
13
+ *Effects:* If `rhs.has_value()` is `false`, direct-non-list-initializes
14
+ *unex* with `rhs.error()`.
15
+
16
+ *Ensures:* `rhs.has_value() == this->has_value()`.
17
+
18
+ *Throws:* Any exception thrown by the initialization of *unex*.
19
+
20
+ *Remarks:* This constructor is defined as deleted unless
21
+ `is_copy_constructible_v<E>` is `true`.
22
+
23
+ This constructor is trivial if `is_trivially_copy_constructible_v<E>` is
24
+ `true`.
25
+
26
+ ``` cpp
27
+ constexpr expected(expected&& rhs) noexcept(is_nothrow_move_constructible_v<E>);
28
+ ```
29
+
30
+ *Constraints:* `is_move_constructible_v<E>` is `true`.
31
+
32
+ *Effects:* If `rhs.has_value()` is `false`, direct-non-list-initializes
33
+ *unex* with `std::move(rhs.error())`.
34
+
35
+ *Ensures:* `rhs.has_value()` is unchanged;
36
+ `rhs.has_value() == this->has_value()` is `true`.
37
+
38
+ *Throws:* Any exception thrown by the initialization of *unex*.
39
+
40
+ *Remarks:* This constructor is trivial if
41
+ `is_trivially_move_constructible_v<E>` is `true`.
42
+
43
+ ``` cpp
44
+ template<class U, class G>
45
+ constexpr explicit(!is_convertible_v<const G&, E>) expected(const expected<U, G>& rhs);
46
+ template<class U, class G>
47
+ constexpr explicit(!is_convertible_v<G, E>) expected(expected<U, G>&& rhs);
48
+ ```
49
+
50
+ Let `GF` be `const G&` for the first overload and `G` for the second
51
+ overload.
52
+
53
+ *Constraints:*
54
+
55
+ - `is_void_v<U>` is `true`; and
56
+ - `is_constructible_v<E, GF>` is `true`; and
57
+ - `is_constructible_v<unexpected<E>, expected<U, G>&>` is `false`; and
58
+ - `is_constructible_v<unexpected<E>, expected<U, G>>` is `false`; and
59
+ - `is_constructible_v<unexpected<E>, const expected<U, G>&>` is `false`;
60
+ and
61
+ - `is_constructible_v<unexpected<E>, const expected<U, G>>` is `false`.
62
+
63
+ *Effects:* If `rhs.has_value()` is `false`, direct-non-list-initializes
64
+ *unex* with `std::forward<GF>(rhs.error())`.
65
+
66
+ *Ensures:* `rhs.has_value()` is unchanged;
67
+ `rhs.has_value() == this->has_value()` is `true`.
68
+
69
+ *Throws:* Any exception thrown by the initialization of *unex*.
70
+
71
+ ``` cpp
72
+ template<class G>
73
+ constexpr explicit(!is_convertible_v<const G&, E>) expected(const unexpected<G>& e);
74
+ template<class G>
75
+ constexpr explicit(!is_convertible_v<G, E>) expected(unexpected<G>&& e);
76
+ ```
77
+
78
+ Let `GF` be `const G&` for the first overload and `G` for the second
79
+ overload.
80
+
81
+ *Constraints:* `is_constructible_v<E, GF>` is `true`.
82
+
83
+ *Effects:* Direct-non-list-initializes *unex* with
84
+ `std::forward<GF>(e.error())`.
85
+
86
+ *Ensures:* `has_value()` is `false`.
87
+
88
+ *Throws:* Any exception thrown by the initialization of *unex*.
89
+
90
+ ``` cpp
91
+ constexpr explicit expected(in_place_t) noexcept;
92
+ ```
93
+
94
+ *Ensures:* `has_value()` is `true`.
95
+
96
+ ``` cpp
97
+ template<class... Args>
98
+ constexpr explicit expected(unexpect_t, Args&&... args);
99
+ ```
100
+
101
+ *Constraints:* `is_constructible_v<E, Args...>` is `true`.
102
+
103
+ *Effects:* Direct-non-list-initializes *unex* with
104
+ `std::forward<Args>(args)...`.
105
+
106
+ *Ensures:* `has_value()` is `false`.
107
+
108
+ *Throws:* Any exception thrown by the initialization of *unex*.
109
+
110
+ ``` cpp
111
+ template<class U, class... Args>
112
+ constexpr explicit expected(unexpect_t, initializer_list<U> il, Args&&... args);
113
+ ```
114
+
115
+ *Constraints:* `is_constructible_v<E, initializer_list<U>&, Args...>` is
116
+ `true`.
117
+
118
+ *Effects:* Direct-non-list-initializes *unex* with
119
+ `il, std::forward<Args>(args)...`.
120
+
121
+ *Ensures:* `has_value()` is `false`.
122
+
123
+ *Throws:* Any exception thrown by the initialization of *unex*.
124
+