@@ -50,9 +50,7 @@ This would need to use `val` instead of `**this` if LWG <iref ref="4015"/>
5050is accepted.
5151</p >
5252
53- </discussion >
54-
55- <resolution >
53+ <superseded >
5654<p >
5755This wording is relative to <paper num =" N5014" />.
5856</p >
@@ -168,6 +166,132 @@ return std::forward<U>(v);</ins>
168166</li >
169167</ol >
170168
169+ </superseded >
170+
171+ <note >2025-11-11; Jonathan provides updated wording</note >
172+ <p >
173+ Rebase after LWG <iref ref =" 4015" /> which was approved in Kona.
174+ This would also resolve LWG <iref ref =" 4281" />.
175+ </p >
176+
177+ </discussion >
178+
179+ <resolution >
180+ <p >
181+ This wording is relative to <b >the working draft after <paper num =" N5014" /></b >.
182+ </p >
183+
184+ <ol >
185+
186+ <li ><p >Modify <sref ref =" [optional.observe]" /> as indicated:</p >
187+
188+ <blockquote >
189+ <pre >
190+ template< class U = remove_cv_t< T>> constexpr T value_or(U&& v) const & ;
191+ </pre >
192+ <blockquote >
193+ <p >
194+ -15- <i >Mandates</i >: <code >is_copy_constructible_v< T> && is_convertible_v< U&& , T> </code >
195+ is `true`.
196+ <p />
197+ -16- <i >Effects</i >: Equivalent to:
198+ </p >
199+ <blockquote ><pre >
200+ <del >return has_value() ? <i >val</i > : static_cast< T> (std::forward< U> (v));</del >
201+ <ins >if (has_value())
202+ return <i >val</i >;
203+ return std::forward< U> (v);</ins >
204+ </pre ></blockquote >
205+ </blockquote >
206+ <pre >
207+ template< class U = remove_cv_t< T>> constexpr T value_or(U&& v) && ;
208+ </pre >
209+ <blockquote >
210+ <p >
211+ -17- <i >Mandates</i >: <code >is_move_constructible_v< T> && is_convertible_v< U&& , T> </code >
212+ is `true`.
213+ <p />
214+ -18- <i >Effects</i >: Equivalent to:
215+ </p >
216+ <blockquote ><pre >
217+ <del >return has_value() ? std::move(<i >val</i >) : static_cast< T> (std::forward< U> (v));</del >
218+ <ins >if (has_value())
219+ return std::move(<i >val</i >);
220+ return std::forward< U> (v);</ins >
221+ </pre ></blockquote >
222+ </blockquote >
223+ </blockquote >
224+ </li >
225+
226+ <li ><p >Modify <sref ref =" [optional.ref.observe]" /> as indicated:</p >
227+
228+ <blockquote >
229+ <pre >
230+ template< class U = remove_cv_t< T>> constexpr remove_cv_t< T> value_or(U&& u) const;
231+ </pre >
232+ <blockquote >
233+ <p >
234+ -8- Let <code >X</code > be <code >remove_cv_t< T> </code >.
235+ <p />
236+ -9- <i >Mandates</i >: <code >is_constructible_v< X, T&> && is_convertible_v< U, X> </code >
237+ is `true`.
238+ <p />
239+ -10- <i >Effects</i >: Equivalent to:
240+ </p >
241+ <blockquote ><pre >
242+ <del >return has_value() ? *<i >val</i > : static_cast< X> (std::forward< U> (u));</del >
243+ <ins >if (has_value())
244+ return *<i >val</i >;
245+ return std::forward< U> (u);
246+ </ins >
247+ </pre ></blockquote >
248+ </blockquote >
249+ </blockquote >
250+ </li >
251+
252+ <li ><p >Modify <sref ref =" [expected.object.obs]" /> as indicated:</p >
253+
254+ <blockquote >
255+ <pre >
256+ template< class U = remove_cv_t< T>> constexpr T value_or(U&& v) const & ;
257+ </pre >
258+ <blockquote >
259+ <p >
260+ -18- <i >Mandates</i >: <code >is_copy_constructible_v< T> </code > is `true` and
261+ <code >is_convertible_v< U, T> </code > is `true`.
262+ <p />
263+ <del >-19- <i >Returns</i >: <code >has_value() ? **this : static_cast< T> (std::forward< U> (v))</code >.</del >
264+ <p />
265+ <ins >-?- <i >Effects</i >: Equivalent to:</ins >
266+ </p >
267+ <blockquote ><pre >
268+ <ins >if (has_value())
269+ return <i >val</i >;
270+ return std::forward< U> (v);</ins >
271+ </pre ></blockquote >
272+ </blockquote >
273+ <pre >
274+ template< class U = remove_cv_t< T>> constexpr T value_or(U&& v) && ;
275+ </pre >
276+ <blockquote >
277+ <p >
278+ -20- <i >Mandates</i >: <code >is_move_constructible_v< T> </code > is `true` and
279+ <code >is_convertible_v< U, T> </code > is `true`.
280+ <p />
281+ <del >-21- <i >Returns</i >: <code >has_value() ? std::move(**this) : static_cast< T> (std::forward< U> (v))</code >.</del >
282+ <p />
283+ <ins >-?- <i >Effects</i >: Equivalent to:</ins >
284+ </p >
285+ <blockquote ><pre >
286+ <ins >if (has_value())
287+ return std::move(<i >val</i >);
288+ return std::forward< U> (v);</ins >
289+ </pre ></blockquote >
290+ </blockquote >
291+ </blockquote >
292+ </li >
293+ </ol >
294+
171295</resolution >
172296
173297</issue >
0 commit comments