Skip to content

Commit 21bb709

Browse files
tomaszkamjwakely
authored andcommitted
Updated PR for 4314 after LWG review
1 parent 98c10e6 commit 21bb709

File tree

1 file changed

+231
-2
lines changed

1 file changed

+231
-2
lines changed

xml/issue4314.xml

Lines changed: 231 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ validate if input value is representable.
8484
We should require convertibility without regard to const and
8585
value category.
8686
</p>
87-
</discussion>
8887

89-
<resolution>
88+
<superseded>
9089
<p>
9190
This wording is relative to <paper num="N5014"/>.
9291
</p>
@@ -288,7 +287,237 @@ constexpr mapping(const extents_type&amp; ext, OtherIndexType pad<ins>ding</ins>
288287

289288
</li>
290289

290+
</ol>
291+
</superseded>
292+
293+
<note>2025-10-05; Tomasz provides upated wording after LWG review</note>
294+
295+
</discussion>
296+
297+
<resolution>
298+
<p>
299+
This wording is relative to <paper num="N5014"/>.
300+
</p>
301+
302+
<ol>
303+
304+
<li><p>Modify <sref ref="[mdspan.extents.expo]"/> as indicated:</p>
305+
306+
<blockquote>
307+
<pre>
308+
template&lt;class OtherIndexType&gt;
309+
static constexpr auto index-cast(OtherIndexType&amp;&amp; i) noexcept;
310+
</pre>
311+
<blockquote>
312+
<p>
313+
-9- <i>Effects</i>:<ul>
314+
<li>-9.1- If `OtherIndexType` is an integral type other than `bool`, then equivalent to `return i;`,</li>
315+
<li>-9.2- otherwise, equivalent to <tt>return static_cast&lt;index_type&gt;(<ins>std::move(</ins>i<ins>)</ins>);</tt>.</li>
316+
</ul>
317+
</p>
318+
</blockquote>
319+
</blockquote>
320+
</li>
321+
322+
<li><p>Modify <sref ref="[mdspan.layout.left.obs]"/> as indicated:</p>
323+
324+
<blockquote>
325+
<pre>
326+
template&lt;class... Indices&gt;
327+
constexpr index_type operator()(Indices... i) const noexcept;
328+
</pre>
329+
<blockquote>
330+
<p>
331+
-2- <i>Constraints</i>: [&hellip;]
332+
<p/>
333+
-3- <i>Preconditions</i>: [&hellip;]
334+
<p/>
335+
-4- <i>Effects</i>: Let `P` be a parameter pack such that
336+
</p>
337+
<blockquote><pre>
338+
is_same_v&lt;index_sequence_for&lt;Indices...&gt;, index_sequence&lt;P...&gt;&gt;
339+
</pre></blockquote>
340+
<p>
341+
is `true`. Equivalent to:
342+
</p>
343+
<blockquote><pre>
344+
return ((static_cast&lt;index_type&gt;(<ins>std::move(</ins>i<ins>)</ins>) * stride(P)) + ... + 0);
345+
</pre></blockquote>
346+
</blockquote>
347+
</blockquote>
348+
349+
</li>
350+
351+
<li><p>Modify <sref ref="[mdspan.layout.right.obs]"/> as indicated:</p>
352+
353+
<blockquote>
354+
<pre>
355+
template&lt;class... Indices&gt;
356+
constexpr index_type operator()(Indices... i) const noexcept;
357+
</pre>
358+
<blockquote>
359+
<p>
360+
-2- <i>Constraints</i>: [&hellip;]
361+
<p/>
362+
-3- <i>Preconditions</i>: [&hellip;]
363+
<p/>
364+
-4- <i>Effects</i>: Let `P` be a parameter pack such that
365+
</p>
366+
<blockquote><pre>
367+
is_same_v&lt;index_sequence_for&lt;Indices...&gt;, index_sequence&lt;P...&gt;&gt;
368+
</pre></blockquote>
369+
<p>
370+
is `true`. Equivalent to:
371+
</p>
372+
<blockquote><pre>
373+
return ((static_cast&lt;index_type&gt;(<ins>std::move(</ins>i<ins>)</ins>) * stride(P)) + ... + 0);
374+
</pre></blockquote>
375+
</blockquote>
376+
</blockquote>
377+
378+
</li>
379+
380+
<li><p>Modify <sref ref="[mdspan.layout.stride.obs]"/> as indicated:</p>
381+
382+
<blockquote>
383+
<pre>
384+
template&lt;class... Indices&gt;
385+
constexpr index_type operator()(Indices... i) const noexcept;
386+
</pre>
387+
<blockquote>
388+
<p>
389+
-2- <i>Constraints</i>: [&hellip;]
390+
<p/>
391+
-3- <i>Preconditions</i>: [&hellip;]
392+
<p/>
393+
-4- <i>Effects</i>: Let `P` be a parameter pack such that
394+
</p>
395+
<blockquote><pre>
396+
is_same_v&lt;index_sequence_for&lt;Indices...&gt;, index_sequence&lt;P...&gt;&gt;
397+
</pre></blockquote>
398+
<p>
399+
is `true`. Equivalent to:
400+
</p>
401+
<blockquote><pre>
402+
return ((static_cast&lt;index_type&gt;(<ins>std::move(</ins>i<ins>)</ins>) * stride(P)) + ... + 0);
403+
</pre></blockquote>
404+
</blockquote>
405+
</blockquote>
406+
407+
</li>
408+
409+
<li><p>Modify <sref ref="[mdspan.layout.leftpad.obs]"/> as indicated:</p>
410+
411+
<blockquote>
412+
<pre>
413+
template&lt;class... Indices&gt;
414+
constexpr index_type operator()(Indices... idxs) const noexcept;
415+
</pre>
416+
<blockquote>
417+
<p>
418+
-3- <i>Constraints</i>: [&hellip;]
419+
<p/>
420+
-4- <i>Preconditions</i>: [&hellip;]
421+
<p/>
422+
-5- <i>Returns</i>: <tt>((static_cast&lt;index_type&gt;(<ins>std::move(</ins>idxs<ins>)</ins>) * stride(P_rank)) + ... + 0)</tt>.
423+
</p>
424+
</blockquote>
425+
</blockquote>
426+
427+
</li>
428+
429+
<li><p>Modify <sref ref="[mdspan.layout.rightpad.obs]"/> as indicated:</p>
430+
431+
<blockquote>
432+
<pre>
433+
template&lt;class... Indices&gt;
434+
constexpr index_type operator()(Indices... idxs) const noexcept;
435+
</pre>
436+
<blockquote>
437+
<p>
438+
-3- <i>Constraints</i>: [&hellip;]
439+
<p/>
440+
-4- <i>Preconditions</i>: [&hellip;]
441+
<p/>
442+
-5- <i>Returns</i>: <tt>((static_cast&lt;index_type&gt;(<ins>std::move(</ins>idxs<ins>)</ins>) * stride(P_rank)) + ... + 0)</tt>.
443+
</p>
444+
</blockquote>
445+
</blockquote>
446+
447+
</li>
448+
449+
<li><p>Modify <sref ref="[mdspan.layout.leftpad.cons]"/> as indicated:</p>
450+
451+
<blockquote>
452+
<pre>
453+
template&lt;class OtherIndexType&gt;
454+
constexpr mapping(const extents_type&amp; ext, OtherIndexType pad<ins>ding</ins>);
455+
</pre>
456+
<blockquote>
457+
<p>
458+
<ins>Let <tt>pad</tt> be <tt>extents_type::<i>index-cast</i>(std::move(padding))</tt>.</ins>
459+
<p/>
460+
-3- <i>Constraints</i>: [&hellip;]
461+
<p/>
462+
-4- <i>Preconditions</i>:
463+
</p>
464+
<ol style="list-style-type: none">
465+
<li><p>(4.1) &mdash; <tt>pad</tt> is representable as a value of type `index_type`.</p></li>
466+
<li><p>(4.2) &mdash; <del><tt>extents_type::<i>index-cast</i>(pad)</tt></del><ins>pad</ins> is greater than zero.</p></li>
467+
<li><p>(4.3) &mdash; If <tt><i>rank_</i></tt> is greater than one, then
468+
<tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(0))</tt> is representable as a value of type `index_type`.</p></li>
469+
<li><p>(4.4) &mdash; If <tt><i>rank_</i></tt> is greater than one, then the product of
470+
<tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(0))</tt> and all values <tt>ext.extent(<i>k</i>)</tt> with
471+
<tt><i>k</i></tt> in the range of <tt>[1, <i>rank_</i>)</tt> is representable as a value of type `index_type`.</p></li>
472+
<li><p>(4.5) &mdash; If `padding_value` is not equal to `dynamic_extent`, `padding_value` equals
473+
<tt><del>extents_type::<i>index-cast</i>(pad)</del><ins>pad</ins></tt>.</p></li>
474+
</ol>
475+
<p>
476+
-5- <i>Effects</i>: Direct-non-list-initializes `extents_` with `ext`, and if `rank_` is greater than one,
477+
direct-non-list-initializes <tt><i>stride-rm2</i></tt> with <tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(rank_ - 1))</tt>.
478+
</p>
479+
</blockquote>
480+
</blockquote>
481+
482+
</li>
483+
484+
<li><p>Modify <sref ref="[mdspan.layout.rightpad.cons]"/> as indicated:</p>
485+
486+
<blockquote>
487+
<pre>
488+
template&lt;class OtherIndexType&gt;
489+
constexpr mapping(const extents_type&amp; ext, OtherIndexType pad<ins>ding</ins>);
490+
</pre>
491+
<blockquote>
492+
<p>
493+
<ins>Let <tt>pad</tt> be <tt>extents_type::<i>index-cast</i>(std::move(padding))</tt>.</ins>
494+
<p/>
495+
-3- <i>Constraints</i>: [&hellip;]
496+
<p/>
497+
-4- <i>Preconditions</i>:
498+
</p>
499+
<ol style="list-style-type: none">
500+
<li><p>(4.1) &mdash; <tt>pad</tt> is representable as a value of type `index_type`.</p></li>
501+
<li><p>(4.2) &mdash; <del><tt>extents_type::<i>index-cast</i>(pad)</tt></del><ins>pad</ins> is greater than zero.</p></li>
502+
<li><p>(4.3) &mdash; If <tt><i>rank_</i></tt> is greater than one, then
503+
<tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(<i>rank_</i> - 1))</tt> is representable as a value of type `index_type`.</p></li>
504+
<li><p>(4.4) &mdash; If <tt><i>rank_</i></tt> is greater than one, then the product of
505+
<tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(<i>rank_</i> - 1))</tt> and all values <tt>ext.extent(<i>k</i>)</tt> with
506+
<tt><i>k</i></tt> in the range of <tt>[1, <i>rank_</i> - 1)</tt> is representable as a value of type `index_type`.</p></li>
507+
<li><p>(4.5) &mdash; If `padding_value` is not equal to `dynamic_extent`, `padding_value` equals
508+
<tt><del>extents_type::<i>index-cast</i>(pad)</del><ins>pad</ins></tt>.</p></li>
509+
</ol>
510+
<p>
511+
-5- <i>Effects</i>: Direct-non-list-initializes `extents_` with `ext`, and if `rank_` is greater than one,
512+
direct-non-list-initializes <tt><i>stride-rm2</i></tt> with <tt><i>LEAST-MULTIPLE-AT-LEAST</i>(pad, ext.extent(rank_ - 1))</tt>.
513+
</p>
514+
</blockquote>
515+
</blockquote>
516+
517+
</li>
518+
291519
</ol>
292520
</resolution>
293521

522+
294523
</issue>

0 commit comments

Comments
 (0)