Created on 2025-09-09.00:00:00 last changed 3 weeks ago
Proposed resolution:
This wording is relative to N5014.
Modify [mdspan.layout.leftpad.overview] as indicated:
-5- Mandates:
(5.1) — […]
(5.2) — if `padding_value` is not equal to `dynamic_extent`, then `padding_value` is representable as a value of type `index_type`.
(5.3) — […]
(5.4) — […]
Modify [mdspan.layout.rightpad.overview] as indicated:
-5- Mandates:
(5.1) — […]
(5.2) — if `padding_value` is not equal to `dynamic_extent`, then `padding_value` is representable as a value of type `index_type`.
(5.3) — […]
(5.4) — […]
Two new layouts were added to <mdspan> in C++26. Both have a template parameter `size_t PaddingValue`. This value is allowed to be `std::dynamic_extent` to signal that the padding value isn't known at compile time.
A class Mandates: element (in [mdspan.layout.leftpad.overview] (5.2) and [mdspan.layout.rightpad.overview] (5.2), respectively) requires (unconditionally) that`PaddingValue` is representable as a value of `index_type`.
Since `std::dynamic_extent` is defined as `size_t(-1)` (in [span.syn]) this immediately prohibits all dynamically padded layout mappings for any `index_type` for which:
numeric_limit<index_type>::max() < numeric_limit<size_t>::max()
One example is `int` on a 64-bit system.
The proposed resolution states that the modified representability Mandates: element holds for rank <= 1, even though in that case the `PaddingValue` has no other effect. Hence, the Mandates: element could be weakened further.History | |||
---|---|---|---|
Date | User | Action | Args |
2025-09-19 17:16:15 | admin | set | messages: + msg15061 |
2025-09-09 00:00:00 | admin | create |