Skip to content

Commit 9fabdcc

Browse files
authored
LWG4272: New proposed resolution fixing constructor from padded layouts
This fixes mistake pointed out on reflector.
1 parent 70d003c commit 9fabdcc

File tree

1 file changed

+249
-2
lines changed

1 file changed

+249
-2
lines changed

xml/issue4272.xml

Lines changed: 249 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,8 @@ template<class OtherExtents>
250250
</superseded>
251251

252252
<note>2025-06-20, Luc Grosheintz provides further wording improvements</note>
253-
</discussion>
254253

255-
<resolution>
254+
<superseded>
256255
<p>
257256
This wording is relative to <paper num="N5008"/>.
258257
</p>
@@ -493,7 +492,255 @@ LayoutRightPaddedMapping::padding_value == dynamic_extent)
493492
</blockquote>
494493
</li>
495494

495+
</ol>
496+
</superseded>
497+
498+
<note>2025-09-27, Tomasz Kamiński fixes constraints in constructors from padded layouts</note>
499+
</discussion>
500+
501+
<resolution>
502+
<p>
503+
This wording is relative to <paper num="N5008"/>.
504+
</p>
505+
506+
<blockquote class="note">
507+
<p>
508+
[<i>Drafting note</i>: As drive-by fixes the edits for <tt>layout_left_padded&lt;&gt;::mapping</tt> and
509+
<tt>layout_right_padded&lt;&gt;::mapping</tt> also correct an editorial asymmetry between class
510+
header synopsis declaration form and prototype specification form of the corresponding
511+
constructors and adjust to the correct formatting of the exposition-only data member <tt><i>rank_</i></tt>.]
512+
</p>
513+
</blockquote>
514+
515+
<ol>
516+
<li><p>Modify <sref ref="[mdspan.layout.left.overview]"/> as indicated:</p>
517+
518+
<blockquote>
519+
<pre>
520+
namespace std {
521+
template&lt;class Extents&gt;
522+
class layout_left::mapping {
523+
[&hellip;]
524+
<i>// <sref ref="[mdspan.layout.left.cons]"/>, constructors</i>
525+
[&hellip;]
526+
template&lt;class OtherExtents&gt;
527+
constexpr explicit(<del>extents_type::rank() &gt; 0</del><ins><i>see below</i></ins>)
528+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp;);
529+
530+
constexpr mapping&amp; operator=(const mapping&amp;) noexcept = default;
531+
[&hellip;]
532+
};
533+
}
534+
</pre>
535+
</blockquote>
536+
</li>
537+
538+
<li><p>Modify <sref ref="[mdspan.layout.left.cons]"/> as indicated:</p>
539+
540+
<blockquote>
541+
<pre>
542+
template&lt;class OtherExtents&gt;
543+
constexpr explicit(<del>extents_type::rank() &gt; 0</del><ins><i>see below</i></ins>)
544+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp; other);
545+
</pre>
546+
<blockquote>
547+
<p>
548+
-13- <i>Constraints</i>: [&hellip;]
549+
<p/>
550+
-14- <i>Preconditions</i>: [&hellip;]
551+
<p/>
552+
-15- <i>Effects</i>: [&hellip;]
553+
<p/>
554+
<ins>-?- <i>Remarks</i>: The expression inside `explicit` is equivalent to:</ins>
555+
</p>
556+
<blockquote><pre>
557+
<ins>!(extents_type::rank() == 0 &amp;&amp; is_convertible_v&lt;OtherExtents, extents_type&gt;)</ins>
558+
</pre></blockquote>
559+
</blockquote>
560+
</blockquote>
561+
</li>
562+
563+
<li><p>Modify <sref ref="[mdspan.layout.right.overview]"/> as indicated:</p>
564+
565+
<blockquote>
566+
<pre>
567+
namespace std {
568+
template&lt;class Extents&gt;
569+
class layout_right::mapping {
570+
[&hellip;]
571+
<i>// <sref ref="[mdspan.layout.right.cons]"/>, constructors</i>
572+
[&hellip;]
573+
template&lt;class OtherExtents&gt;
574+
constexpr explicit(<del>extents_type::rank() &gt; 0</del><ins><i>see below</i></ins>)
575+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp;);
576+
577+
constexpr mapping&amp; operator=(const mapping&amp;) noexcept = default;
578+
[&hellip;]
579+
};
580+
}
581+
</pre>
582+
</blockquote>
583+
</li>
584+
585+
<li><p>Modify <sref ref="[mdspan.layout.right.cons]"/> as indicated:</p>
586+
587+
<blockquote>
588+
<pre>
589+
template&lt;class OtherExtents&gt;
590+
constexpr explicit(<del>extents_type::rank() &gt; 0</del><ins><i>see below</i></ins>)
591+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp; other);
592+
</pre>
593+
<blockquote>
594+
<p>
595+
-13- <i>Constraints</i>: [&hellip;]
596+
<p/>
597+
-14- <i>Preconditions</i>: [&hellip;]
598+
<p/>
599+
-15- <i>Effects</i>: [&hellip;]
600+
<p/>
601+
<ins>-?- <i>Remarks</i>: The expression inside `explicit` is equivalent to:</ins>
602+
</p>
603+
<blockquote><pre>
604+
<ins>!(extents_type::rank() == 0 &amp;&amp; is_convertible_v&lt;OtherExtents, extents_type&gt;)</ins>
605+
</pre></blockquote>
606+
</blockquote>
607+
</blockquote>
608+
</li>
609+
610+
<li><p>Modify <sref ref="[mdspan.layout.leftpad.overview]"/> as indicated:</p>
611+
612+
<blockquote>
613+
<pre>
614+
namespace std {
615+
template&lt;size_t PaddingValue&gt;
616+
template&lt;class Extents&gt;
617+
class layout_left_padded&lt;PaddingValue&gt;::mapping {
618+
[&hellip;]
619+
<i>// <sref ref="[mdspan.layout.leftpad.cons]"/>, constructors</i>
620+
[&hellip;]
621+
template&lt;class OtherExtents&gt;
622+
constexpr explicit(<del>extents_type::rank() &gt; 0</del><ins><i>see below</i></ins>)
623+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp;);
624+
[&hellip;]
625+
};
626+
}
627+
</pre>
628+
</blockquote>
629+
</li>
630+
631+
<li><p>Modify <sref ref="[mdspan.layout.leftpad.cons]"/> as indicated:</p>
632+
633+
<blockquote>
634+
<pre>
635+
template&lt;class OtherExtents&gt;
636+
constexpr explicit(<del>rank_ &gt; 0</del><ins><i>see below</i></ins>)
637+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp; other);
638+
</pre>
639+
<blockquote>
640+
<p>
641+
-10- <i>Constraints</i>: [&hellip;]
642+
<p/>
643+
-11- <i>Preconditions</i>: [&hellip;]
644+
<p/>
645+
-12- <i>Effects</i>: [&hellip;]
646+
<p/>
647+
<ins>-?- <i>Remarks</i>: The expression inside `explicit` is equivalent to:</ins>
648+
</p>
649+
<blockquote><pre>
650+
<ins>!(<i>rank_</i> == 0 &amp;&amp; is_convertible_v&lt;OtherExtents, extents_type&gt;)</ins>
651+
</pre></blockquote>
652+
</blockquote>
653+
<pre>
654+
template&lt;class LayoutLeftPaddedMapping&gt;
655+
constexpr explicit(<i>see below</i>)
656+
mapping(const LayoutLeftPaddedMapping&amp; other);
657+
</pre>
658+
<blockquote>
659+
<p>
660+
-13- <i>Constraints</i>: [&hellip;]
661+
<p/>
662+
[&hellip;]
663+
<p/>
664+
-16- <i>Remarks</i>: The expression inside `explicit` is equivalent to:
665+
</p>
666+
<blockquote><pre>
667+
<ins>!is_convertible_v&lt;typename LayoutLeftPaddedMapping::extents_type, extents_type&gt; ||</ins>
668+
rank_&gt; 1 &amp;&amp;
669+
(padding_value != dynamic_extent ||
670+
LayoutLeftPaddedMapping::padding_value == dynamic_extent)
671+
</pre></blockquote>
672+
</blockquote>
673+
</blockquote>
674+
</li>
675+
676+
<li><p>Modify <sref ref="[mdspan.layout.rightpad.overview]"/> as indicated:</p>
677+
678+
<blockquote>
679+
<pre>
680+
namespace std {
681+
template&lt;size_t PaddingValue&gt;
682+
template&lt;class Extents&gt;
683+
class layout_right_padded&lt;PaddingValue&gt;::mapping {
684+
[&hellip;]
685+
<i>// <sref ref="[mdspan.layout.rightpad.cons]"/>, constructors</i>
686+
[&hellip;]
687+
template&lt;class OtherExtents&gt;
688+
constexpr explicit(<del>rank_ &gt; 0</del><ins><i>see below</i></ins>)
689+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp;);
690+
[&hellip;]
691+
};
692+
}
693+
</pre>
694+
</blockquote>
695+
</li>
696+
697+
<li><p>Modify <sref ref="[mdspan.layout.rightpad.cons]"/> as indicated:</p>
698+
699+
<blockquote>
700+
<pre>
701+
template&lt;class OtherExtents&gt;
702+
constexpr explicit(<del>rank_ &gt; 0</del><ins><i>see below</i></ins>)
703+
mapping(const layout_stride::mapping&lt;OtherExtents&gt;&amp; other);
704+
</pre>
705+
<blockquote>
706+
<p>
707+
-10- <i>Constraints</i>: [&hellip;]
708+
<p/>
709+
-11- <i>Preconditions</i>: [&hellip;]
710+
<p/>
711+
-12- <i>Effects</i>: [&hellip;]
712+
<p/>
713+
<ins>-?- <i>Remarks</i>: The expression inside `explicit` is equivalent to:</ins>
714+
</p>
715+
<blockquote><pre>
716+
<ins>!(<i>rank_</i> == 0 &amp;&amp; is_convertible_v&lt;OtherExtents, extents_type&gt;)</ins>
717+
</pre></blockquote>
718+
</blockquote>
719+
<pre>
720+
template&lt;class LayoutRightPaddedMapping&gt;
721+
constexpr explicit(<i>see below</i>)
722+
mapping(const LayoutRightPaddedMapping&amp; other);
723+
</pre>
724+
<blockquote>
725+
<p>
726+
-13- <i>Constraints</i>: [&hellip;]
727+
<p/>
728+
[&hellip;]
729+
<p/>
730+
-17- <i>Remarks</i>: The expression inside `explicit` is equivalent to:
731+
</p>
732+
<blockquote><pre>
733+
<ins>!is_convertible_v&lt;typename LayoutRightPaddedMapping::extents_type, extents_type&gt; ||</ins>
734+
<i>rank_</i> &gt; 1 &amp;&amp;
735+
(padding_value != dynamic_extent ||
736+
LayoutRightPaddedMapping::padding_value == dynamic_extent)
737+
</pre></blockquote>
738+
</blockquote>
739+
</blockquote>
740+
</li>
741+
496742
</ol>
497743
</resolution>
498744

745+
499746
</issue>

0 commit comments

Comments
 (0)