Skip to content

Layout mappings and submdspan must take index resp. slice types convertible to index_type #411

@mhoemmen

Description

@mhoemmen

The Standard layout mappings' operator() accept arguments that are not integers, as long as

  • they are convertible to index_type, and
  • index_type is nothrow-constructible from them.

See e.g., [mdspan.layout.left.obs] 2. Also, submdspan accepts as a valid slice type any argument that models convertible_to<index_type>. However, the current reference mdspan implementation cannot handle either of these cases.

I have a branch that implements D3663R2 (if you enable a CMake option MDSPAN_ENABLE_P3663 that defaults to OFF). In that branch, I have a commit that fixes this bug (also for the non-D3663R2 case). The commit also adds regression tests for both layout mapping indexing and submdspan slicing.

@youyu3 This may be relevant to your interests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions