On Fri, 20 Mar 2026 at 08:02, Tomasz Kamiński <[email protected]> wrote: > > This patch implements the changes suggested in D3982R1 (and PL007 NB comment) > for C++26, but changing the strided_slice::extent to indicate number of > elements (extent) in the produced (output) mdspan, instead of input.
OK > > libstdc++-v3/ChangeLog: > > * include/std/mdspan (__mdspan::__static_slice_extent) > (__mdspan::__dynamic_slice_extent): Return unmodified extent > value for strided_slice. > (__mdspan::__substrides_generic, __mdspan::__substrides_standardized): > Multipliy stride, if more than one element is requested. > (__mdspan::__canonical_range_slice): Define. > (__mdspan::__slice_cast): Use __canonical_range_slice for range_slice > and two elements tuples. > (__mdspan::__check_inrange_index): Define. > (__mdspan::__check_valid_slice): Validate if slice.offset + > (slice.extent - 1) * slice.stride fits into extent of given > dimension. Check stride if slice.extent > 1. > * > testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc: > Add test for range_slice. > * > testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc: > Add tests validating new conditions. > * testsuite/23_containers/mdspan/submdspan/selections/testcases.h: > Adjusted for change of meaing of strided_slice::extent. > * testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc: > Adjusted for change of meaing of strided_slice::extent. And expanded > range_slice tests. > * testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc: > Adjusted for change of meaing of strided_slice::extent.
