From Jason Turner

[optional.ref.ctor]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpi1f_bvff/{from.md → to.md} +146 -0
tmp/tmpi1f_bvff/{from.md → to.md} RENAMED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Constructors <a id="optional.ref.ctor">[[optional.ref.ctor]]</a>
2
+
3
+ ``` cpp
4
+ template<class Arg>
5
+ constexpr explicit optional(in_place_t, Arg&& arg);
6
+ ```
7
+
8
+ *Constraints:*
9
+
10
+ - `is_constructible_v<T&, Arg>` is `true`, and
11
+ - `reference_constructs_from_temporary_v<T&, Arg>` is `false`.
12
+
13
+ *Effects:* Equivalent to:
14
+ *`convert-ref-init-val`*`(std::forward<Arg>(arg))`.
15
+
16
+ *Ensures:* `*this` contains a value.
17
+
18
+ ``` cpp
19
+ template<class U>
20
+ constexpr explicit(!is_convertible_v<U, T&>)
21
+ optional(U&& u) noexcept(is_nothrow_constructible_v<T&, U>);
22
+ ```
23
+
24
+ *Constraints:*
25
+
26
+ - `is_same_v<remove_cvref_t<U>, optional>` is `false`,
27
+ - `is_same_v<remove_cvref_t<U>, in_place_t>` is `false`, and
28
+ - `is_constructible_v<T&, U>` is `true`.
29
+
30
+ *Effects:* Equivalent to:
31
+ *`convert-ref-init-val`*`(std::forward<U>(u))`.
32
+
33
+ *Ensures:* `*this` contains a value.
34
+
35
+ *Remarks:* This constructor is defined as deleted if
36
+
37
+ ``` cpp
38
+ reference_constructs_from_temporary_v<T&, U>
39
+ ```
40
+
41
+ is `true`.
42
+
43
+ ``` cpp
44
+ template<class U>
45
+ constexpr explicit(!is_convertible_v<U&, T&>)
46
+ optional(optional<U>& rhs) noexcept(is_nothrow_constructible_v<T&, U&>);
47
+ ```
48
+
49
+ *Constraints:*
50
+
51
+ - `is_same_v<remove_cv_t<T>, optional<U>>` is `false`,
52
+ - `is_same_v<T&, U>` is `false`, and
53
+ - `is_constructible_v<T&, U&>` is `true`.
54
+
55
+ *Effects:* Equivalent to:
56
+
57
+ ``` cpp
58
+ if (rhs.has_value()) convert-ref-init-val(*rhs);
59
+ ```
60
+
61
+ *Remarks:* This constructor is defined as deleted if
62
+
63
+ ``` cpp
64
+ reference_constructs_from_temporary_v<T&, U&>
65
+ ```
66
+
67
+ is `true`.
68
+
69
+ ``` cpp
70
+ template<class U>
71
+ constexpr explicit(!is_convertible_v<const U&, T&>)
72
+ optional(const optional<U>& rhs) noexcept(is_nothrow_constructible_v<T&, const U&>);
73
+ ```
74
+
75
+ *Constraints:*
76
+
77
+ - `is_same_v<remove_cv_t<T>, optional<U>>` is `false`,
78
+ - `is_same_v<T&, U>` is `false`, and
79
+ - `is_constructible_v<T&, const U&>` is `true`.
80
+
81
+ *Effects:* Equivalent to:
82
+
83
+ ``` cpp
84
+ if (rhs.has_value()) convert-ref-init-val(*rhs);
85
+ ```
86
+
87
+ *Remarks:* This constructor is defined as deleted if
88
+
89
+ ``` cpp
90
+ reference_constructs_from_temporary_v<T&, const U&>
91
+ ```
92
+
93
+ is `true`.
94
+
95
+ ``` cpp
96
+ template<class U>
97
+ constexpr explicit(!is_convertible_v<U, T&>)
98
+ optional(optional<U>&& rhs) noexcept(is_nothrow_constructible_v<T&, U>);
99
+ ```
100
+
101
+ *Constraints:*
102
+
103
+ - `is_same_v<remove_cv_t<T>, optional<U>>` is `false`,
104
+ - `is_same_v<T&, U>` is `false`, and
105
+ - `is_constructible_v<T&, U>` is `true`.
106
+
107
+ *Effects:* Equivalent to:
108
+
109
+ ``` cpp
110
+ if (rhs.has_value()) convert-ref-init-val(*std::move(rhs));
111
+ ```
112
+
113
+ *Remarks:* This constructor is defined as deleted if
114
+
115
+ ``` cpp
116
+ reference_constructs_from_temporary_v<T&, U>
117
+ ```
118
+
119
+ is `true`.
120
+
121
+ ``` cpp
122
+ template<class U>
123
+ constexpr explicit(!is_convertible_v<const U, T&>)
124
+ optional(const optional<U>&& rhs) noexcept(is_nothrow_constructible_v<T&, const U>);
125
+ ```
126
+
127
+ *Constraints:*
128
+
129
+ - `is_same_v<remove_cv_t<T>, optional<U>>` is `false`,
130
+ - `is_same_v<T&, U>` is `false`, and
131
+ - `is_constructible_v<T&, const U>` is `true`.
132
+
133
+ *Effects:* Equivalent to:
134
+
135
+ ``` cpp
136
+ if (rhs.has_value()) convert-ref-init-val(*std::move(rhs));
137
+ ```
138
+
139
+ *Remarks:* This constructor is defined as deleted if
140
+
141
+ ``` cpp
142
+ reference_constructs_from_temporary_v<T&, const U>
143
+ ```
144
+
145
+ is `true`.
146
+