Skip to content

Commit a5ce43d

Browse files
committed
New issue from S.B. Tam: Make deref-move constexpr
1 parent 02cc135 commit a5ce43d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

xml/issue4452.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4452" status="New">
5+
<title>Make <i>deref-move</i> constexpr</title>
6+
<section><sref ref="[specialized.algorithms.general]"/></section>
7+
<submitter>S.B. Tam</submitter>
8+
<date>05 Nov 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
`std::uninitialized_move` and `std::uninitialized_move_n` are constexpr and invoke <i>`deref-move`</i>,
14+
but <i>`deref-move`</i> is not constexpr. This looks like an obvious mistake.
15+
</p>
16+
17+
<p>
18+
Jiang An pointed out that <paper num="P3508R0"/> and LWG <iref ref="3918"/>,
19+
both touching `std::uninitialized_move(_n)`, were adopted at the same meeting,
20+
and unfortunately none of them was aware of the other.
21+
</p>
22+
</discussion>
23+
24+
<resolution>
25+
<p>
26+
This wording is relative to <paper num="N5014"/>.
27+
</p>
28+
29+
<ol>
30+
<li><p>Modify <sref ref="[specialized.algorithms.general]"/>, as indicated:</p>
31+
32+
<blockquote>
33+
<pre>
34+
template&lt;class I&gt;
35+
decltype(auto) <i>deref-move</i>(I&amp; it) {
36+
constexpr decltype(auto) <i>deref-move</i>(I&amp; it) {
37+
if constexpr (is_lvalue_reference_v&lt;decltype(*it)&gt;)
38+
return std::move(*it);
39+
else
40+
return *it;
41+
}
42+
</pre>
43+
</blockquote>
44+
</li>
45+
</ol>
46+
47+
</resolution>
48+
49+
</issue>

0 commit comments

Comments
 (0)