Skip to content

Commit b2e7953

Browse files
committed
Alternative P/R provided by Hewill
1 parent 65d5b1a commit b2e7953

File tree

1 file changed

+89
-3
lines changed

1 file changed

+89
-3
lines changed

xml/issue3855.xml

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ Only matters for pathological types.
3131
Maybe use <tt>requires bool_constant&lt;ranges::size(r) &lt;= 1&gt;</tt>.
3232
</p>
3333

34-
</discussion>
35-
36-
<resolution>
34+
<superseded>
3735
<p>
3836
This wording is relative to <paper num="N4917"/>.
3937
</p>
@@ -88,6 +86,94 @@ constexpr lazy_split_view(V base, Pattern pattern);
8886
</blockquote>
8987
</li>
9088

89+
</ol>
90+
</superseded>
91+
92+
<note>2025-04-27, Hewill provides alternative wording</note>
93+
</discussion>
94+
95+
<resolution>
96+
<p>
97+
This wording is relative to <paper num="N5008"/>.
98+
</p>
99+
100+
<ol>
101+
<li><p>Modify <sref ref="[range.lazy.split.view]"/> as indicated:</p>
102+
103+
<blockquote class="note">
104+
<p>
105+
[<i>Drafting note:</i> This benefits from <paper num="P2280"/> that a call to a
106+
member function of a non-constexpr object can be a constant expression if it does
107+
not actually access the member.
108+
<p/>
109+
This would make <code>views::lazy_split(r, span&lt;int, 0&gt;{})</code>
110+
well-formed, which can be seen as an enhancement.]
111+
</p>
112+
</blockquote>
113+
114+
<blockquote>
115+
<pre>
116+
namespace std::ranges {
117+
<del>template&lt;auto&gt; struct <i>require-constant</i>; // <i>exposition only</i></del>
118+
119+
template&lt;class R&gt;
120+
concept <i>tiny-range</i> = // <i>exposition only</i>
121+
sized_range&lt;R&gt; &amp;&amp;
122+
<ins>requires (R&amp; r) { requires bool_constant&lt;ranges::size(r) &lt;= 1&gt;::value; }</ins>
123+
<del>requires { typename <i>require-constant</i>&lt;remove_reference_t&lt;R&gt;::size()>; } &amp;&amp;
124+
(remove_reference_t&lt;R&gt;::size() &lt;= 1)</del>;
125+
126+
template&lt;input_range V, forward_range Pattern&gt;
127+
requires view&lt;V&gt; &amp;&amp; view&lt;Pattern&gt; &amp;&amp;
128+
indirectly_comparable&lt;iterator_t&lt;V&gt;, iterator_t&lt;Pattern&gt;, ranges::equal_to&gt; &amp;&amp;
129+
(forward_range&lt;V&gt; || <i>tiny-range</i>&lt;Pattern&gt;)
130+
class lazy_split_view::view_interface&lt;lazy_split_view&lt;V, Pattern&gt;&gt; {
131+
[&hellip;]
132+
};
133+
[&hellip;]
134+
}
135+
</pre>
136+
</blockquote>
137+
</li>
138+
139+
<li><p>Modify <sref ref="[range.lazy.split.inner]"/> as indicated:</p>
140+
141+
<blockquote class="note">
142+
<p>
143+
[<i>Drafting note:</i>
144+
We can't use <code>if constexpr (ranges::size(<i>i_</i>.<i>parent_</i>-&gt;<i>pattern_</i>) == 0)</code>
145+
here because it is not a constant expression, and it seems more intuitive to just use
146+
<code>ranges::empty</code> which is always well-formed. Note that the PR does not seek the
147+
aggressive optimization that minimizes the instantiation as this is not the intent of the
148+
current design (for example, <code><i>outer-iterator</i>&amp; operator++()</code> can be
149+
specialized for the case where <code>Pattern::size() == 0</code>), library implementations
150+
are free to optimize as it pleases.]
151+
</p>
152+
</blockquote>
153+
154+
<blockquote>
155+
<pre>
156+
constexpr <i>inner-iterator</i>&amp; operator++();
157+
</pre>
158+
<blockquote>
159+
<p>
160+
-5- <i>Effects:</i> Equivalent to:
161+
</p>
162+
<blockquote><pre>
163+
<i>incremented_</i> = true;
164+
if constexpr (!forward_range&lt;<i>Base</i>&gt;) {
165+
<ins>if (ranges::empty(<i>i_</i>.<i>parent_</i>-&gt;<i>pattern_</i>))</ins>
166+
<del>if constexpr (Pattern::size() == 0) {</del>
167+
return *this;
168+
}
169+
}
170+
++<i>i_</i>.<i>current</i>;
171+
return *this;
172+
</pre></blockquote>
173+
</blockquote>
174+
</blockquote>
175+
</li>
176+
91177
</ol>
92178

93179
</resolution>

0 commit comments

Comments
 (0)