Skip to content

Commit 70d9303

Browse files
committed
Supersede P/R by using Hardened preconditions instead
1 parent 33754ec commit 70d9303

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

xml/issue4214.xml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ auto r = std::views::repeat('a', 2)
2626
<p>
2727
This is not the intention, we should ban these cases.
2828
</p>
29-
</discussion>
3029

31-
<resolution>
30+
<superseded>
3231
<p>
3332
This wording is relative to <paper num="N5001"/>.
3433
</p>
@@ -82,6 +81,69 @@ and <code>F</code> are indeterminately sequenced.
8281

8382
</ol>
8483

84+
</superseded>
85+
86+
<note>2025-02-24</note>
87+
<p>
88+
Upon reflector discussion many preferred to use instead the new <i>Hardened preconditions:</i> element which
89+
have been introduced by the recently voted in <paper num="P3471R4"/>.
90+
</p>
91+
</discussion>
92+
93+
<resolution>
94+
<p>
95+
This wording is relative to <paper num="N5001"/> plus additions from <paper num="P3471R4"/>.
96+
</p>
97+
98+
<ol>
99+
<li><p>Modify <sref ref="[range.take.overview]"/> as indicated:</p>
100+
101+
<blockquote>
102+
<p>
103+
-2- The name <code>views::take</code> denotes a range adaptor object (<sref ref="[range.adaptor.object]"/>).
104+
Let <code>E</code> and <code>F</code> be expressions, let <code>T</code> be
105+
<code>remove_cvref_t&lt;decltype((E))&gt;</code>, and let <code>D</code> be
106+
<code>range_difference_t&lt;decltype((E))&gt;</code>.
107+
If <code>decltype((F))</code> does not model <code>convertible_to&lt;D&gt;</code>,
108+
<code>views::take(E, F)</code> is ill-formed. Otherwise, the expression <code>views::take(E, F)</code>
109+
is expression-equivalent to:
110+
</p>
111+
<ol style="list-style-type: none">
112+
<li><p>(2.?) <ins>&mdash; <i>Hardened preconditions</i>: <code>static_cast&lt;D&gt;(F) &gt;= 0</code> is <code>true</code>.</ins>
113+
</p></li>
114+
<li><p>(2.1) &mdash; if <code>T</code> is a specialization of <code>empty_view</code> (<sref ref="[range.empty.view]"/>),
115+
then <code>((void)F, <i>decay-copy</i>(E))</code>, except that the evaluations of <code>E</code>
116+
and <code>F</code> are indeterminately sequenced.
117+
</p></li>
118+
</ol>
119+
</blockquote>
120+
</li>
121+
122+
<li><p>Modify <sref ref="[range.drop.overview]"/> as indicated:</p>
123+
124+
<blockquote>
125+
<p>
126+
-2- The name <code>views::drop</code> denotes a range adaptor object (<sref ref="[range.adaptor.object]"/>).
127+
Let <code>E</code> and <code>F</code> be expressions, let <code>T</code> be
128+
<code>remove_cvref_t&lt;decltype((E))&gt;</code>, and let <code>D</code> be
129+
<code>range_difference_t&lt;decltype((E))&gt;</code>.
130+
If <code>decltype((F))</code> does not model <code>convertible_to&lt;D&gt;</code>,
131+
<code>views::drop(E, F)</code> is ill-formed. Otherwise, the expression <code>views::drop(E, F)</code>
132+
is expression-equivalent to:
133+
</p>
134+
<ol style="list-style-type: none">
135+
<li><p>(2.?) <ins>&mdash; <i>Hardened preconditions</i>: <code>static_cast&lt;D&gt;(F) &gt;= 0</code> is <code>true</code>.</ins>
136+
</p></li>
137+
<li><p>(2.1) &mdash; if <code>T</code> is a specialization of <code>empty_view</code> (<sref ref="[range.empty.view]"/>),
138+
then <code>((void)F, <i>decay-copy</i>(E))</code>, except that the evaluations of <code>E</code>
139+
and <code>F</code> are indeterminately sequenced.
140+
</p></li>
141+
</ol>
142+
</blockquote>
143+
</li>
144+
145+
</ol>
146+
85147
</resolution>
86148

87149
</issue>

0 commit comments

Comments
 (0)