Skip to content

Commit bb10c66

Browse files
committed
Hewill comments and provides proposed wording
1 parent d148f7b commit bb10c66

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed

xml/issue4052.xml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,146 @@ The copy & paste error was
111111
<a href="https://github.com/cplusplus/draft/pull/6794">fixed editorially</a>.
112112
</p>
113113

114+
<note>2025-10-06; Hewill comments and provides wording</note>
115+
<p>
116+
We should fix the constructor, otherwise the following should be rejected according to the standard:
117+
</p>
118+
<blockquote><pre>
119+
#include &lt;random&gt;
120+
121+
struct Op {
122+
float operator()(float);
123+
void operator()(auto) = delete;
124+
};
125+
126+
static_assert(!std::is_invocable_r_v&lt;double, Op&amp;, double&gt;);
127+
128+
int main() {
129+
std::initializer_list&lt;float&gt; l;
130+
std::piecewise_linear_distribution&lt;float&gt; dist(l, Op{});
131+
}
132+
</pre></blockquote>
133+
<p>
134+
This is, because it violates <i>Mandates</i>. However, all three compilers accept it because
135+
<code>Op&amp;</code> can take `float` and return `float`.
136+
</p>
114137
</discussion>
115138

116139
<resolution>
117140
<p>
141+
This wording is relative to <paper num="N5014"/>.
142+
</p>
143+
144+
<ol>
145+
146+
<li><p>Modify <sref ref="[rand.dist.samp.pconst]"/> as indicated:</p>
147+
148+
<blockquote>
149+
<pre>
150+
template&lt;class InputIteratorB, class InputIteratorW&gt;
151+
piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB,
152+
InputIteratorW firstW);
153+
</pre>
154+
<blockquote>
155+
<p>
156+
-4- <i>Mandates</i>: Both of
157+
</p>
158+
<ol style="list-style-type: none">
159+
<li><p>
160+
(4.1) &mdash; <code>is_convertible_v&lt;iterator_traits&lt;InputIteratorB>::value_type, <ins>result_type</ins><del>double</del>&gt;</code>
161+
</p></li>
162+
<li><p>
163+
(4.2) &mdash; <code>is_convertible_v&lt;iterator_traits&lt;InputIteratorW>::value_type, <ins>result_type</ins><del>double</del>&gt;</code>
164+
</p></li>
165+
</ol>
166+
<p>
167+
are `true`.
168+
<p/>
169+
[&hellip;]
170+
</p>
171+
</blockquote>
172+
<pre>
173+
template&lt;class UnaryOperation&gt;
174+
piecewise_constant_distribution(initializer_list&lt;RealType&gt; bl, UnaryOperation fw);
175+
</pre>
176+
<blockquote>
177+
<p>
178+
-7- <i>Mandates</i>: <code>is_invocable_r_v&lt;<ins>result_type</ins><del>double</del>, UnaryOperation&amp;,
179+
<ins>result_type</ins><del>double</del>&gt;</code> is `true`.
180+
<p/>
181+
[&hellip;]
182+
</p>
183+
</blockquote>
184+
<pre>
185+
template&lt;class UnaryOperation&gt;
186+
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
187+
</pre>
188+
<blockquote>
189+
<p>
190+
-10- <i>Mandates</i>: <code>is_invocable_r_v&lt;<ins>result_type</ins><del>double</del>, UnaryOperation&amp;,
191+
<ins>result_type</ins><del>double</del>&gt;</code> is `true`.
192+
<p/>
193+
[&hellip;]
118194
</p>
195+
</blockquote>
196+
</blockquote>
197+
</li>
198+
199+
200+
<li><p>Modify <sref ref="[rand.dist.samp.plinear]"/> as indicated:</p>
201+
202+
<blockquote>
203+
<pre>
204+
template&lt;class InputIteratorB, class InputIteratorW&gt;
205+
piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
206+
InputIteratorW firstW);
207+
</pre>
208+
<blockquote>
209+
<p>
210+
-4- <i>Mandates</i>: Both of
211+
</p>
212+
<ol style="list-style-type: none">
213+
<li><p>
214+
(4.1) &mdash; <code>is_convertible_v&lt;iterator_traits&lt;InputIteratorB>::value_type, <ins>result_type</ins><del>double</del>&gt;</code>
215+
</p></li>
216+
<li><p>
217+
(4.2) &mdash; <code>is_convertible_v&lt;iterator_traits&lt;InputIteratorW>::value_type, <ins>result_type</ins><del>double</del>&gt;</code>
218+
</p></li>
219+
</ol>
220+
<p>
221+
are `true`.
222+
<p/>
223+
[&hellip;]
224+
</p>
225+
</blockquote>
226+
<pre>
227+
template&lt;class UnaryOperation&gt;
228+
piecewise_linear_distribution(initializer_list&lt;RealType&gt; bl, UnaryOperation fw);
229+
</pre>
230+
<blockquote>
231+
<p>
232+
-7- <i>Mandates</i>: <code>is_invocable_r_v&lt;<ins>result_type</ins><del>double</del>, UnaryOperation&amp;,
233+
<ins>result_type</ins><del>double</del>&gt;</code> is `true`.
234+
<p/>
235+
[&hellip;]
236+
</p>
237+
</blockquote>
238+
<pre>
239+
template&lt;class UnaryOperation&gt;
240+
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
241+
</pre>
242+
<blockquote>
243+
<p>
244+
-10- <i>Mandates</i>: <code>is_invocable_r_v&lt;<ins>result_type</ins><del>double</del>, UnaryOperation&amp;,
245+
<ins>result_type</ins><del>double</del>&gt;</code> is `true`.
246+
<p/>
247+
[&hellip;]
248+
</p>
249+
</blockquote>
250+
</blockquote>
251+
</li>
252+
</ol>
253+
119254
</resolution>
120255

121256
</issue>

0 commit comments

Comments
 (0)