Skip to content

Commit 6bba77a

Browse files
author
github-actions
committed
Automatic update from GitHub Actions workflow
1 parent 900dbd6 commit 6bba77a

29 files changed

+577
-47
lines changed

issue1110.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="1110"><a href="lwg-defects.html#1110">1110</a>. Is <code>for_each</code>
6767
<b>Submitter:</b> Alisdair Meredith <b>Opened:</b> 2009-04-29 <b>Last modified:</b> 2016-01-28</p>
6868
<p><b>Priority: </b>Not Prioritized
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#C++11">C++11</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue2747.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="2747"><a href="lwg-defects.html#2747">2747</a>. Possibly redundant <code
6767
<b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2016-07-15 <b>Last modified:</b> 2017-07-30</p>
6868
<p><b>Priority: </b>0
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue290.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="290"><a href="lwg-closed.html#290">290</a>. Requirements to for_each and
6767
<b>Submitter:</b> Angelika Langer <b>Opened:</b> 2001-01-03 <b>Last modified:</b> 2016-01-28</p>
6868
<p><b>Priority: </b>Not Prioritized
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue3213.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="3213"><a href="lwg-defects.html#3213">3213</a>. <code>for_each_n</code>
6767
<b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2019-05-31 <b>Last modified:</b> 2020-11-09</p>
6868
<p><b>Priority: </b>3
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue3793.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="3793"><a href="lwg-active.html#3793">3793</a>. Requirements for some alg
6767
<b>Submitter:</b> Jiang An <b>Opened:</b> 2022-10-05 <b>Last modified:</b> 2022-10-12</p>
6868
<p><b>Priority: </b>3
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue4241.html

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Issue 4241: ranges::for_each(_n) should be less constrained</title>
6+
<meta property="og:title" content="Issue 4241: ranges::for_each(_n) should be less constrained">
7+
<meta property="og:description" content="C++ library issue. Status: New">
8+
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4241.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="4241"><a href="lwg-active.html#4241">4241</a>. <code class='backtick'>ranges::for_each(_n)</code> should be less constrained</h3>
66+
<p><b>Section:</b> 26.6.5 <a href="https://wg21.link/alg.foreach">[alg.foreach]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
67+
<b>Submitter:</b> Jiang An <b>Opened:</b> 2025-04-08 <b>Last modified:</b> 2025-04-13</p>
68+
<p><b>Priority: </b>Not Prioritized
69+
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
71+
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
72+
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
73+
<p><b>Discussion:</b></p>
74+
<p>
75+
Currently, <code class='backtick'>ranges::for_each(_n)</code> are constrained with <code class='backtick'>indirectly_unary_invocable</code>,
76+
which doesn't meet the actual use of the range elements. These algorithms are only
77+
expected to invoke the callable object with the possibly projected elements, and not
78+
to use any element as the value type. Moreover, <code class='backtick'>indirectly_unary_invocable</code> requires
79+
the callable object to be copy constructible, which might be undesired because the
80+
corresponding <code class='backtick'>std::for_each(_n)</code> only require move constructibilty.
81+
<p/>
82+
LWG <a href="lwg-active.html#4171" title="P2609R3 breaks code that uses views::zip and get&lt;T&gt; (Status: New)">4171</a><sup><a href="https://cplusplus.github.io/LWG/issue4171" title="Latest snapshot">(i)</a></sup> talked about the breakage around <code class='backtick'>ranges::for_each</code> introduced
83+
by <a href="https://wg21.link/P2609R3" title=" Relaxing Ranges Just A Smidge">P2609R3</a>. P2609R3 looks like a reasonable fix as long as the affected
84+
algorithms potentially use the intermediate element values copied as
85+
<code>std::iter_value_t&lt;I&gt;</code>. However, when the algorithm is not expected to or
86+
even required not to do this, P2609R3 can bring unexpected impacts. It seems that
87+
constraints around <code class='backtick'>iter_value_t</code> should be avoided for such an algorithm.
88+
</p>
89+
90+
91+
<p id="res-4241"><b>Proposed resolution:</b></p>
92+
<p>
93+
This wording is relative to <a href="https://wg21.link/N5008">N5008</a>.
94+
</p>
95+
96+
<ol>
97+
98+
<li><p>Modify 26.4 <a href="https://wg21.link/algorithm.syn">[algorithm.syn]</a>, header <code>&lt;algorithm&gt;</code> synopsis, as indicated:</p>
99+
100+
<blockquote>
101+
<pre>
102+
[&hellip;]
103+
namespace ranges {
104+
template&lt;class I, class F&gt;
105+
using for_each_result = in_fun_result&lt;I, F&gt;;
106+
107+
template&lt;input_iterator I, sentinel_for&lt;I&gt; S, class Proj = identity,
108+
<del>indirectly_unary_invocable&lt;projected&lt;I, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
109+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;I, Proj&gt;&gt;&gt;</ins>
110+
constexpr for_each_result&lt;I, Fun&gt;
111+
for_each(I first, S last, Fun f, Proj proj = {});
112+
template&lt;input_range R, class Proj = identity,
113+
<del>indirectly_unary_invocable&lt;projected&lt;iterator_t&lt;R&gt;, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
114+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;iterator_t&lt;R&gt;, Proj&gt;&gt;&gt;</ins>
115+
constexpr for_each_result&lt;borrowed_iterator_t&lt;R&gt;, Fun&gt;
116+
for_each(R&amp;&amp; r, Fun f, Proj proj = {});
117+
}
118+
[&hellip;]
119+
namespace ranges {
120+
template&lt;class I, class F&gt;
121+
using for_each_n_result = in_fun_result&lt;I, F&gt;;
122+
123+
template&lt;input_iterator I, class Proj = identity,
124+
<del>indirectly_unary_invocable&lt;projected&lt;I, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
125+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;I, Proj&gt;&gt;&gt;</ins>
126+
constexpr for_each_n_result&lt;I, Fun&gt;
127+
for_each_n(I first, iter_difference_t&lt;I&gt; n, Fun f, Proj proj = {});
128+
}
129+
[&hellip;]
130+
</pre>
131+
</blockquote>
132+
133+
</li>
134+
135+
<li><p>Modify 26.6.5 <a href="https://wg21.link/alg.foreach">[alg.foreach]</a> as indicated:</p>
136+
137+
<blockquote>
138+
<pre>
139+
template&lt;input_iterator I, sentinel_for&lt;I&gt; S, class Proj = identity,
140+
<del>indirectly_unary_invocable&lt;projected&lt;I, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
141+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;I, Proj&gt;&gt;&gt;</ins>
142+
constexpr ranges::for_each_result&lt;I, Fun&gt;
143+
ranges::for_each(I first, S last, Fun f, Proj proj = {});
144+
template&lt;input_range R, class Proj = identity,
145+
<del>indirectly_unary_invocable&lt;projected&lt;iterator_t&lt;R&gt;, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
146+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;iterator_t&gt;R&gt;, Proj&gt;&gt;&gt;</ins>
147+
constexpr ranges::for_each_result&lt;borrowed_iterator_t&lt;R&gt;, Fun&gt;
148+
ranges::for_each(R&amp;&amp; r, Fun f, Proj proj = {});
149+
</pre>
150+
<blockquote>
151+
<p>
152+
[&hellip;]
153+
<p/>
154+
<del>-15- [<i>Note 6</i>: The overloads in namespace <code class='backtick'>ranges</code> require <code class='backtick'>Fun</code> to model <code class='backtick'>copy_constructible</code>. &mdash; <i>end note</i>]</del>
155+
</p>
156+
</blockquote>
157+
<p>
158+
[&hellip;]
159+
</p>
160+
<pre>
161+
template&lt;input_iterator I, class Proj = identity,
162+
<del>indirectly_unary_invocable&lt;projected&lt;I, Proj&gt;&gt;</del><ins>move_constructible</ins> Fun&gt;
163+
<ins>requires invocable&lt;Fun&amp;, iter_reference_t&lt;projected&lt;I, Proj&gt;&gt;&gt;</ins>
164+
constexpr ranges::for_each_n_result&lt;I, Fun&gt;
165+
ranges::for_each_n(I first, iter_difference_t&lt;I&gt; n, Fun f, Proj proj = {});
166+
</pre>
167+
<blockquote>
168+
<p>
169+
[&hellip;]
170+
<p/>
171+
<del>-30- [<i>Note 11</i>: The overload in namespace <code class='backtick'>ranges</code> requires <code class='backtick'>Fun</code> to model <code class='backtick'>copy_constructible</code>. &mdash; <i>end note</i>]</del>
172+
</p>
173+
</blockquote>
174+
</blockquote>
175+
176+
</li>
177+
178+
</ol>
179+
180+
181+
182+
183+
184+
</body>
185+
</html>

issue475.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="475"><a href="lwg-defects.html#475">475</a>. May the function object pas
6767
<b>Submitter:</b> Stephan T. Lavavej, Jaakko Jarvi <b>Opened:</b> 2004-07-09 <b>Last modified:</b> 2016-01-28</p>
6868
<p><b>Priority: </b>Not Prioritized
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#CD1">CD1</a> status.</p>
7273
<p><b>Discussion:</b></p>

issue969.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h3 id="969"><a href="lwg-closed.html#969">969</a>. What happened to Library Iss
6767
<b>Submitter:</b> Stephan T. Lavavej <b>Opened:</b> 2009-01-12 <b>Last modified:</b> 2016-01-28</p>
6868
<p><b>Priority: </b>Not Prioritized
6969
</p>
70+
<p><b>View other</b> <a href="lwg-index-open.html#alg.foreach">active issues</a> in [alg.foreach].</p>
7071
<p><b>View all other</b> <a href="lwg-index.html#alg.foreach">issues</a> in [alg.foreach].</p>
7172
<p><b>View all issues with</b> <a href="lwg-status.html#NAD Editorial">NAD Editorial</a> status.</p>
7273
<p><b>Discussion:</b></p>

0 commit comments

Comments
 (0)