[mdspan.sub.helpers] Fix swapped offset/extent in canonical-slice#9139
Conversation
The extent_slice branch of canonical-slice initializes .offset from s.extent and .extent from s.offset, reversing the intended mapping. This is inconsistent with canonical-range-slice and the pre-P3982R2 wording, both of which map offset → offset and extent → extent.
|
I'm not sure whether this is editorial. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3982r2.html does have this problem. Does this require an LWG issue or can we treat this as an obvious typo @jwakely |
|
Happy to file LWG if its more appropriate. |
https://github.com/cplusplus/draft/wiki/How-to-tell-if-an-issue-is-editorial This seems clearly editorial, the intended meaning is to initialize the offset with the offset and the extent with the extent. |
|
That was a typo, libstdc++ implementation implemented the PR: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/std/mdspan;h=f5556f35fa1497f2bbd1c4debd822841ec5f05c3;hb=HEAD#l3356. That was intent from the start. |
The
extent_slicebranch ofcanonical-slice([mdspan.sub.helpers]) initializes.offsetfroms.extentand.extentfroms.offset, reversing the intended mapping. This is inconsistent withcanonical-range-sliceand the pre-P3982R2 wording, both of which map offset → offset and extent → extent.