@@ -23,9 +23,55 @@ Note how in R0 neither one of the `emplaced_type_t`/`emplaced_index_t`
2323(as they were then called) + `initializer_list` constructors have a
2424throws clause. In R1 only one of them gained it."
2525</blockquote >
26+ <superseded >
27+ <p >
28+ This wording is relative to <paper num =" N5014" />.
29+ </p >
30+
31+ <ol >
32+ <li ><p >Modify <sref ref =" [variant.ctor]" />, as indicated:</p >
33+
34+ <blockquote >
35+ <pre >
36+ template< size_t I, class U, class... Args>
37+ constexpr explicit variant(in_place_index_t< I> , initializer_list< U> il, Args&& ... args);
38+ </pre >
39+ <blockquote >
40+ <p >-35- <i >Constraints</i >:
41+ <ol style =" list-style-type: none" >
42+ <li >(35.1) — `I` is less than `sizeof...(Types)` and</li >
43+ <li >(35.2) —
44+ <code >is_constructible_v< T<sub >I</sub >, initializer_list< U>& , Args...> </code >
45+ is `true`.
46+ </li >
47+ </ol >
48+ </p >
49+ <p >-36- <i >Effects</i >:
50+ Direct-non-list-initializes the contained value of type
51+ <tt >T<sub >I</sub ></tt > with <code >il, std::forward< Args> (args)...</code >.
52+ </p >
53+ <p >-37- <i >Postconditions</i >: `index()` is `I`.</p >
54+ <p ><ins >-?- <i >Throws</i >:
55+ Any exception thrown by calling the selected constructor of
56+ <tt >T<sub >I</sub ></tt >.
57+ </ins >
58+ </p >
59+ <p >-38- <i >Remarks</i >:
60+ If <tt >T<sub >I</sub ></tt >’s selected constructor is a constexpr constructor,
61+ this constructor is a constexpr constructor.
62+ </p >
63+ </blockquote >
64+ </blockquote >
65+ </li >
66+ </ol >
67+ </superseded >
68+
69+ <note >2025-11-11; Jonathan provides improved wording</note >
70+
2671</discussion >
2772
2873<resolution >
74+
2975<p >
3076This wording is relative to <paper num =" N5014" />.
3177</p >
@@ -34,6 +80,176 @@ This wording is relative to <paper num="N5014"/>.
3480<li ><p >Modify <sref ref =" [variant.ctor]" />, as indicated:</p >
3581
3682<blockquote >
83+ <pre >
84+ constexpr variant() noexcept(<i >see below</i >);
85+ </pre >
86+ <blockquote >
87+ <p >-2- <i >Constraints</i >:
88+ <code >is_default_constructible_v< T<sub >0</sub >> </code > is `true`.
89+ </p >
90+ <p >-3- <i >Effects</i >:
91+ Constructs a `variant` holding a value-initialized value of type <tt >T<sub >0</sub ></tt >.
92+ </p >
93+ <p >-4- <i >Postconditions</i >:
94+ `valueless_by_exception()` is `false` and `index()` is `0`.
95+ </p >
96+ <p >-5- <i >Throws</i >:
97+ Any exception thrown by the value-initialization of <tt >T<sub >0</sub ></tt >.
98+ </p >
99+ <p >-6- <i >Remarks</i >: [… ]
100+ </p >
101+ </blockquote >
102+
103+ <pre >
104+ constexpr variant(const variant& );
105+ </pre >
106+ <blockquote >
107+ <p >-7- <i >Effects</i >:
108+ If `w` holds a value, initializes the `variant` to hold the same alternative
109+ as `w` and direct-initializes the contained value with
110+ <code ><i >GET</i >< j> (w)</code >, where `j` is `w.index()`.
111+ Otherwise, initializes the `variant` to not hold a value.
112+ </p >
113+ <p >-8- <i >Throws</i >:
114+ Any exception thrown by
115+ <del >direct-initializating any <tt >T<sub >i</sub ></tt > for all <i >i</i ></del >
116+ <ins >the initialization of the contained value</ins >.
117+ </p >
118+ <p >-9- <i >Remarks</i >: [… ]
119+ </p >
120+ </blockquote >
121+
122+ <pre >
123+ constexpr variant(variant&& ) noexcept(<i >see below</i >);
124+ </pre >
125+ <blockquote >
126+ <p >-10- <i >Constraints</i >:
127+ <code >is_move_constructible_v< T<sub >i</sub >> </code > is `true`
128+ for all <i >i</i >.
129+ </p >
130+ <p >-11- <i >Effects</i >:
131+ If `w` holds a value, initializes the `variant` to hold the same alternative
132+ as `w` and direct-initializes the contained value with
133+ <code ><i >GET</i >< j> (std::move(w))</code >, where `j` is `w.index()`.
134+ Otherwise, initializes the `variant` to not hold a value.
135+ </p >
136+ <p >-12- <i >Throws</i >:
137+ Any exception thrown by
138+ <del >move-constructing any <tt >T<sub >i</sub ></tt > for all <i >i</i ></del >
139+ <ins >the initialization of the contained value</ins >.
140+ </p >
141+ <p >-13- <i >Remarks</i >: [… ]
142+ </p >
143+ </blockquote >
144+
145+ <pre >
146+ template< class T> constexpr variant(T&& ) noexcept(<i >see below</i >);
147+ </pre >
148+ <blockquote >
149+ <p >-14-
150+ Let <tt >T<sub >j</sub ></tt > be a type that is determined as follows:
151+ build an imaginary function <tt ><i >FUN</i >(T<sub >i</sub >)</tt >
152+ for each alternative type <tt >T<sub >i</sub ></tt >
153+ for which <tt >T<sub >i</sub > x[] = {std::forward< T> (t)};</tt >
154+ is well-formed for some invented variable `x`.
155+ The overload <tt ><i >FUN</i >(T<sub >j</sub >)</tt > selected by overload resolution
156+ for the expression <tt ><i >FUN</i >(std::forward< T> (t))</tt > defines
157+ the alternative <tt >T<sub >j</sub ></tt > which is the type
158+ of the contained value after construction.
159+ </p >
160+ <p >-15- <i >Constraints</i >: [… ]
161+ </p >
162+ <p >-16- <i >Effects</i >:
163+ Initializes `*this` to hold the alternative type <tt >T<sub >j</sub ></tt >
164+ and direct-non-list-initializes the contained value with
165+ <code >std::forward< T> (t)</code >.
166+ </p >
167+ <p >-17- <i >Postconditions</i >: [… ]
168+ </p >
169+ <p >-18- <i >Throws</i >:
170+ Any exception thrown by the initialization of the
171+ <del >selected alternative <tt >T<sub >j</sub ></tt ></del >
172+ <ins >contained value</ins >.
173+ </p >
174+ <p >-19- <i >Remarks</i >: [… ]
175+ </p >
176+ </blockquote >
177+
178+ <pre >
179+ template< class T, class... Args> constexpr variant(in_place_type_t< T> , Args&& ... args);
180+ </pre >
181+ <blockquote >
182+ <p >-20- <i >Constraints</i >: [… ]
183+ </p >
184+ <p >-21- <i >Effects</i >:
185+ Direct-non-list-initializes the contained value of type `T`
186+ with
187+ <code >std::forward< Args> (args)...</code >.
188+ </p >
189+ <p >-22- <i >Postconditions</i >: [… ]
190+ </p >
191+ <p >-23- <i >Throws</i >:
192+ Any exception thrown by
193+ <del >the selected constructor of `T`</del >
194+ <ins >the initialization of the contained value</ins >.
195+ </p >
196+ <p >-24- <i >Remarks</i >: [… ]
197+ </p >
198+ </blockquote >
199+
200+ <pre >
201+ template< class T, class U, class... Args>
202+ constexpr variant(in_place_type_t< T> , initializer_list< U> li, Args&& ... args);
203+ </pre >
204+ <blockquote >
205+ <p >-25- <i >Constraints</i >: [… ]
206+ </p >
207+ <p >-26- <i >Effects</i >:
208+ Direct-non-list-initializes the contained value of type `T`
209+ with
210+ <code >il, std::forward< Args> (args)...</code >.
211+ </p >
212+ <p >-27- <i >Postconditions</i >: [… ]
213+ </p >
214+ <p >-28- <i >Throws</i >:
215+ Any exception thrown by
216+ <del >the selected constructor of `T`</del >
217+ <ins >the initialization of the contained value</ins >.
218+ </p >
219+ <p >-29- <i >Remarks</i >: [… ]
220+ </p >
221+ </blockquote >
222+
223+ <pre >
224+ template< size_t I, class... Args>
225+ constexpr explicit variant(in_place_index_t< I> , Args&& ... args);
226+ </pre >
227+ <blockquote >
228+ <p >-30- <i >Constraints</i >:
229+ <ol style =" list-style-type: none" >
230+ <li >(30.1) — `I` is less than `sizeof...(Types)` and</li >
231+ <li >(30.2) —
232+ <code >is_constructible_v< T<sub >I</sub >, Args...> </code >
233+ is `true`.
234+ </li >
235+ </ol >
236+ </p >
237+ <p >-31- <i >Effects</i >:
238+ Direct-non-list-initializes the contained value of type
239+ <tt >T<sub >I</sub ></tt > with <code >std::forward< Args> (args)...</code >.
240+ </p >
241+ <p >-32- <i >Postconditions</i >: `index()` is `I`.</p >
242+ <p >-33- <i >Throws</i >:
243+ Any exception thrown by
244+ <del >the selected constructor of <tt >T<sub >i</sub ></tt ></del >
245+ <ins >the initialization of the contained value</ins >.
246+ </p >
247+ <p >-34- <i >Remarks</i >:
248+ If <tt >T<sub >I</sub ></tt >’s selected constructor is a constexpr constructor,
249+ this constructor is a constexpr constructor.
250+ </p >
251+ </blockquote >
252+
37253<pre >
38254template< size_t I, class U, class... Args>
39255 constexpr explicit variant(in_place_index_t< I> , initializer_list< U> il, Args&& ... args);
@@ -54,8 +270,7 @@ Direct-non-list-initializes the contained value of type
54270</p >
55271<p >-37- <i >Postconditions</i >: `index()` is `I`.</p >
56272<p ><ins >-?- <i >Throws</i >:
57- Any exception thrown by calling the selected constructor of
58- <tt >T<sub >I</sub ></tt >.
273+ Any exception thrown by the initialization of the contained value.
59274</ins >
60275</p >
61276<p >-38- <i >Remarks</i >:
@@ -66,6 +281,7 @@ this constructor is a constexpr constructor.
66281</blockquote >
67282</li >
68283</ol >
284+
69285</resolution >
70286
71287</issue >
0 commit comments