ORNL / ORNL/cpp-proposals-pub

P0009: Add compile-time slices to submdspan

Open
#277 0 comments 0 reactions 0 assignees View on GitHub

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").

  1. full_exent_t (analogous to Fortran or Matlab colon)
  2. A type convertible to index_type (size_t in P0009R16, the last P0009 revision to include submdspan)
  3. 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.

  1. A type convertible to integral_constant<index_type, k> for some index_type value k
  2. A type convertible to tuple<integral_constant<index_type, j>, integral_constant<index_type, k>> for some index_type values j and k

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.