https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110352

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <[email protected]>:

https://gcc.gnu.org/g:ead579d3c52a3b1d8ba5f337a2c7c3bd3749c011

commit r16-5989-gead579d3c52a3b1d8ba5f337a2c7c3bd3749c011
Author: Luc Grosheintz <[email protected]>
Date:   Mon Dec 8 21:23:41 2025 +0100

    libstdc++: Implement submdspan and submdspan_mapping for layout_left.
[PR110352]

    Implements `submdspan` and `submdspan_mapping` for layout_left as
    described in P3663 (Future proofing mdspan).

    When computing the offset of the submdspan, one must check that the
    lower bound of the slice range isn't out-of-range. There's a few
    cases when the lower bound is never out-of-range:

      - full_extent and exts.extent(k) != 0,
      - collapsing slice types.

    If those conditions are known to hold, no checks are generated.

    Similarly, if all slices are full_extent, there's no need to call
    mapping(0,...,0) for standardized mappings.

    The implementation prepares to use the symmetry between layout_left and
    layout_right and introduces concepts like a "layout side", i.e. left,
    right or unknown/strided.

    The tests use an iterator to replace nested for-loops. Which also makes
    it easier to write the core test logic in a rank-independent manner.

            PR libstdc++/110352

    libstdc++-v3/ChangeLog:

            * include/std/mdspan (__mdspan::__is_submdspan_mapping_result)
            (__mdspan::__submdspan_mapping_result, __mdspan::__fwd_prod)
            (__mdspan::__acceptable_slice_type, __mdspan::__slice_begin)
            (__mdspan::__suboffset, __mdspan::_LayoutSide,
__mdspan::__mapping_side)
            (__mdspan::_StridesTrait, __mdspan::__substrides_generic)
            (__mdspan::__substrides_standardized, __mdspan::__substrides)
            (__mdspan::__is_unit_stride_slice, __mdspan::_SliceKind)
            (__mdspan::__make_slice_kind, __mdspan::__make_slice_kind_array)
            (__mdspan::__is_block, __mdspan::__padded_block_begin_generic)
            (__mdspan::__padded_block_begin, __mpdspan::_SubMdspanMapping)
            (__mdspan::__submdspan_mapping_impl): Define.
            (__mdspan::__dynamic_slice_extent, __mdspan::__static_slice_extent)
            (__mdspan::__subextents): Move earlier in the file.
            (layout_left::mapping::submdspan_mapping,
__mdspan::__sliceable_mapping)
            (__mdspan::__submapping, submdspan): Define.
            * src/c++23/std.cc.in: Add submdspan.
            * testsuite/23_containers/mdspan/submdspan/generic.cc: New test.
            * testsuite/23_containers/mdspan/submdspan/selections/left.cc:
            Instantiate selection tests for layout_left.
            * testsuite/23_containers/mdspan/submdspan/selections/testcases.h:
Generic
            tests different selections.
            * testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
New test.
            * testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc: New
test.

    Reviewed-by: Tomasz KamiÅski <[email protected]>
    Signed-off-by: Luc Grosheintz <[email protected]>

Reply via email to