Skip to content

Commit c3d0869

Browse files
author
github-actions
committed
Automatic update from GitHub Actions workflow
1 parent 0927d17 commit c3d0869

22 files changed

+297
-51
lines changed

issue4121.html

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<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>
6565
<h3 id="4121"><a href="lwg-active.html#4121">4121</a>. <code>ranges::to</code> constructs associative containers via <code>c.emplace(c.end(), *it)</code></h3>
6666
<p><b>Section:</b> 25.5.7.1 <a href="https://wg21.link/range.utility.conv.general">[range.utility.conv.general]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
67-
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2024-07-16 <b>Last modified:</b> 2024-08-02</p>
67+
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2024-07-16 <b>Last modified:</b> 2025-03-17</p>
6868
<p><b>Priority: </b>2
6969
</p>
7070
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
@@ -112,9 +112,9 @@ <h3 id="4121"><a href="lwg-active.html#4121">4121</a>. <code>ranges::to</code> c
112112
"It might be suboptimal, but it still works."
113113
</p>
114114

115+
<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
116+
<blockquote class="note">
115117

116-
117-
<p id="res-4121"><b>Proposed resolution:</b></p>
118118
<p>
119119
This wording is relative to <a href="https://wg21.link/N4986" title=" Working Draft, Programming Languages — C++">N4986</a>.
120120
</p>
@@ -158,6 +158,88 @@ <h3 id="4121"><a href="lwg-active.html#4121">4121</a>. <code>ranges::to</code> c
158158

159159
</li>
160160
</ol>
161+
</blockquote>
162+
163+
<p><i>[2025-03-13; Jonathan provides improved wording for Tim's suggestion]</i></p>
164+
165+
<p>
166+
It's true that for some cases it might be optimal to use <code class='backtick'>c.emplace(ref)</code>
167+
instead of <code class='backtick'>c.emplace_hint(c.end(), ref)</code> but I don't think I care.
168+
A bad hint is not expensive, it's just an extra comparison then the hint
169+
is ignored.
170+
And this code path isn't going to be used for <code class='backtick'>std::set</code> or <code class='backtick'>std::map</code>,
171+
only for user-defined associative containers that don't have a <code class='backtick'>from_range_t</code>
172+
constructor or a <code class='backtick'>C(Iter,Sent)</code> constructor.
173+
I think just fixing the original issue is all we need,
174+
rather than trying to handle every possible way to insert elements.
175+
</p>
176+
<p>
177+
This is a simpler, portable reproducer that doesn't depend on the current
178+
implementation status of <code class='backtick'>std::set</code> in libstdc++:
179+
</p>
180+
<blockquote><pre><code>
181+
#include &lt;ranges&gt;
182+
#include &lt;set&gt;
183+
struct Set : std::set&lt;int&gt; {
184+
Set() { }; // No other constructors
185+
};
186+
int main() {
187+
int a[1];
188+
auto okay = std::ranges::to&lt;std::set&lt;int&gt;&gt;(a);
189+
auto ohno = std::ranges::to&lt;Set&gt;(a);
190+
}
191+
</code></pre></blockquote>
192+
193+
194+
195+
<p id="res-4121"><b>Proposed resolution:</b></p>
196+
<p>
197+
This wording is relative to <a href="https://wg21.link/N5001">N5001</a>.
198+
</p>
199+
200+
<ol>
201+
<li><p>Modify 25.5.7.1 <a href="https://wg21.link/range.utility.conv.general">[range.utility.conv.general]</a> as indicated:</p>
202+
203+
<blockquote>
204+
<p>
205+
-4- Let <code><i>container-appendable</i></code> be defined as follows:
206+
</p>
207+
<blockquote><pre>
208+
template&lt;class Container, class Ref&gt;
209+
constexpr bool <i>container-appendable</i> = <i>// exposition only</i>
210+
requires(Container&amp; c, Ref&amp;&amp; ref) {
211+
requires (requires { c.emplace_back(std::forward&lt;Ref&gt;(ref)); } ||
212+
requires { c.push_back(std::forward&lt;Ref&gt;(ref)); } ||
213+
<ins>requires { c.emplace_hint(c.end(), std::forward&lt;Ref&gt;(ref)); } ||</ins>
214+
requires { c.emplace(c.end(), std::forward&lt;Ref&gt;(ref)); } ||
215+
requires { c.insert(c.end(), std::forward&lt;Ref&gt;(ref)); });
216+
};
217+
</pre></blockquote>
218+
<p>
219+
-5- Let <code><i>container-append</i></code> be defined as follows:
220+
</p>
221+
<blockquote><pre>
222+
template&lt;class Container&gt;
223+
constexpr auto <i>container-append</i>(Container&amp; c) { <i>// exposition only</i>
224+
return [&amp;c]&lt;class Ref&gt;(Ref&amp;&amp; ref) {
225+
if constexpr (requires { c.emplace_back(declval&lt;Ref&gt;()); })
226+
c.emplace_back(std::forward&lt;Ref&gt;(ref));
227+
else if constexpr (requires { c.push_back(declval&lt;Ref&gt;()); })
228+
c.push_back(std::forward&lt;Ref&gt;(ref));
229+
<ins>else if constexpr (requires { c.emplace_hint(c.end(), declval&lt;Ref&gt;()); })
230+
c.emplace_hint(c.end(), std::forward&lt;Ref&gt;(ref));</ins>
231+
else if constexpr (requires { c.emplace(c.end(), declval&lt;Ref&gt;()); })
232+
c.emplace(c.end(), std::forward&lt;Ref&gt;(ref));
233+
else
234+
c.insert(c.end(), std::forward&lt;Ref&gt;(ref));
235+
};
236+
};
237+
</pre></blockquote>
238+
</blockquote>
239+
240+
</li>
241+
</ol>
242+
161243

162244

163245

lwg-active.html

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</tr>
6868
<tr>
6969
<td align="left">Date:</td>
70-
<td align="left">2025-03-16</td>
70+
<td align="left">2025-03-17</td>
7171
</tr>
7272
<tr>
7373
<td align="left">Project:</td>
@@ -79,7 +79,7 @@
7979
</tr>
8080
</table>
8181
<h1>C++ Standard Library Active Issues List (Revision D125)</h1>
82-
<p>Revised 2025-03-16 at 09:09:08 UTC
82+
<p>Revised 2025-03-17 at 15:39:10 UTC
8383
</p>
8484
<p>Reference ISO/IEC IS 14882:2020(E)</p>
8585
<p>Also see:</p>
@@ -62330,7 +62330,7 @@ <h3 id="4120"><a href="#4120">4120</a><sup><a href="https://cplusplus.github.io/
6233062330
<hr>
6233162331
<h3 id="4121"><a href="#4121">4121</a><sup><a href="https://cplusplus.github.io/LWG/issue4121">(i)</a></sup>. <code>ranges::to</code> constructs associative containers via <code>c.emplace(c.end(), *it)</code></h3>
6233262332
<p><b>Section:</b> 25.5.7.1 <a href="https://wg21.link/range.utility.conv.general">[range.utility.conv.general]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
62333-
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2024-07-16 <b>Last modified:</b> 2024-08-02</p>
62333+
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2024-07-16 <b>Last modified:</b> 2025-03-17</p>
6233462334
<p><b>Priority: </b>2
6233562335
</p>
6233662336
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
@@ -62378,9 +62378,9 @@ <h3 id="4121"><a href="#4121">4121</a><sup><a href="https://cplusplus.github.io/
6237862378
"It might be suboptimal, but it still works."
6237962379
</p>
6238062380

62381+
<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
62382+
<blockquote class="note">
6238162383

62382-
62383-
<p id="res-4121"><b>Proposed resolution:</b></p>
6238462384
<p>
6238562385
This wording is relative to <a href="https://wg21.link/N4986" title=" Working Draft, Programming Languages — C++">N4986</a>.
6238662386
</p>
@@ -62424,6 +62424,88 @@ <h3 id="4121"><a href="#4121">4121</a><sup><a href="https://cplusplus.github.io/
6242462424

6242562425
</li>
6242662426
</ol>
62427+
</blockquote>
62428+
62429+
<p><i>[2025-03-13; Jonathan provides improved wording for Tim's suggestion]</i></p>
62430+
62431+
<p>
62432+
It's true that for some cases it might be optimal to use <code class='backtick'>c.emplace(ref)</code>
62433+
instead of <code class='backtick'>c.emplace_hint(c.end(), ref)</code> but I don't think I care.
62434+
A bad hint is not expensive, it's just an extra comparison then the hint
62435+
is ignored.
62436+
And this code path isn't going to be used for <code class='backtick'>std::set</code> or <code class='backtick'>std::map</code>,
62437+
only for user-defined associative containers that don't have a <code class='backtick'>from_range_t</code>
62438+
constructor or a <code class='backtick'>C(Iter,Sent)</code> constructor.
62439+
I think just fixing the original issue is all we need,
62440+
rather than trying to handle every possible way to insert elements.
62441+
</p>
62442+
<p>
62443+
This is a simpler, portable reproducer that doesn't depend on the current
62444+
implementation status of <code class='backtick'>std::set</code> in libstdc++:
62445+
</p>
62446+
<blockquote><pre><code>
62447+
#include &lt;ranges&gt;
62448+
#include &lt;set&gt;
62449+
struct Set : std::set&lt;int&gt; {
62450+
Set() { }; // No other constructors
62451+
};
62452+
int main() {
62453+
int a[1];
62454+
auto okay = std::ranges::to&lt;std::set&lt;int&gt;&gt;(a);
62455+
auto ohno = std::ranges::to&lt;Set&gt;(a);
62456+
}
62457+
</code></pre></blockquote>
62458+
62459+
62460+
62461+
<p id="res-4121"><b>Proposed resolution:</b></p>
62462+
<p>
62463+
This wording is relative to <a href="https://wg21.link/N5001">N5001</a>.
62464+
</p>
62465+
62466+
<ol>
62467+
<li><p>Modify 25.5.7.1 <a href="https://wg21.link/range.utility.conv.general">[range.utility.conv.general]</a> as indicated:</p>
62468+
62469+
<blockquote>
62470+
<p>
62471+
-4- Let <code><i>container-appendable</i></code> be defined as follows:
62472+
</p>
62473+
<blockquote><pre>
62474+
template&lt;class Container, class Ref&gt;
62475+
constexpr bool <i>container-appendable</i> = <i>// exposition only</i>
62476+
requires(Container&amp; c, Ref&amp;&amp; ref) {
62477+
requires (requires { c.emplace_back(std::forward&lt;Ref&gt;(ref)); } ||
62478+
requires { c.push_back(std::forward&lt;Ref&gt;(ref)); } ||
62479+
<ins>requires { c.emplace_hint(c.end(), std::forward&lt;Ref&gt;(ref)); } ||</ins>
62480+
requires { c.emplace(c.end(), std::forward&lt;Ref&gt;(ref)); } ||
62481+
requires { c.insert(c.end(), std::forward&lt;Ref&gt;(ref)); });
62482+
};
62483+
</pre></blockquote>
62484+
<p>
62485+
-5- Let <code><i>container-append</i></code> be defined as follows:
62486+
</p>
62487+
<blockquote><pre>
62488+
template&lt;class Container&gt;
62489+
constexpr auto <i>container-append</i>(Container&amp; c) { <i>// exposition only</i>
62490+
return [&amp;c]&lt;class Ref&gt;(Ref&amp;&amp; ref) {
62491+
if constexpr (requires { c.emplace_back(declval&lt;Ref&gt;()); })
62492+
c.emplace_back(std::forward&lt;Ref&gt;(ref));
62493+
else if constexpr (requires { c.push_back(declval&lt;Ref&gt;()); })
62494+
c.push_back(std::forward&lt;Ref&gt;(ref));
62495+
<ins>else if constexpr (requires { c.emplace_hint(c.end(), declval&lt;Ref&gt;()); })
62496+
c.emplace_hint(c.end(), std::forward&lt;Ref&gt;(ref));</ins>
62497+
else if constexpr (requires { c.emplace(c.end(), declval&lt;Ref&gt;()); })
62498+
c.emplace(c.end(), std::forward&lt;Ref&gt;(ref));
62499+
else
62500+
c.insert(c.end(), std::forward&lt;Ref&gt;(ref));
62501+
};
62502+
};
62503+
</pre></blockquote>
62504+
</blockquote>
62505+
62506+
</li>
62507+
</ol>
62508+
6242762509

6242862510

6242962511

lwg-closed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</tr>
6868
<tr>
6969
<td align="left">Date:</td>
70-
<td align="left">2025-03-16</td>
70+
<td align="left">2025-03-17</td>
7171
</tr>
7272
<tr>
7373
<td align="left">Project:</td>
@@ -79,7 +79,7 @@
7979
</tr>
8080
</table>
8181
<h1>C++ Standard Library Closed Issues List (Revision D125)</h1>
82-
<p>Revised 2025-03-16 at 09:09:08 UTC
82+
<p>Revised 2025-03-17 at 15:39:10 UTC
8383
</p>
8484
<p>Reference ISO/IEC IS 14882:2020(E)</p>
8585
<p>Also see:</p>

lwg-defects.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</tr>
6868
<tr>
6969
<td align="left">Date:</td>
70-
<td align="left">2025-03-16</td>
70+
<td align="left">2025-03-17</td>
7171
</tr>
7272
<tr>
7373
<td align="left">Project:</td>
@@ -79,7 +79,7 @@
7979
</tr>
8080
</table>
8181
<h1>C++ Standard Library Defect Reports and Accepted Issues (Revision D125)</h1>
82-
<p>Revised 2025-03-16 at 09:09:08 UTC
82+
<p>Revised 2025-03-17 at 15:39:10 UTC
8383
</p>
8484
<p>Reference ISO/IEC IS 14882:2020(E)</p>
8585
<p>Also see:</p>

lwg-immediate.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h1>C++ Standard Library Issues Resolved Directly In [INSERT CURRENT MEETING HER
6262
</tr>
6363
<tr>
6464
<td align="left">Date:</td>
65-
<td align="left">Revised 2025-03-16 at 09:09:08 UTC
65+
<td align="left">Revised 2025-03-17 at 15:39:10 UTC
6666
</td>
6767
</tr>
6868
<tr>

lwg-index-open.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h1>Index by Section</h1>
6666
<p>This document is the Index by Section for the <a href="lwg-active.html">Library Active Issues List</a>.</p>
6767
<h2>Index by Section (non-Ready active issues only)</h2>
6868
<p><a href="lwg-index.html">(view all issues)</a></p>
69-
<p>Revised 2025-03-16 at 09:09:08 UTC
69+
<p>Revised 2025-03-17 at 15:39:10 UTC
7070
</p><h2 id="Section_3">Section 3 (2 issues)</h2>
7171
<p><a href="lwg-index.html#Section_3">(view all issues)</a></p>
7272
<table class="issues-index">

lwg-index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h1>Index by Section</h1>
6666
<p>This document is the Index by Section for the <a href="lwg-active.html">Library Active Issues List</a>, <a href="lwg-defects.html">Library Defect Reports and Accepted Issues</a>, and <a href="lwg-closed.html">Library Closed Issues List</a>.</p>
6767
<h2>Index by Section</h2>
6868
<p><a href="lwg-index-open.html">(view only non-Ready open issues)</a></p>
69-
<p>Revised 2025-03-16 at 09:09:08 UTC
69+
<p>Revised 2025-03-17 at 15:39:10 UTC
7070
</p><h2 id="Section_2">Section 2 (2 issues)</h2>
7171
<table class="issues-index">
7272
<tr>

lwg-ready.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h1>C++ Standard Library Issues to be moved in [INSERT CURRENT MEETING HERE]</h1
6262
</tr>
6363
<tr>
6464
<td align="left">Date:</td>
65-
<td align="left">Revised 2025-03-16 at 09:09:08 UTC
65+
<td align="left">Revised 2025-03-17 at 15:39:10 UTC
6666
</td>
6767
</tr>
6868
<tr>

lwg-status-date.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h1>Index by Status and Date</h1>
6767
This document is the Index by Status and Date for the <a href="lwg-active.html">Library Active Issues List</a>,
6868
<a href="lwg-defects.html">Library Defect Reports and Accepted Issues</a>, and <a href="lwg-closed.html">Library Closed Issues List</a>.
6969
</p>
70-
<p>Revised 2025-03-16 at 09:09:08 UTC
70+
<p>Revised 2025-03-17 at 15:39:10 UTC
7171
</p><h2 id="Ready">Ready (7 issues)</h2>
7272
<table class="issues-index">
7373
<tr>
@@ -314,6 +314,15 @@ <h2 id="New">New (464 issues)</h2>
314314
<th>Duplicates</th>
315315
</tr>
316316
<tr>
317+
<td id="4121"><a href="lwg-active.html#4121" title="ranges::to constructs associative containers via c.emplace(c.end(), *it) (Status: New)">4121</a><sup><a href="https://cplusplus.github.io/LWG/issue4121">(i)</a></sup></td>
318+
<td><a href="lwg-active.html#New">New</a></td>
319+
<td>25.5.7.1 [range.utility.conv.general]</td>
320+
<td><code>ranges::to</code> constructs associative containers via <code>c.emplace(c.end(), *it)</code></td>
321+
<td>Yes</td>
322+
<td>2</td>
323+
<td></td>
324+
</tr>
325+
<tr>
317326
<td id="4226"><a href="lwg-active.html#4226" title="to_input_view::iterator cannot be compared to its const sentinel (Status: New)">4226</a><sup><a href="https://cplusplus.github.io/LWG/issue4226">(i)</a></sup></td>
318327
<td><a href="lwg-active.html#New">New</a></td>
319328
<td>99 [range.to.input]</td>
@@ -1040,15 +1049,6 @@ <h2 id="New">New (464 issues)</h2>
10401049
<td></td>
10411050
</tr>
10421051
<tr>
1043-
<td id="4121"><a href="lwg-active.html#4121" title="ranges::to constructs associative containers via c.emplace(c.end(), *it) (Status: New)">4121</a><sup><a href="https://cplusplus.github.io/LWG/issue4121">(i)</a></sup></td>
1044-
<td><a href="lwg-active.html#New">New</a></td>
1045-
<td>25.5.7.1 [range.utility.conv.general]</td>
1046-
<td><code>ranges::to</code> constructs associative containers via <code>c.emplace(c.end(), *it)</code></td>
1047-
<td>Yes</td>
1048-
<td>2</td>
1049-
<td></td>
1050-
</tr>
1051-
<tr>
10521052
<td id="4081"><a href="lwg-active.html#4081" title="concat_view::iterator::operator- is overconstrained (Status: New)">4081</a><sup><a href="https://cplusplus.github.io/LWG/issue4081">(i)</a></sup></td>
10531053
<td><a href="lwg-active.html#New">New</a></td>
10541054
<td>25.7.18.3 [range.concat.iterator]</td>

lwg-status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h1>Index by Status and Section</h1>
6262
<a href="lwg-defects.html">Library Defect Reports and Accepted Issues</a>, and <a href="lwg-closed.html">Library Closed Issues List</a>.
6363
</p>
6464

65-
<p>Revised 2025-03-16 at 09:09:08 UTC
65+
<p>Revised 2025-03-17 at 15:39:10 UTC
6666
</p><h2 id="Ready">Ready (7 issues)</h2>
6767
<table class="issues-index">
6868
<tr>

0 commit comments

Comments
 (0)