Skip to content

Commit 7b65179

Browse files
author
github-actions
committed
Automatic update from GitHub Actions workflow
1 parent 525f425 commit 7b65179

22 files changed

+485
-42
lines changed

issue4245.html

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Issue 4245: Operators that interact with counted_iterator and default_sentinel_t should be noexcept</title>
6+
<meta property="og:title" content="Issue 4245: Operators that interact with counted_iterator and default_sentinel_t should be noexcept">
7+
<meta property="og:description" content="C++ library issue. Status: New">
8+
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4245.html">
9+
<meta property="og:type" content="website">
10+
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
11+
<meta property="og:image:alt" content="C++ logo">
12+
<style>
13+
p {text-align:justify}
14+
li {text-align:justify}
15+
pre code.backtick::before { content: "`" }
16+
pre code.backtick::after { content: "`" }
17+
blockquote.note
18+
{
19+
background-color:#E0E0E0;
20+
padding-left: 15px;
21+
padding-right: 15px;
22+
padding-top: 1px;
23+
padding-bottom: 1px;
24+
}
25+
ins {background-color:#A0FFA0}
26+
del {background-color:#FFA0A0}
27+
table.issues-index { border: 1px solid; border-collapse: collapse; }
28+
table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
29+
table.issues-index td { padding: 4px; border: 1px solid; }
30+
table.issues-index td:nth-child(1) { text-align: right; }
31+
table.issues-index td:nth-child(2) { text-align: left; }
32+
table.issues-index td:nth-child(3) { text-align: left; }
33+
table.issues-index td:nth-child(4) { text-align: left; }
34+
table.issues-index td:nth-child(5) { text-align: center; }
35+
table.issues-index td:nth-child(6) { text-align: center; }
36+
table.issues-index td:nth-child(7) { text-align: left; }
37+
table.issues-index td:nth-child(5) span.no-pr { color: red; }
38+
@media (prefers-color-scheme: dark) {
39+
html {
40+
color: #ddd;
41+
background-color: black;
42+
}
43+
ins {
44+
background-color: #225522
45+
}
46+
del {
47+
background-color: #662222
48+
}
49+
a {
50+
color: #6af
51+
}
52+
a:visited {
53+
color: #6af
54+
}
55+
blockquote.note
56+
{
57+
background-color: rgba(255, 255, 255, .10)
58+
}
59+
}
60+
</style>
61+
</head>
62+
<body>
63+
<hr>
64+
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
65+
<h3 id="4245"><a href="lwg-active.html#4245">4245</a>. Operators that interact with <code class='backtick'>counted_iterator</code> and <code class='backtick'>default_sentinel_t</code> should be <code class='backtick'>noexcept</code></h3>
66+
<p><b>Section:</b> 24.5.7.1 <a href="https://wg21.link/counted.iterator">[counted.iterator]</a>, 24.5.7.5 <a href="https://wg21.link/counted.iter.nav">[counted.iter.nav]</a>, 24.5.7.6 <a href="https://wg21.link/counted.iter.cmp">[counted.iter.cmp]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
67+
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2025-04-18 <b>Last modified:</b> 2025-04-21</p>
68+
<p><b>Priority: </b>Not Prioritized
69+
</p>
70+
<p><b>View all other</b> <a href="lwg-index.html#counted.iterator">issues</a> in [counted.iterator].</p>
71+
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
72+
<p><b>Discussion:</b></p>
73+
<p>
74+
<code class='backtick'>counted_iterator</code> can be compared or subtracted from <code class='backtick'>default_sentinel_t</code>,
75+
which only involves simple integer arithmetic and does not have any <i>Preconditions</i>.
76+
<p/>
77+
In this case, it is reasonable to declare them as <code>noexcept</code>.
78+
</p>
79+
80+
81+
<p id="res-4245"><b>Proposed resolution:</b></p>
82+
<p>
83+
This wording is relative to <a href="https://wg21.link/N5008">N5008</a>.
84+
</p>
85+
86+
<ol>
87+
88+
<li><p>Modify 24.5.7.1 <a href="https://wg21.link/counted.iterator">[counted.iterator]</a> as indicated:</p>
89+
90+
<blockquote>
91+
<pre>
92+
namespace std {
93+
template&lt;input_or_output_iterator I&gt;
94+
class counted_iterator {
95+
public:
96+
[&hellip;]
97+
friend constexpr iter_difference_t&lt;I&gt; operator-(
98+
const counted_iterator&amp; x, default_sentinel_t) <ins>noexcept</ins>;
99+
friend constexpr iter_difference_t&lt;I&gt; operator-(
100+
default_sentinel_t, const counted_iterator&amp; y) <ins>noexcept</ins>;
101+
[&hellip;]
102+
friend constexpr bool operator==(
103+
const counted_iterator&amp; x, default_sentinel_t) <ins>noexcept</ins>;
104+
[&hellip;]
105+
};
106+
[&hellip;]
107+
}
108+
</pre>
109+
</blockquote>
110+
111+
</li>
112+
113+
<li><p>Modify 24.5.7.5 <a href="https://wg21.link/counted.iter.nav">[counted.iter.nav]</a> as indicated:</p>
114+
115+
<blockquote>
116+
<pre>
117+
friend constexpr iter_difference_t&lt;I&gt; operator-(
118+
const counted_iterator&amp; x, default_sentinel_t) <ins>noexcept</ins>;
119+
</pre>
120+
<blockquote>
121+
<p>
122+
-15- <i>Effects</i>: Equivalent to: <code>return -x.length;</code>
123+
</p>
124+
</blockquote>
125+
<pre>
126+
friend constexpr iter_difference_t&lt;I&gt; operator-(
127+
default_sentinel_t, const counted_iterator&amp; y) <ins>noexcept</ins>;
128+
</pre>
129+
<blockquote>
130+
<p>
131+
-16- <i>Effects</i>: Equivalent to: <code>return y.length;</code>
132+
</p>
133+
</blockquote>
134+
</blockquote>
135+
136+
</li>
137+
138+
<li><p>Modify 24.5.7.6 <a href="https://wg21.link/counted.iter.cmp">[counted.iter.cmp]</a> as indicated:</p>
139+
140+
<blockquote>
141+
<pre>
142+
friend constexpr bool operator==(
143+
const counted_iterator&amp; x, default_sentinel_t) <ins>noexcept</ins>;
144+
</pre>
145+
<blockquote>
146+
<p>
147+
-3- <i>Effects</i>: Equivalent to: <code>return x.length == 0;</code>
148+
</p>
149+
</blockquote>
150+
</blockquote>
151+
152+
</li>
153+
154+
</ol>
155+
156+
157+
158+
159+
160+
</body>
161+
</html>

0 commit comments

Comments
 (0)