@@ -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 < random>
120+
121+ struct Op {
122+ float operator()(float);
123+ void operator()(auto) = delete;
124+ };
125+
126+ static_assert(!std::is_invocable_r_v< double, Op& , double> );
127+
128+ int main() {
129+ std::initializer_list< float> l;
130+ std::piecewise_linear_distribution< float> 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& </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< class InputIteratorB, class InputIteratorW>
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) — <code >is_convertible_v< iterator_traits< InputIteratorB>::value_type, <ins >result_type</ins ><del >double</del >> </code >
161+ </p ></li >
162+ <li ><p >
163+ (4.2) — <code >is_convertible_v< iterator_traits< InputIteratorW>::value_type, <ins >result_type</ins ><del >double</del >> </code >
164+ </p ></li >
165+ </ol >
166+ <p >
167+ are `true`.
168+ <p />
169+ [… ]
170+ </p >
171+ </blockquote >
172+ <pre >
173+ template< class UnaryOperation>
174+ piecewise_constant_distribution(initializer_list< RealType> bl, UnaryOperation fw);
175+ </pre >
176+ <blockquote >
177+ <p >
178+ -7- <i >Mandates</i >: <code >is_invocable_r_v< <ins >result_type</ins ><del >double</del >, UnaryOperation& ,
179+ <ins >result_type</ins ><del >double</del >> </code > is `true`.
180+ <p />
181+ [… ]
182+ </p >
183+ </blockquote >
184+ <pre >
185+ template< class UnaryOperation>
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< <ins >result_type</ins ><del >double</del >, UnaryOperation& ,
191+ <ins >result_type</ins ><del >double</del >> </code > is `true`.
192+ <p />
193+ [… ]
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< class InputIteratorB, class InputIteratorW>
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) — <code >is_convertible_v< iterator_traits< InputIteratorB>::value_type, <ins >result_type</ins ><del >double</del >> </code >
215+ </p ></li >
216+ <li ><p >
217+ (4.2) — <code >is_convertible_v< iterator_traits< InputIteratorW>::value_type, <ins >result_type</ins ><del >double</del >> </code >
218+ </p ></li >
219+ </ol >
220+ <p >
221+ are `true`.
222+ <p />
223+ [… ]
224+ </p >
225+ </blockquote >
226+ <pre >
227+ template< class UnaryOperation>
228+ piecewise_linear_distribution(initializer_list< RealType> bl, UnaryOperation fw);
229+ </pre >
230+ <blockquote >
231+ <p >
232+ -7- <i >Mandates</i >: <code >is_invocable_r_v< <ins >result_type</ins ><del >double</del >, UnaryOperation& ,
233+ <ins >result_type</ins ><del >double</del >> </code > is `true`.
234+ <p />
235+ [… ]
236+ </p >
237+ </blockquote >
238+ <pre >
239+ template< class UnaryOperation>
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< <ins >result_type</ins ><del >double</del >, UnaryOperation& ,
245+ <ins >result_type</ins ><del >double</del >> </code > is `true`.
246+ <p />
247+ [… ]
248+ </p >
249+ </blockquote >
250+ </blockquote >
251+ </li >
252+ </ol >
253+
119254</resolution >
120255
121256</issue >
0 commit comments