Skip to content

Commit 2866ff9

Browse files
committed
New issue from Hewill Kang: "move_iterator::operator* should have conditional noexcept specification"
1 parent a94a8e2 commit 2866ff9

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

xml/issue4115.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4115" status="New">
5+
<title><tt>move_iterator::operator*</tt> should have conditional <tt>noexcept</tt> specification</title>
6+
<section><sref ref="[move.iter.elem]"/></section>
7+
<submitter>Hewill Kang</submitter>
8+
<date>03 Jul 2024</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
For <tt>move_iterator</tt>, dereferencing it is actually equivalent to applying <tt>iter_move</tt> to it.
14+
<p/>
15+
However, unlike the latter, <tt>move_iterator</tt>'s dereference operator lacks a <tt>noexcept</tt>
16+
specification, which seems to be an oversight given that the standard goes to such great lengths to
17+
preserve the noexceptness of <tt>iter_move</tt>, and the main purpose of <tt>move_iterator</tt> is
18+
precisely to apply <tt>iter_move</tt> to the underlying iterator via dereferencing.
19+
</p>
20+
</discussion>
21+
22+
<resolution>
23+
<p>
24+
This wording is relative to <paper num="N4981"/>.
25+
</p>
26+
27+
<ol>
28+
<li><p>Modify <sref ref="[move.iterator]"/> as indicated:</p>
29+
30+
<blockquote><pre>
31+
namespace std {
32+
template&lt;class Iterator&gt;
33+
class move_iterator {
34+
public:
35+
[&hellip;]
36+
constexpr reference operator*() const <ins>noexcept(noexcept(ranges::iter_move(current)))</ins>;
37+
[&hellip;]
38+
};
39+
}
40+
</pre></blockquote>
41+
42+
</li>
43+
44+
<li><p>Modify <sref ref="[move.iter.elem]"/> as indicated:</p>
45+
46+
<blockquote>
47+
<pre>
48+
constexpr reference operator*() const <ins>noexcept(noexcept(ranges::iter_move(current)))</ins>;
49+
</pre>
50+
<blockquote>
51+
<p>
52+
-1- <i>Effects</i>: Equivalent to: <tt>return ranges::iter_move(current);</tt>
53+
</p>
54+
</blockquote>
55+
</blockquote>
56+
57+
</li>
58+
</ol>
59+
</resolution>
60+
61+
</issue>

0 commit comments

Comments
 (0)