[RFC v2 3/4] libstdc++: Rename std::strided_slice to std::extent_slice.
Jonathan Wakely
jwakely@redhat.com
Wed Apr 1 13:45:30 GMT 2026
On Fri, 20 Mar 2026 at 08:03, Tomasz Kamiński <tkaminsk@redhat.com> wrote:
>
> This is last change proposed in P3982R1, so we bump submdspan
> value.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/version.def (submdspan): Update to 202503.
202603, here and in version.def
OK with that change
> * include/bits/version.h: Regenerate.
> * include/std/mdspan: Replaced std::strided_stride to
> std::extent_slice, __is_strided_slice to __is_extent_slice,
> _SliceKind::__unit_strided_slice to __unit_stride_slice.
> * src/c++23/std.cc.in (std::extent_slice): Replaced
> std::strided_slice to std::extent_slice.
> * testsuite/23_containers/mdspan/submdspan/canonical_slices.cc:
> Replaced all occurences of strided_slice to extent_slice.
> * testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc:
> Likewise.
> * testsuite/23_containers/mdspan/submdspan/strided_slice.cc: Move to...
> * testsuite/23_containers/mdspan/submdspan/extent_slice.cc: ...here
> and handle rename.
> * testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc: Move to...
> * testsuite/23_containers/mdspan/submdspan/extent_slice_neg.cc: ...here
> and handle rename.
> * testsuite/23_containers/mdspan/submdspan/selections/testcases.h:
> Replaced all occurences of strided_slice to extent_slice.
> * testsuite/23_containers/mdspan/submdspan/subextents.cc: Likewise.
> * testsuite/23_containers/mdspan/submdspan/subextents_neg.cc:
> Likewise.
> * testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
> Likewise.
> ---
> libstdc++-v3/include/bits/version.def | 5 ++
> libstdc++-v3/include/bits/version.h | 5 ++
> libstdc++-v3/include/std/mdspan | 56 +++++++++----------
> libstdc++-v3/src/c++23/std.cc.in | 2 +-
> .../mdspan/submdspan/canonical_slices.cc | 26 ++++-----
> .../mdspan/submdspan/canonical_slices_neg.cc | 8 +--
> .../{strided_slice.cc => extent_slice.cc} | 12 ++--
> ...rided_slice_neg.cc => extent_slice_neg.cc} | 2 +-
> .../mdspan/submdspan/selections/testcases.h | 20 +++----
> .../mdspan/submdspan/subextents.cc | 30 +++++-----
> .../mdspan/submdspan/subextents_neg.cc | 12 ++--
> .../mdspan/submdspan/submdspan_mapping.cc | 32 +++++------
> .../mdspan/submdspan/submdspan_neg.cc | 40 ++++++-------
> 13 files changed, 130 insertions(+), 120 deletions(-)
> rename libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{strided_slice.cc => extent_slice.cc} (67%)
> rename libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{strided_slice_neg.cc => extent_slice_neg.cc} (84%)
>
> diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
> index dd77524b5a9..d1f39207107 100644
> --- a/libstdc++-v3/include/bits/version.def
> +++ b/libstdc++-v3/include/bits/version.def
> @@ -1117,6 +1117,11 @@ ftms = {
>
> ftms = {
> name = submdspan;
> + values = {
> + v = 202503; // P3982R1 Split strided_slice into extent_slice and range_slice for C++26
> + cxxmin = 26;
> + extra_cond = "__glibcxx_constant_wrapper >= 202506L";
> + };
> values = {
> v = 202411;
> cxxmin = 26;
> diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
> index bef61baeba8..97fb82e0645 100644
> --- a/libstdc++-v3/include/bits/version.h
> +++ b/libstdc++-v3/include/bits/version.h
> @@ -1243,6 +1243,11 @@
>
> #if !defined(__cpp_lib_submdspan)
> # if (__cplusplus > 202302L) && (__glibcxx_constant_wrapper >= 202506L)
> +# define __glibcxx_submdspan 202503L
> +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_submdspan)
> +# define __cpp_lib_submdspan 202503L
> +# endif
> +# elif (__cplusplus > 202302L) && (__glibcxx_constant_wrapper >= 202506L)
> # define __glibcxx_submdspan 202411L
> # if defined(__glibcxx_want_all) || defined(__glibcxx_want_submdspan)
> # define __cpp_lib_submdspan 202411L
> diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
> index 5b80de2ca61..f30c5e83d16 100644
> --- a/libstdc++-v3/include/std/mdspan
> +++ b/libstdc++-v3/include/std/mdspan
> @@ -356,7 +356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> inline constexpr full_extent_t full_extent{};
>
> template<typename _OffsetType, typename _ExtentType, typename _StrideType>
> - struct strided_slice
> + struct extent_slice
> {
> static_assert(__is_signed_or_unsigned_integer<_OffsetType>::value
> || __detail::__integral_constant_like<_OffsetType>);
> @@ -879,10 +879,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #ifdef __glibcxx_submdspan
> template<typename _Tp>
> - constexpr bool __is_strided_slice = false;
> + constexpr bool __is_extent_slice = false;
>
> template<typename _OffsetType, typename _ExtentType, typename _StrideType>
> - constexpr bool __is_strided_slice<strided_slice<_OffsetType,
> + constexpr bool __is_extent_slice<extent_slice<_OffsetType,
> _ExtentType, _StrideType>> = true;
>
> template<typename _Tp>
> @@ -921,7 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> template<typename _Slice, typename _IndexType>
> concept __acceptable_slice_type = same_as<_Slice, full_extent_t>
> || same_as<_Slice, _IndexType> || __is_constant_wrapper<_Slice>
> - || __is_strided_slice<_Slice>;
> + || __is_extent_slice<_Slice>;
>
> template<typename _IndexType, typename... _Slices>
> consteval auto
> @@ -954,7 +954,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> if constexpr (same_as<_Slice, full_extent_t>)
> return 0;
> - else if constexpr (__is_strided_slice<_Slice>)
> + else if constexpr (__is_extent_slice<_Slice>)
> return __slice.offset;
> else
> return __slice; // collapsing slice
> @@ -1011,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> constexpr typename _Extents::index_type
> __dynamic_slice_extent(const _Extents& __exts, _Slice __slice)
> {
> - if constexpr (__is_strided_slice<_Slice>)
> + if constexpr (__is_extent_slice<_Slice>)
> return __slice.extent;
> else
> return __exts.extent(_K);
> @@ -1125,7 +1125,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> auto __stride = [&__mapping](size_t __k, auto __slice) -> _IndexType
> {
> - if constexpr (__is_strided_slice<decltype(__slice)>)
> + if constexpr (__is_extent_slice<decltype(__slice)>)
> if (__slice.extent > 1)
> return __mapping.stride(__k) * __slice.stride;
> return __mapping.stride(__k);
> @@ -1169,7 +1169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> __stride *= _Trait::_S_padded_extent(__mapping, __i);
>
> size_t __krev = _SubTrait::_S_idx(__k);
> - if constexpr (__is_strided_slice<decltype(__slice)>)
> + if constexpr (__is_extent_slice<decltype(__slice)>)
> {
> if (__slice.extent > 1)
> __ret[__krev] = __stride * __slice.stride;
> @@ -1201,19 +1201,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
> template<typename _Slice>
> - concept __is_unit_stride_slice = (__mdspan::__is_strided_slice<_Slice>
> + concept __is_unit_stride_slice = (__mdspan::__is_extent_slice<_Slice>
> && __mdspan::__is_constant_wrapper<typename _Slice::stride_type>
> && _Slice::stride_type::value == 1)
> || std::same_as<_Slice, full_extent_t>;
>
> // These are (forced) exclusive categories:
> // - full & collapsing: obvious,
> - // - unit_strided_slice: strided_slice{a, b, cw<1>}, but not `full`,
> - // - strided_slice: strided_slice{a, b, c} with c != cw<1>.
> + // - unit_extent_slice: extent_slice{a, b, cw<1>}, but not `full`,
> + // - extent_slice: extent_slice{a, b, c} with c != cw<1>.
> enum class _SliceKind
> {
> - __strided_slice,
> - __unit_strided_slice,
> + __extent_slice,
> + __unit_stride_slice,
> __full,
> __collapsing
> };
> @@ -1224,12 +1224,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> if constexpr (std::same_as<_Slice, full_extent_t>)
> return _SliceKind::__full;
> - else if constexpr (__mdspan::__is_strided_slice<_Slice>)
> + else if constexpr (__mdspan::__is_extent_slice<_Slice>)
> {
> if constexpr (__mdspan::__is_unit_stride_slice<_Slice>)
> - return _SliceKind::__unit_strided_slice;
> + return _SliceKind::__unit_stride_slice;
> else
> - return _SliceKind::__strided_slice;
> + return _SliceKind::__extent_slice;
> }
> else
> return _SliceKind::__collapsing;
> @@ -1260,7 +1260,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> auto __last = __slice_kinds[__block_size - 1];
> return __last == _SliceKind::__full
> - || __last == _SliceKind::__unit_strided_slice;
> + || __last == _SliceKind::__unit_stride_slice;
> }
>
> // __u __u + __sub_rank-2
> @@ -1270,7 +1270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> size_t __sub_rank)
> {
> if (__slice_kinds[0] != _SliceKind::__full
> - && __slice_kinds[0] != _SliceKind::__unit_strided_slice)
> + && __slice_kinds[0] != _SliceKind::__unit_stride_slice)
> return dynamic_extent;
> else if (__slice_kinds.size() == 1)
> return dynamic_extent;
> @@ -1361,7 +1361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> size_t __sub_rank)
> {
> if (__sub_rank == 1)
> - return __slice_kinds[0] == _SliceKind::__unit_strided_slice
> + return __slice_kinds[0] == _SliceKind::__unit_stride_slice
> || __slice_kinds[0] == _SliceKind::__full;
> else
> return false;
> @@ -1429,7 +1429,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> size_t __sub_rank)
> {
> if (__sub_rank == 1)
> - return __slice_kinds[_Nm - 1] == _SliceKind::__unit_strided_slice
> + return __slice_kinds[_Nm - 1] == _SliceKind::__unit_stride_slice
> || __slice_kinds[_Nm - 1] == _SliceKind::__full;
> else
> return false;
> @@ -3299,7 +3299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> if constexpr (is_same_v<_SpanType, constant_wrapper<_IndexType(0)>>
> || is_same_v<_StrideType, constant_wrapper<_IndexType(1)>>)
> - return strided_slice{
> + return extent_slice{
> .offset = __offset,
> .extent = __span,
> .stride = cw<_IndexType(1)>
> @@ -3308,20 +3308,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> static_assert(_StrideType::value > 0);
> if constexpr (__is_constant_wrapper<_SpanType>)
> - return strided_slice{
> + return extent_slice{
> .offset = __offset,
> .extent = cw<_IndexType(1 + (_SpanType::value - 1) / _StrideType::value)>,
> .stride = __stride
> };
> else
> - return strided_slice{
> + return extent_slice{
> .offset = __offset,
> .extent = _IndexType(__span > 0 ? 1 + (__span - 1) / _StrideType::value : 0),
> .stride = __stride
> };
> }
> else if (__span == 0 || __stride == 1)
> - return strided_slice{
> + return extent_slice{
> .offset = __offset,
> .extent = _IndexType(__span),
> .stride = _IndexType(1)
> @@ -3329,7 +3329,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> else
> {
> __glibcxx_assert(__stride > 0);
> - return strided_slice{
> + return extent_slice{
> .offset = __offset,
> .extent = _IndexType(1 + (__span - 1) / __stride),
> .stride = __stride
> @@ -3346,8 +3346,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> return static_cast<full_extent_t>(std::move(__slice));
> else if constexpr (is_convertible_v<_SliceType, _IndexType>)
> return __mdspan::__canonical_index<_IndexType>(std::move(__slice));
> - else if constexpr (__is_strided_slice<_SliceType>)
> - return strided_slice{
> + else if constexpr (__is_extent_slice<_SliceType>)
> + return extent_slice{
> .offset = __mdspan::__canonical_index<_IndexType>(std::move(__slice.offset)),
> .extent = __mdspan::__canonical_index<_IndexType>(std::move(__slice.extent)),
> .stride = __mdspan::__canonical_index<_IndexType>(std::move(__slice.stride))
> @@ -3412,7 +3412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> __check_valid_slice(const extents<_IndexType, _Extent>& __ext,
> const _Slice& __slice)
> {
> - if constexpr (__is_strided_slice<_Slice>)
> + if constexpr (__is_extent_slice<_Slice>)
> {
> __mdspan::__check_valid_index(__ext, __slice.extent);
> // DEVIATION: For empty slices, P3663r3 does not allow us to check
> diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in
> index e3083fe1261..c896b1a27c2 100644
> --- a/libstdc++-v3/src/c++23/std.cc.in
> +++ b/libstdc++-v3/src/c++23/std.cc.in
> @@ -1914,7 +1914,7 @@ export namespace std
> using std::layout_right_padded;
> #endif
> #if __glibcxx_submdspan
> - using std::strided_slice;
> + using std::extent_slice;
> using std::range_slice;
> using std::full_extent_t;
> using std::full_extent;
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> index 7e6a0791af7..d747ad40de2 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> @@ -242,7 +242,7 @@ test_triple_all()
> }
>
> constexpr bool
> -test_strided_slice(auto exts, auto co, auto ce, auto cs)
> +test_extent_slice(auto exts, auto co, auto ce, auto cs)
> {
> using IndexType = decltype(exts)::index_type;
>
> @@ -250,25 +250,25 @@ test_strided_slice(auto exts, auto co, auto ce, auto cs)
> auto cextent = std::cw<IndexType{ce.value}>;
> auto cstride = std::cw<IndexType{cs.value}>;
>
> - auto raw_ccc = std::strided_slice{co, ce, cs};
> + auto raw_ccc = std::extent_slice{co, ce, cs};
> auto [ccc] = std::canonical_slices(exts, raw_ccc);
> assert_same(ccc.offset, coffset);
> assert_same(ccc.extent, cextent);
> assert_same(ccc.stride, cstride);
>
> - auto raw_dcc = std::strided_slice{co.value, ce, cs};
> + auto raw_dcc = std::extent_slice{co.value, ce, cs};
> auto [dcc] = std::canonical_slices(exts, raw_dcc);
> assert_same(dcc.offset, coffset.value);
> assert_same(dcc.extent, cextent);
> assert_same(dcc.stride, cstride);
>
> - auto raw_cdc = std::strided_slice{co, ce.value, cs};
> + auto raw_cdc = std::extent_slice{co, ce.value, cs};
> auto [cdc] = std::canonical_slices(exts, raw_cdc);
> assert_same(cdc.offset, coffset);
> assert_same(cdc.extent, cextent.value);
> assert_same(cdc.stride, cstride);
>
> - auto raw_ccd = std::strided_slice{co, ce, cs.value};
> + auto raw_ccd = std::extent_slice{co, ce, cs.value};
> auto [ccd] = std::canonical_slices(exts, raw_ccd);
> assert_same(ccd.offset, coffset);
> assert_same(ccd.extent, cextent);
> @@ -277,17 +277,17 @@ test_strided_slice(auto exts, auto co, auto ce, auto cs)
> }
>
> constexpr bool
> -test_strided_slice()
> +test_extent_slice()
> {
> auto run = [](auto exts)
> {
> auto cs = std::cw<uint8_t{1}>;
> - test_strided_slice(exts, std::cw<uint8_t{2}>, std::cw<uint8_t{2}>, std::cw<uint8_t{2}>);
> - test_strided_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{5}>, std::cw<uint8_t{1}>);
> - test_strided_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{1}>);
> - test_strided_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{3}>);
> - test_strided_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>);
> - test_strided_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{9}>);
> + test_extent_slice(exts, std::cw<uint8_t{2}>, std::cw<uint8_t{2}>, std::cw<uint8_t{2}>);
> + test_extent_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{5}>, std::cw<uint8_t{1}>);
> + test_extent_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{1}>);
> + test_extent_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{3}>);
> + test_extent_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>);
> + test_extent_slice(exts, std::cw<uint8_t{0}>, std::cw<uint8_t{0}>, std::cw<uint8_t{9}>);
> };
>
> run(std::extents<int, 5>{});
> @@ -301,7 +301,7 @@ test_all()
> test_scalar();
> test_pair_all();
> test_triple_all();
> - test_strided_slice();
> + test_extent_slice();
> return true;
> }
>
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> index 3923d5393b9..5c61e938da5 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> @@ -65,7 +65,7 @@ template<typename Offset, typename Extent, typename Stride, typename Extents>
> constexpr bool
> test_under2(Offset o, Extent e, Stride s, Extents exts)
> {
> - std::canonical_slices(exts, std::strided_slice{o, e, s});
> + std::canonical_slices(exts, std::extent_slice{o, e, s});
> return true;
> }
>
> @@ -105,7 +105,7 @@ template<typename Offset, typename Extent, typename Stride, typename Extents>
> constexpr bool
> test_over2(Offset o, Extent e, Stride s, Extents exts)
> {
> - std::canonical_slices(exts, std::strided_slice{o, e, s});
> + std::canonical_slices(exts, std::extent_slice{o, e, s});
> return true;
> }
>
> @@ -189,7 +189,7 @@ constexpr bool
> test_overflow1(auto o, auto e)
> {
> auto exts = std::extents<uint8_t, dyn>{255};
> - auto slice = std::strided_slice{o, e, 1};
> + auto slice = std::extent_slice{o, e, 1};
> std::canonical_slices(exts, slice);
> return true;
> }
> @@ -224,7 +224,7 @@ constexpr bool
> test_invalid(auto e, auto s)
> {
> auto exts = std::extents(5);
> - auto slice = std::strided_slice(0, e, s);
> + auto slice = std::extent_slice(0, e, s);
> std::canonical_slices(exts, slice);
> return true;
> }
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice.cc
> similarity index 67%
> rename from libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice.cc
> rename to libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice.cc
> index 6fa5aaa2f1e..1a2a5b21399 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice.cc
> @@ -5,9 +5,9 @@
> #include <testsuite_hooks.h>
>
> constexpr void
> -check_strided_slice(auto s, auto offset, auto extent, auto stride)
> +check_extent_slice(auto s, auto offset, auto extent, auto stride)
> {
> - using slice_type = std::strided_slice<decltype(offset), decltype(extent),
> + using slice_type = std::extent_slice<decltype(offset), decltype(extent),
> decltype(stride)>;
> static_assert(std::same_as<decltype(s), slice_type>);
> VERIFY(s.offset == offset);
> @@ -20,12 +20,12 @@ test_initializers(auto offset, auto extent, auto stride)
> {
> auto check = [&](auto s)
> {
> - check_strided_slice(s, offset, extent, stride);
> + check_extent_slice(s, offset, extent, stride);
> };
>
> - check(std::strided_slice{.offset=offset, .extent=extent, .stride=stride});
> - check(std::strided_slice{offset, extent, stride});
> - check(std::strided_slice(offset, extent, stride));
> + check(std::extent_slice{.offset=offset, .extent=extent, .stride=stride});
> + check(std::extent_slice{offset, extent, stride});
> + check(std::extent_slice(offset, extent, stride));
> }
>
> constexpr bool
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice_neg.cc
> similarity index 84%
> rename from libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc
> rename to libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice_neg.cc
> index 0f1d791d13a..9740b37668a 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/extent_slice_neg.cc
> @@ -7,7 +7,7 @@ template<typename OffsetType, typename ExtentType, typename StrideType>
> constexpr bool
> test_invalid()
> {
> - auto s1 = std::strided_slice(OffsetType{}, ExtentType{}, StrideType{}); // { dg-error "required from" }
> + auto s1 = std::extent_slice(OffsetType{}, ExtentType{}, StrideType{}); // { dg-error "required from" }
> return true;
> }
>
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/selections/testcases.h b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/selections/testcases.h
> index eade9017e03..536d2ad5174 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/selections/testcases.h
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/selections/testcases.h
> @@ -9,10 +9,10 @@ constexpr size_t dyn = std::dynamic_extent;
> constexpr auto all = std::full_extent;
>
> template<typename T>
> - constexpr bool is_strided_slice = false;
> + constexpr bool is_extent_slice = false;
>
> template<typename O, typename E, typename S>
> - constexpr bool is_strided_slice<std::strided_slice<O, E, S>> = true;
> + constexpr bool is_extent_slice<std::extent_slice<O, E, S>> = true;
>
> template<typename MDSpan>
> constexpr void
> @@ -151,7 +151,7 @@ template<typename IndexType, typename Slice>
> std::ranges::iota(ret, 0);
> return ret;
> }
> - else if constexpr (is_strided_slice<Slice>)
> + else if constexpr (is_extent_slice<Slice>)
> {
> auto ret = std::vector<IndexType>{};
> size_t n = static_cast<size_t>(slice.extent);
> @@ -292,10 +292,10 @@ template<typename Layout>
> check_selection<Layout>(exts, collapse{}, s, collapse{});
> };
>
> - check(std::strided_slice(0, 1, 2));
> - check(std::strided_slice(0, 2, 2));
> - check(std::strided_slice(1, 2, 2));
> - check(std::strided_slice(1, std::cw<2>, std::cw<2>));
> + check(std::extent_slice(0, 1, 2));
> + check(std::extent_slice(0, 2, 2));
> + check(std::extent_slice(1, 2, 2));
> + check(std::extent_slice(1, std::cw<2>, std::cw<2>));
> return true;
> }
>
> @@ -303,9 +303,9 @@ template<typename Layout>
> constexpr bool
> test_strided_box_selection(auto exts)
> {
> - auto s0 = std::strided_slice(0, 2, 2);
> - auto s1 = std::strided_slice(1, 2, 2);
> - auto s2 = std::strided_slice(0, 3, 3);
> + auto s0 = std::extent_slice(0, 2, 2);
> + auto s1 = std::extent_slice(1, 2, 2);
> + auto s2 = std::extent_slice(0, 3, 3);
>
> check_selection<Layout>(exts, s0, s1, s2);
> return true;
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> index 379fb79dfc2..35927a0276e 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> @@ -82,13 +82,13 @@ template<typename Int>
>
> template<template<int> typename Cw>
> constexpr bool
> - test_from_strided_slice()
> + test_from_extent_slice()
> {
> auto exts = std::extents<int, 5, 7, 11>{};
> {
> auto s0 = 1;
> - auto s1 = std::strided_slice{0, 0, 0};
> - auto s2 = std::strided_slice{1, Cw<0>{}, 0};
> + auto s1 = std::extent_slice{0, 0, 0};
> + auto s2 = std::extent_slice{1, Cw<0>{}, 0};
> auto sub_exts = std::subextents(exts, s0, s1, s2);
> VERIFY(sub_exts.rank() == 2);
> VERIFY(sub_exts.static_extent(0) == dyn);
> @@ -98,8 +98,8 @@ template<template<int> typename Cw>
>
> {
> auto s0 = 1;
> - auto s1 = std::strided_slice{0, 2, Cw<1>{}};
> - auto s2 = std::strided_slice{1, Cw<2>{}, 1};
> + auto s1 = std::extent_slice{0, 2, Cw<1>{}};
> + auto s2 = std::extent_slice{1, Cw<2>{}, 1};
> auto sub_exts = std::subextents(exts, s0, s1, s2);
> VERIFY(sub_exts.rank() == 2);
> VERIFY(sub_exts.static_extent(0) == dyn);
> @@ -110,8 +110,8 @@ template<template<int> typename Cw>
> {
> // selected = 1 x [1, 3] x [1, 4, 7, 10]
> auto s0 = 1;
> - auto s1 = std::strided_slice{1, Cw<2>{}, 2};
> - auto s2 = std::strided_slice{1, Cw<4>{}, Cw<3>{}};
> + auto s1 = std::extent_slice{1, Cw<2>{}, 2};
> + auto s2 = std::extent_slice{1, Cw<4>{}, Cw<3>{}};
> auto sub_exts = std::subextents(exts, s0, s1, s2);
> VERIFY(sub_exts.rank() == 2);
> VERIFY(sub_exts.static_extent(0) == 2);
> @@ -120,9 +120,9 @@ template<template<int> typename Cw>
>
> {
> // selected = [0, 2] x [1, 3] x [0, 3, 6]
> - auto s0 = std::strided_slice(0, 2, 2);
> - auto s1 = std::strided_slice(1, 2, 2);
> - auto s2 = std::strided_slice(0, 3, 3);
> + auto s0 = std::extent_slice(0, 2, 2);
> + auto s1 = std::extent_slice(1, 2, 2);
> + auto s2 = std::extent_slice(0, 3, 3);
> auto sub_exts = std::subextents(exts, s0, s1, s2);
> VERIFY(sub_exts.rank() == 3);
> VERIFY(sub_exts.extent(0) == 2);
> @@ -132,9 +132,9 @@ template<template<int> typename Cw>
>
> {
> // selected = [0] x [1] x [2]
> - auto s0 = std::strided_slice(0, 1, 99);
> - auto s1 = std::strided_slice(1, 1, 99);
> - auto s2 = std::strided_slice(2, 1, 99);
> + auto s0 = std::extent_slice(0, 1, 99);
> + auto s1 = std::extent_slice(1, 1, 99);
> + auto s2 = std::extent_slice(2, 1, 99);
> auto sub_exts = std::subextents(exts, s0, s1, s2);
> VERIFY(sub_exts.rank() == 3);
> VERIFY(sub_exts.extent(0) == 1);
> @@ -248,8 +248,8 @@ test_all()
> test_from_pair_all<IC>();
> test_from_const_int<CW>();
> test_from_const_int<IC>();
> - test_from_strided_slice<CW>();
> - test_from_strided_slice<IC>();
> + test_from_extent_slice<CW>();
> + test_from_extent_slice<IC>();
> test_from_triple_all<CW>();
> test_from_triple_all<IC>();
> test_from_int_like_in_tuple<StructuralInt>();
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> index 5b11424680d..2ff419ec50c 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> @@ -19,7 +19,7 @@ constexpr bool
> test_invalid_stride_zero()
> {
> auto exts = std::extents(3, 5, 7);
> - auto s = std::strided_slice{0, 2, 0};
> + auto s = std::extent_slice{0, 2, 0};
> auto sub_exts = std::subextents(exts, 1, s, 2); // { dg-error "expansion of" }
> return true;
> }
> @@ -33,13 +33,13 @@ test_out_of_bounds(const Slice& slice)
> auto sub_exts = std::subextents(exts, 1, slice, 2); // { dg-error "expansion of" }
> return true;
> }
> -static_assert(test_out_of_bounds(std::strided_slice{0, 6, 1})); // { dg-error "expansion of" }
> -static_assert(test_out_of_bounds(std::strided_slice{0, 4, 2})); // { dg-error "expansion of" }
> -static_assert(test_out_of_bounds(std::strided_slice{1, 6, 1})); // { dg-error "expansion of" }
> -static_assert(test_out_of_bounds(std::strided_slice{1, 4, 2})); // { dg-error "expansion of" }
> +static_assert(test_out_of_bounds(std::extent_slice{0, 6, 1})); // { dg-error "expansion of" }
> +static_assert(test_out_of_bounds(std::extent_slice{0, 4, 2})); // { dg-error "expansion of" }
> +static_assert(test_out_of_bounds(std::extent_slice{1, 6, 1})); // { dg-error "expansion of" }
> +static_assert(test_out_of_bounds(std::extent_slice{1, 4, 2})); // { dg-error "expansion of" }
> static_assert(test_out_of_bounds(std::tuple{1, 6})); // { dg-error "expansion of" }
> static_assert(test_out_of_bounds(std::tuple{std::cw<1>, std::cw<6>})); // { dg-error "expansion of" }
> -static_assert(test_out_of_bounds(std::strided_slice{-1, 2, 1})); // { dg-error "expansion of" }
> +static_assert(test_out_of_bounds(std::extent_slice{-1, 2, 1})); // { dg-error "expansion of" }
> static_assert(test_out_of_bounds(std::tuple{-1, 2})); // { dg-error "expansion of" }
>
> // { dg-prune-output "cannot decompose class type 'NotASlice'" }
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc
> index efd71d10f9d..f52d752079e 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc
> @@ -34,7 +34,7 @@ template<typename Layout>
>
> auto exts = Traits::make_extents(std::dims<5, int>(3, 5, 7, 11, 13));
> auto m = typename Layout::mapping(exts);
> - auto s251 = std::strided_slice{2, 5, std::cw<1>};
> + auto s251 = std::extent_slice{2, 5, std::cw<1>};
>
> {
> auto slices = std::tuple{0, 0, 0, 0, 0};
> @@ -44,7 +44,7 @@ template<typename Layout>
> }
>
> {
> - auto s0 = std::strided_slice{1, 1, std::cw<1>};
> + auto s0 = std::extent_slice{1, 1, std::cw<1>};
> auto slices = std::tuple{s0, all, all, s251, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = typename decltype(result.mapping)::layout_type;
> @@ -52,7 +52,7 @@ template<typename Layout>
> }
>
> {
> - auto s0 = std::strided_slice{1, 2, std::cw<1>};
> + auto s0 = std::extent_slice{1, 2, std::cw<1>};
> auto slices = std::tuple{s0, all, all, s251, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = typename decltype(result.mapping)::layout_type;
> @@ -60,7 +60,7 @@ template<typename Layout>
> }
>
> {
> - auto s0 = std::strided_slice{1, 2, std::cw<1>};
> + auto s0 = std::extent_slice{1, 2, std::cw<1>};
> auto slices = std::tuple{s0, 0, all, s251, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = typename decltype(result.mapping)::layout_type;
> @@ -68,7 +68,7 @@ template<typename Layout>
> }
>
> {
> - auto s0 = std::strided_slice{1, 2, 1};
> + auto s0 = std::extent_slice{1, 2, 1};
> auto slices = std::tuple{s0, all, all, s251, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = decltype(result.mapping)::layout_type;
> @@ -83,7 +83,7 @@ template<typename Layout>
> }
>
> {
> - auto s3 = std::strided_slice{2, std::cw<7>, std::cw<2>};
> + auto s3 = std::extent_slice{2, std::cw<7>, std::cw<2>};
> auto slices = std::tuple{all, all, all, s3, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = decltype(result.mapping)::layout_type;
> @@ -101,7 +101,7 @@ template<typename Layout>
>
> auto exts = Traits::make_extents(std::dims<5, int>(3, 5, 7, 11, 13));
> auto m = typename Layout::mapping(exts);
> - auto s251 = std::strided_slice{2, 5, std::cw<1>};
> + auto s251 = std::extent_slice{2, 5, std::cw<1>};
>
> {
> auto slices = std::tuple{all, all, all, s251, 0};
> @@ -121,7 +121,7 @@ template<typename Layout>
>
> auto exts = Traits::make_extents(std::dims<5, int>(3, 5, 7, 11, 13));
> auto m = typename Layout::mapping(exts);
> - auto s251 = std::strided_slice{2, 5, std::cw<1>};
> + auto s251 = std::extent_slice{2, 5, std::cw<1>};
>
> {
> auto slices = std::tuple{all, all, all, s251, 0};
> @@ -140,7 +140,7 @@ template<typename Layout>
> }
>
> {
> - auto s121 = std::strided_slice{1, 2, std::cw<1>};
> + auto s121 = std::extent_slice{1, 2, std::cw<1>};
> auto slices = std::tuple{s121, 0, 0, 0, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = typename decltype(result.mapping)::layout_type;
> @@ -149,7 +149,7 @@ template<typename Layout>
> }
>
> {
> - auto s121 = std::strided_slice{1, 2, std::cw<1>};
> + auto s121 = std::extent_slice{1, 2, std::cw<1>};
> auto slices = std::tuple{0, s121, 0, 0, 0};
> auto result = call_submdspan_mapping(m, Traits::make_tuple(slices));
> using layout_type = typename decltype(result.mapping)::layout_type;
> @@ -163,8 +163,8 @@ template<typename Layout>
> test_layout_unpadded_padding_value()
> {
> using Traits = LayoutTraits<DeducePaddingSide::from_typename<Layout>()>;
> - auto s0 = std::strided_slice{size_t(1), size_t(2), std::cw<size_t(1)>};
> - auto s3 = std::strided_slice{size_t(2), size_t(5), std::cw<size_t(1)>};
> + auto s0 = std::extent_slice{size_t(1), size_t(2), std::cw<size_t(1)>};
> + auto s3 = std::extent_slice{size_t(2), size_t(5), std::cw<size_t(1)>};
>
> auto check = [&](auto exts, size_t expected)
> {
> @@ -196,8 +196,8 @@ template<typename Layout>
> test_layout_padded_padding_value()
> {
> using Traits = LayoutTraits<DeducePaddingSide::from_typename<Layout>()>;
> - auto s0 = std::strided_slice{size_t(1), size_t(2), std::cw<size_t(1)>};
> - auto s3 = std::strided_slice{size_t(2), size_t(5), std::cw<size_t(1)>};
> + auto s0 = std::extent_slice{size_t(1), size_t(2), std::cw<size_t(1)>};
> + auto s3 = std::extent_slice{size_t(2), size_t(5), std::cw<size_t(1)>};
>
> auto check = [&](auto exts, size_t expected)
> {
> @@ -235,8 +235,8 @@ test_layout_stride_return_types()
> auto m = std::layout_stride::mapping(exts, std::array{2, 12});
>
> using index_type = decltype(exts)::index_type;
> - auto s1 = std::strided_slice{index_type(2), index_type(2),
> - std::cw<index_type(2)>};
> + auto s1 = std::extent_slice{index_type(2), index_type(2),
> + std::cw<index_type(2)>};
> auto result = submdspan_mapping(m, index_type(1), s1);
> using layout_type = decltype(result.mapping)::layout_type;
> static_assert(std::same_as<layout_type, std::layout_stride>);
> diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc
> index 74fccc6f014..8e673a08433 100644
> --- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc
> @@ -73,47 +73,47 @@ static_assert(test_tuple_over<std::layout_stride>()); // { dg-error "expansion o
>
> template<typename Layout>
> constexpr bool
> - test_strided_slice_zero()
> + test_extent_slice_zero()
> {
> - check_slice_range<Layout>(1, std::strided_slice{1, 2, 0}, 2); // { dg-error "expansion of" }
> + check_slice_range<Layout>(1, std::extent_slice{1, 2, 0}, 2); // { dg-error "expansion of" }
> return true;
> }
> -static_assert(test_strided_slice_zero<std::layout_left>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_zero<std::layout_right>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_zero<std::layout_stride>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_zero<std::layout_left>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_zero<std::layout_right>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_zero<std::layout_stride>()); // { dg-error "expansion of" }
>
> template<typename Layout>
> constexpr bool
> - test_strided_slice_offset_under()
> + test_extent_slice_offset_under()
> {
> - check_slice_range<Layout>(1, std::strided_slice{-1, 1, 1}, 2); // { dg-error "expansion of" }
> + check_slice_range<Layout>(1, std::extent_slice{-1, 1, 1}, 2); // { dg-error "expansion of" }
> return true;
> }
> -static_assert(test_strided_slice_offset_under<std::layout_left>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_offset_under<std::layout_right>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_offset_under<std::layout_stride>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_under<std::layout_left>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_under<std::layout_right>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_under<std::layout_stride>()); // { dg-error "expansion of" }
>
> template<typename Layout>
> constexpr bool
> - test_strided_slice_offset_over()
> + test_extent_slice_offset_over()
> {
> - check_slice_range<Layout>(1, std::strided_slice{6, 0, 1}, 2); // { dg-error "expansion of" }
> + check_slice_range<Layout>(1, std::extent_slice{6, 0, 1}, 2); // { dg-error "expansion of" }
> return true;
> }
> -static_assert(test_strided_slice_offset_over<std::layout_left>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_offset_over<std::layout_right>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_offset_over<std::layout_stride>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_over<std::layout_left>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_over<std::layout_right>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_offset_over<std::layout_stride>()); // { dg-error "expansion of" }
>
> template<typename Layout>
> constexpr bool
> - test_strided_slice_extent_over()
> + test_extent_slice_extent_over()
> {
> - check_slice_range<Layout>(1, std::strided_slice{1, 5, 1}, 2); // { dg-error "expansion of" }
> + check_slice_range<Layout>(1, std::extent_slice{1, 5, 1}, 2); // { dg-error "expansion of" }
> return true;
> }
> -static_assert(test_strided_slice_extent_over<std::layout_left>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_extent_over<std::layout_right>()); // { dg-error "expansion of" }
> -static_assert(test_strided_slice_extent_over<std::layout_stride>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_extent_over<std::layout_left>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_extent_over<std::layout_right>()); // { dg-error "expansion of" }
> +static_assert(test_extent_slice_extent_over<std::layout_stride>()); // { dg-error "expansion of" }
>
> // { dg-prune-output "static assertion failed" }
> // { dg-prune-output "__glibcxx_assert_fail" }
> --
> 2.53.0
>
More information about the Libstdc++
mailing list