Skip to content

Commit 1aac0c5

Browse files
committed
Rebase 4406 P/R after 4015 was approved in Kona
1 parent 494128e commit 1aac0c5

File tree

1 file changed

+127
-3
lines changed

1 file changed

+127
-3
lines changed

xml/issue4406.xml

Lines changed: 127 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ This would need to use `val` instead of `**this` if LWG <iref ref="4015"/>
5050
is accepted.
5151
</p>
5252

53-
</discussion>
54-
55-
<resolution>
53+
<superseded>
5654
<p>
5755
This wording is relative to <paper num="N5014"/>.
5856
</p>
@@ -168,6 +166,132 @@ return std::forward&lt;U&gt;(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&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) const &amp;;
191+
</pre>
192+
<blockquote>
193+
<p>
194+
-15- <i>Mandates</i>: <code>is_copy_constructible_v&lt;T&gt; &amp;&amp; is_convertible_v&lt;U&amp;&amp;, T&gt;</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&lt;T&gt;(std::forward&lt;U&gt;(v));</del>
201+
<ins>if (has_value())
202+
return <i>val</i>;
203+
return std::forward&lt;U&gt;(v);</ins>
204+
</pre></blockquote>
205+
</blockquote>
206+
<pre>
207+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) &amp;&amp;;
208+
</pre>
209+
<blockquote>
210+
<p>
211+
-17- <i>Mandates</i>: <code>is_move_constructible_v&lt;T&gt; &amp;&amp; is_convertible_v&lt;U&amp;&amp;, T&gt;</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&lt;T&gt;(std::forward&lt;U&gt;(v));</del>
218+
<ins>if (has_value())
219+
return std::move(<i>val</i>);
220+
return std::forward&lt;U&gt;(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&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr remove_cv_t&lt;T&gt; value_or(U&amp;&amp; u) const;
231+
</pre>
232+
<blockquote>
233+
<p>
234+
-8- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.
235+
<p/>
236+
-9- <i>Mandates</i>: <code>is_constructible_v&lt;X, T&amp;&gt; &amp;&amp; is_convertible_v&lt;U, X&gt;</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&lt;X&gt;(std::forward&lt;U&gt;(u));</del>
243+
<ins>if (has_value())
244+
return *<i>val</i>;
245+
return std::forward&lt;U&gt;(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&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) const &amp;;
257+
</pre>
258+
<blockquote>
259+
<p>
260+
-18- <i>Mandates</i>: <code>is_copy_constructible_v&lt;T&gt;</code> is `true` and
261+
<code>is_convertible_v&lt;U, T&gt;</code> is `true`.
262+
<p/>
263+
<del>-19- <i>Returns</i>: <code>has_value() ? **this : static_cast&lt;T&gt;(std::forward&lt;U&gt;(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&lt;U&gt;(v);</ins>
271+
</pre></blockquote>
272+
</blockquote>
273+
<pre>
274+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) &amp;&amp;;
275+
</pre>
276+
<blockquote>
277+
<p>
278+
-20- <i>Mandates</i>: <code>is_move_constructible_v&lt;T&gt;</code> is `true` and
279+
<code>is_convertible_v&lt;U, T&gt;</code> is `true`.
280+
<p/>
281+
<del>-21- <i>Returns</i>: <code>has_value() ? std::move(**this) : static_cast&lt;T&gt;(std::forward&lt;U&gt;(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&lt;U&gt;(v);</ins>
289+
</pre></blockquote>
290+
</blockquote>
291+
</blockquote>
292+
</li>
293+
</ol>
294+
171295
</resolution>
172296

173297
</issue>

0 commit comments

Comments
 (0)