Skip to content

Commit 2c9b492

Browse files
committed
New issue from Luc Grosheintz: "Weaken Mandates: for dynamic padding values in padded layouts"
1 parent ed52dd6 commit 2c9b492

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

xml/issue4372.xml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4372" status="New">
5+
<title>Weaken <i>Mandates:</i> for dynamic padding values in padded layouts</title>
6+
<section>
7+
<sref ref="[mdspan.layout.leftpad.overview]"/>
8+
<sref ref="[mdspan.layout.rightpad.overview]"/>
9+
</section>
10+
<submitter>Luc Grosheintz</submitter>
11+
<date>09 Sep 2025</date>
12+
<priority>99</priority>
13+
14+
<discussion>
15+
<p>
16+
Two new layouts were added to <tt>&lt;mdspan&gt;</tt> in C++26. Both have a template
17+
parameter `size_t PaddingValue`. This value is allowed to be `std::dynamic_extent`
18+
to signal that the padding value isn't known at compile time.
19+
<p/>
20+
A class <i>Mandates:</i> element (in <sref ref="[mdspan.layout.leftpad.overview]"/> (5.2)
21+
and <sref ref="[mdspan.layout.rightpad.overview]"/> (5.2), respectively) requires
22+
(unconditionally) that
23+
</p>
24+
<ul>
25+
<li><p>`PaddingValue` is representable as a value of `index_type`.</p></li>
26+
</ul>
27+
<p>
28+
Since `std::dynamic_extent` is defined as `size_t(-1)` (in <sref ref="[span.syn]"/>)
29+
this immediately prohibits all dynamically padded layout mappings for
30+
any `index_type` for which:
31+
</p>
32+
<blockquote><pre>
33+
numeric_limit&lt;index_type&gt;::max() &lt; numeric_limit&lt;size_t&gt;::max()
34+
</pre></blockquote>
35+
<p>
36+
One example is `int` on a 64-bit system.
37+
<p/>
38+
The proposed resolution states that the modified representability
39+
<i>Mandates:</i> element holds for <tt>rank &lt;= 1</tt>, even though in that case the
40+
`PaddingValue` has no other effect. Hence, the <i>Mandates:</i> element could
41+
be weakened further.
42+
</p>
43+
</discussion>
44+
45+
<resolution>
46+
<p>
47+
This wording is relative to <paper num="N5014"/>.
48+
</p>
49+
50+
<ol>
51+
52+
<li><p>Modify <sref ref="[mdspan.layout.leftpad.overview]"/> as indicated:</p>
53+
54+
<blockquote>
55+
<p>
56+
-5- <i>Mandates</i>:
57+
</p>
58+
<ol style="list-style-type: none">
59+
<li><p>(5.1) &mdash; [&hellip;]</p></li>
60+
<li><p>(5.2) &mdash; <ins>if `padding_value` is not equal to `dynamic_extent`, then</ins>
61+
`padding_value` is representable as a value of type `index_type`.</p></li>
62+
<li><p>(5.3) &mdash; [&hellip;]</p></li>
63+
<li><p>(5.4) &mdash; [&hellip;]</p></li>
64+
</ol>
65+
</blockquote>
66+
67+
</li>
68+
69+
<li><p>Modify <sref ref="[mdspan.layout.rightpad.overview]"/> as indicated:</p>
70+
71+
<blockquote>
72+
<p>
73+
-5- <i>Mandates</i>:
74+
</p>
75+
<ol style="list-style-type: none">
76+
<li><p>(5.1) &mdash; [&hellip;]</p></li>
77+
<li><p>(5.2) &mdash; <ins>if `padding_value` is not equal to `dynamic_extent`, then</ins>
78+
`padding_value` is representable as a value of type `index_type`.</p></li>
79+
<li><p>(5.3) &mdash; [&hellip;]</p></li>
80+
<li><p>(5.4) &mdash; [&hellip;]</p></li>
81+
</ol>
82+
</blockquote>
83+
84+
</li>
85+
86+
</ol></resolution>
87+
88+
</issue>

0 commit comments

Comments
 (0)