Created on 2023-11-29.00:00:00 last changed 5 days ago
Proposed resolution:
This wording is relative to N4964.
Modify [mdspan.extents.expo] as indicated:
template<class OtherIndexType> static constexpr auto index-cast(OtherIndexType&& i) noexcept;-9- Effects:
(9.1) — If remove_cvref_t<OtherIndexType> is an integral type other than bool, then equivalent to return i;,
(9.2) — otherwise, equivalent to return static_cast<index_type>(i);.
[Note 1: This function will always return an integral type other than bool. Since this function's call sites are constrained on convertibility of OtherIndexType to index_type, integer-class types can use the static_cast branch without loss of precision. — end note]
[ Kona 2025-11-08; Status changed: Voting → WP. ]
[ 2025-10-17; Reflector poll. ]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
"Doesn't matter in this case, but logically `decay_t` seems like a better fit."
The exposition-only static member index-cast of extents is specified as ([mdspan.extents.expo]/9):
template<class OtherIndexType> static constexpr auto index-cast(OtherIndexType&& i) noexcept;-9- Effects:
(9.1) — If OtherIndexType is an integral type other than bool, then equivalent to return i;,
(9.2) — otherwise, equivalent to return static_cast<index_type>(i);.
[Note 1: This function will always return an integral type other than bool. Since this function's call sites are constrained on convertibility of OtherIndexType to index_type, integer-class types can use the static_cast branch without loss of precision. — end note]
This function returns T when passed an rvalue of cv-unqualified integral type T, but index_type when passed a cv-qualified and/or lvalue argument of any integral type. It would seem more consistent and easier to reason about if 9.1 was instead conditional on remove_cvref_t<OtherIndexType>.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-11 10:48:16 | admin | set | messages: + msg15614 |
| 2025-11-11 10:48:16 | admin | set | status: voting -> wp |
| 2025-10-30 17:45:31 | admin | set | status: ready -> voting |
| 2025-10-17 12:23:55 | admin | set | messages: + msg15208 |
| 2025-10-17 12:23:55 | admin | set | status: new -> ready |
| 2023-12-02 14:51:47 | admin | set | messages: + msg13882 |
| 2023-11-29 00:00:00 | admin | create | |