Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 84 additions & 3 deletions xml/issue4316.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ Set priority to 1 after reflector poll.
</p>

<note>2025-10-27; Tomasz provides wording.</note>
</discussion>

<resolution>
<superseded>

<p>
This wording is relative to <paper num="N5014"/>.
Expand Down Expand Up @@ -126,6 +124,89 @@ context, the program is ill-formed. &mdash; <i>end note</i>]
</li>
</ol>

</superseded>

<note>2025-10-27; Reflector comments.</note>
<p>
We lost definition of `Z`. Use <tt><i>TARG-SPLICE</i>([:Args:])...</tt>.
</p>

<note>2025-11-03; Tomasz provides wording.</note>
</discussion>

<resolution>

<p>
This wording is relative to <paper num="N5014"/>.
</p>

<ol>

<li><p>Modify <sref ref="[meta.reflection.substitute]"/> as indicated:</p>

<blockquote>
<blockquote>
<p>
<ins>-1- For value `x` of type `info`, and prvalue constant expression `X` that computes the
reflection held by `x`, let <tt><i>TARG-SPLICE</i>(x)</tt> be:</ins>
<ul>
<li><ins>-1.1- <tt>template [: X :]</tt> if `is_template(x)` is `true`, otherwise</ins></li>
<li><ins>-1.2- <tt>typename [: X :]</tt> if `is_type(x)` is `true`, otherwise</ins></li>
<li><ins>-1.3- <tt>([: X :])</tt></ins></li>
</ul>
</p>
</blockquote>

<pre>
template&lt;reflection_range R = initializer_list&lt;info&gt;&gt;
consteval bool can_substitute(info templ, R&amp;&amp; arguments);
</pre>
<blockquote>
<p>
-1- Let `Z` be the template represented by `templ` and let `Args...` be a
sequence of prvalue constant expressions that compute the reflections held by
the elements of `arguments`, in order.
</p>
<p>
-2- <i>Returns</i>: `true` if <tt>Z&lt;<ins><i>TARG-SPLICE</i>(</ins>[:Args:]<ins>)</ins>...&gt;</tt> is a valid <i>template-id</i>
(<sref ref="[temp.names]"/>) that does not name a function whose type contains an undeduced placeholder type.
Otherwise, `false`.
</p>
<p>
-3- <i>Throws</i>: `meta::exception` unless `templ` represents a template, and every reflection
in `arguments` represents a construct usable as a template argument (<sref ref="[temp.arg]"/>).
</p>
<p>
-4- [<i>Note</i>: If forming <tt>Z&lt;<ins><i>TARG-SPLICE</i>(</ins>[:Args:]<ins>)</ins>...&gt;</tt>
leads to a failure outside of the immediate context, the program is ill-formed. &mdash; <i>end note</i>]
</p>
</blockquote>

<pre>
template&lt;reflection_range R = initializer_list&lt;info&gt;&gt;
consteval info substitute(info templ, R&amp;&amp; arguments);
</pre>
<blockquote>
<p>
-5- Let `Z` be the template represented by `templ` and let `Args...` be a
sequence of prvalue constant expressions that compute the reflections held by
the elements of `arguments`, in order.
</p>
<p>
-6- <i>Returns</i>: <tt>Z&lt;<ins><i>TARG-SPLICE</i>(</ins>[:Args:]<ins>)</ins>...&gt;</tt>.</p>
<p>
-7- <i>Throws</i>: `meta::exception` unless `can_substitute(templ, arguments)` is `true`.
</p>
<p>
-8- [<i>Note</i>: If forming <tt>Z&lt;<ins><i>TARG-SPLICE</i>(</ins>[:Args:]<ins>)</ins>...&gt;</tt>
leads to a failure outside of the immediate context, the program is ill-formed. &mdash; <i>end note</i>]
</p>
</blockquote>

</blockquote>
</li>
</ol>

</resolution>

</issue>
122 changes: 122 additions & 0 deletions xml/issue4441.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">

<issue num="4441" status="New">
<title><tt>ranges::rotate</tt> do not handle sized-but-not-sized-sentinel ranges correctly</title>
<section>
<sref ref="[alg.rotate]"/>
<sref ref="[partial.sort]"/>
<sref ref="[alg.nth.element]"/>
<sref ref="[alg.merge]"/>
</section>
<submitter>Tomasz Kamiński</submitter>
<date>03 Nov 2025</date>
<priority>99</priority>

<discussion>
<b>Addresses US 161-258</b>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<b>Addresses US 161-258</b>
<b><a href="https://github.com/cplusplus/nbballot/issues/833">Addresses US 161-258</a></b>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These get turned into official ISO document (issue lists), so I am not sure if we want to link to closed github from there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same concern, but we've been doing it for other NB comments in this ballot.

The issues list is not actually an official ISO doc any more. We stopped submitting it to ISO, it's just a WG21 doc now.

<p>These do not handle sized-but-not-sized-sentinel ranges correctly.</p>
</discussion>

<resolution>
<p>
This wording is relative to <paper num="N5014"/>.
</p>

<ol>

<li><p>Modify <sref ref="[alg.rotate]"/> as indicated:</p>

<pre>
template&lt;execution-policy Ep, <i>sized-random-access-range</i> R&gt;
requires permutable&lt;iterator_t&lt;R&gt;&gt;
borrowed_subrange_t&lt;R&gt; ranges::rotate(Ep&amp;&amp; exec, R&amp;&amp; r, iterator_t&lt;R&gt; middle);

</pre>
<blockquote>
<p>-6- <i>Effects</i> Equivalent to:
<tt>return ranges::rotate(std::forward&lt;Ep&gt;(exec), ranges::begin(r), middle,
<del>ranges::end(r)</del><ins>ranges::begin(r) + ranges::distance(r)</ins>);</tt>
</p>
</blockquote>

[&hellip;]

<pre>
template&lt;execution-policy Ep, <i>sized-random-access-range</i> R, <i>sized-random-access-range</i> OutR&gt;
requires indirectly_copyable&lt;iterator_t&lt;R&gt;, iterator_t&lt;OutR&gt;&gt;
ranges::rotate_copy_truncated_result&lt;borrowed_iterator_t&lt;R&gt;, borrowed_iterator_t&lt;OutR&gt;&gt;
ranges::rotate_copy(Ep&amp;&amp; exec, R&amp;&amp; r, iterator_t&lt;R&gt; middle, OutR&amp;&amp; result_r);
</pre>
<blockquote>
<p>-18- <i>Effects</i> Equivalent to:
<tt>return ranges::rotate(std::forward&lt;Ep&gt;(exec), ranges::begin(r), middle,
<del>ranges::end(r)</del><ins>ranges::begin(r)+ranges::distance(r)</ins>
ranges::begin(result_r), <del>ranges::end(result_r)</del><ins>ranges::begin(result_r) + ranges::distance(result_r)</ins>);</tt>
</p>
</blockquote>

</li>

<li><p>Modify <sref ref="[partial.sort]"/> as indicated:</p>

<pre>
template&lt;execution-policy Ep, sized-random-access-range R,
class Comp = ranges::less, class Proj = identity&gt;
requires sortable&lt;iterator_t&lt;R&gt;, Comp, Proj&gt;
borrowed_iterator_t&lt;R&gt;
ranges::partial_sort(Ep&amp;&amp; exec, R&amp;&amp; r, iterator_t&lt;R&gt; middle, Comp comp = {},
Proj proj = {});
</pre>
<blockquote>
<p>-7- <i>Effects</i> Equivalent to:
<tt>return ranges::partial_sort(std::forward&lt;Ep&gt;(exec), ranges::begin(r), middle,
<del>ranges::end(r)</del><ins>ranges::begin(r) + ranges::distance(r)</ins>, comp, proj);</tt>
</p>
</blockquote>

</li>

<li><p>Modify <sref ref="[alg.nth.element]"/> as indicated:</p>

<pre>
template&lt;execution-policy Ep, <i>sized-random-access-range</i> R, class Comp = ranges::less,
class Proj = identity&gt;
requires sortable&lt;iterator_t&lt;R&gt;, Comp, Proj&gt;
borrowed_iterator_t&lt;R&gt;
ranges::nth_element(Ep&amp;&amp; exec, R&amp;&amp; r, iterator_t&lt;R&gt; nth, Comp comp = {}, Proj proj = {});
</pre>
<blockquote>
<p>-7- <i>Effects</i> Equivalent to:
<tt>return ranges::nth_element(std::forward&lt;Ep&gt;(exec), ranges::begin(r), nth,
<del>ranges::end(r)</del><ins>ranges::begin(r) + ranges::distance(r)</ins>, comp, proj);</tt>
</p>
</blockquote>

</li>

<li><p>Modify <sref ref="[alg.merge]"/> as indicated:</p>

<pre>
template&lt;execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
class Proj = identity&gt;
requires sortable&lt;iterator_t&lt;R&gt;, Comp, Proj&gt;
borrowed_iterator_t&lt;R&gt;
ranges::inplace_merge(Ep&amp;&amp; exec, R&amp;&amp; r, iterator_t&lt;R&gt; middle, Comp comp = {},
Proj proj = {});
</pre>
<blockquote>
<p>-14- <i>Effects</i> Equivalent to:
<tt>return ranges::inplace_merge(std::forward&lt;Ep&gt;(exec), ranges::begin(r), middle,
<del>ranges::end(r)</del><ins>ranges::begin(r) + ranges::distance(r)</ins>, comp, proj);</tt>
</p>
</blockquote>

</li>


</ol>

</resolution>

</issue>