P0009: Add compile-time slices to submdspan
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 29
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
submdspan currently takes three types of slice parameters ("SliceSpecifiers").
full_exent_t(analogous to Fortran or Matlab colon)- A type convertible to
index_type(size_tin P0009R16, the last P0009 revision to includesubmdspan) - A type convertible to
tuple<index_type, index_type>(tuple<size_t, size_t>in R16)
The return type depends only on the types of the input, not their values. Thus, even though submdspan is constexpr, it's impossible to use the value of an index_type or tuple parameter to determine the type of the layout. This matters for custom layouts that represent all extents and strides information as compile-time constants.
One way to fix this would be to allow two more categories of slice parameter types.
- A type convertible to
integral_constant<index_type, k>for someindex_typevaluek - A type convertible to
tuple<integral_constant<index_type, j>, integral_constant<index_type, k>>for someindex_typevaluesjandk
These categories would also permit optimization for existing layouts, by letting the returned mdspan have compile-time extents if possible.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing submdspan SliceSpecifiers description and P0009R16, especially how input types determine the returned layout. Develop a proposal for the two compile-time slice categories and specify their effect on returned mdspan types, including compatibility with existing layouts. Done means the semantics and type consequences are clearly documented for committee review.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100