Skip to content

Commit 1fbb185

Browse files
author
github-actions
committed
Automatic update from GitHub Actions workflow
1 parent 94a6178 commit 1fbb185

22 files changed

+500
-42
lines changed

issue4220.html

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Issue 4220: join_view incorrectly stores inner range</title>
6+
<meta property="og:title" content="Issue 4220: join_view incorrectly stores inner range">
7+
<meta property="og:description" content="C++ library issue. Status: New">
8+
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4220.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="4220"><a href="lwg-active.html#4220">4220</a>. <code>join_view</code> incorrectly stores inner range</h3>
66+
<p><b>Section:</b> 25.7.14.2 <a href="https://wg21.link/range.join.view">[range.join.view]</a>, 25.7.15.2 <a href="https://wg21.link/range.join.with.view">[range.join.with.view]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
67+
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2025-03-06 <b>Last modified:</b> 2025-03-09</p>
68+
<p><b>Priority: </b>Not Prioritized
69+
</p>
70+
<p><b>View all other</b> <a href="lwg-index.html#range.join.view">issues</a> in [range.join.view].</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+
When the inner range is a prvalue, <code>join_view</code> removes its <i>cv</i>-qualifiers
75+
and stores it in the <code><i>propagating-cache</i></code>, which is not quite right as the inner range may
76+
only be const-iterable (<a href="https://godbolt.org/z/qY1bhExzG">demo</a>):
77+
</p>
78+
<blockquote><pre>
79+
#include &lt;ranges&gt;
80+
81+
struct R {
82+
int* begin() = delete;
83+
int* end() = delete;
84+
const int* begin() const;
85+
const int* end() const;
86+
};
87+
88+
int main() {
89+
auto r = std::views::iota(0, 5)
90+
| std::views::transform([](int) -> const R { return {}; })
91+
| std::views::join;
92+
auto b = r.begin(); // <span style="color:red;font-weight:bolder">hard error</span>
93+
}
94+
</pre></blockquote>
95+
<p>
96+
The proposed resolution preserves the inner range's original qualifiers, which is consistent with how
97+
<code>cache_latest_view</code> stores the reference when it is a prvalue.
98+
The same goes for <code>join_with_view</code>.
99+
</p>
100+
101+
102+
<p id="res-4220"><b>Proposed resolution:</b></p>
103+
<p>
104+
This wording is relative to <a href="https://wg21.link/N5001">N5001</a>.
105+
</p>
106+
107+
<ol>
108+
109+
<li><p>Modify 25.7.14.2 <a href="https://wg21.link/range.join.view">[range.join.view]</a> as indicated:</p>
110+
111+
<blockquote>
112+
<pre>
113+
namespace std::ranges {
114+
template&lt;input_range V&gt;
115+
requires view&lt;V&gt; &amp;&amp; input_range&lt;range_reference_t&lt;V&gt;&gt;&gt;
116+
class join_view : public view_interface&lt;join_view&lt;V&gt;&gt; {
117+
private:
118+
using <i>InnerRng</i> = range_reference_t&lt;V&gt;; // <i>exposition only</i>
119+
[&hellip;]
120+
<i>non-propagating-cache</i>&lt;<del>remove_cv_t&lt;</del><i>InnerRng</i><del>&gt;</del>&gt; <i>inner_</i>; // <i>exposition only, present only</i>
121+
// <i>if is_reference_v&lt;<i>InnerRng</i>&gt; is false</i>
122+
123+
public:
124+
[&hellip;]
125+
};
126+
[&hellip;]
127+
}
128+
</pre>
129+
</blockquote>
130+
</li>
131+
132+
<li><p>Modify 25.7.15.2 <a href="https://wg21.link/range.join.with.view">[range.join.with.view]</a> as indicated:</p>
133+
134+
<blockquote>
135+
<pre>
136+
namespace std::ranges {
137+
[&hellip;]
138+
template&lt;input_range V, forward_range Pattern&gt;
139+
requires view&lt;V&gt; &amp;&amp; input_range&lt;range_reference_t&lt;V&gt;&gt;
140+
&amp;&amp; view&lt;Pattern&gt;
141+
&amp;&amp; <i>concatable</i>&lt;range_reference_t&lt;V&gt;, Pattern&gt;
142+
class join_with_view : public view_interface&lt;join_with_view&lt;V, Pattern&gt;&gt; {
143+
using <i>InnerRng</i> = range_reference_t&lt;V&gt;; // <i>exposition only</i>
144+
[&hellip;]
145+
<i>non-propagating-cache</i>&lt;<del>remove_cv_t&lt;</del><i>InnerRng</i><del>&gt;</del>&gt; <i>inner_</i>; // <i>exposition only, present only</i>
146+
// <i>if is_reference_v&lt;<i>InnerRng</i>&gt; is false</i>
147+
148+
[&hellip;]
149+
public:
150+
[&hellip;]
151+
};
152+
[&hellip;]
153+
}
154+
155+
</pre>
156+
</blockquote>
157+
</li>
158+
</ol>
159+
160+
161+
162+
163+
164+
165+
</body>
166+
</html>

0 commit comments

Comments
 (0)