Skip to content

submdspan unable to yield static extents #166

@johan-overbye

Description

@johan-overbye

First of all, thank you so much for this amazing proposal. Really hope it makes it into the standard!

One thing that's putting a slight damper on its usefulness, is that submdspan yields a dynamic extent even if a static extent is possible. In fact it looks like it can't be implemented to yield static extents, as the extents are determined by function arguments. Also, mdarray support is sorely missed.

Here's a suggestion for an alternate subset function:

mdarray<float, extents<size_t, 4, 4>> matrix;
int i;
auto row = submdspan<collapse_dimension, 4>(matrix, i, 0);
// decltype(row) is mdspan<float, extents<size_t, 4>>

The idea is that the desired extents of the subset are passed as template parameters, while the offsets are passed as function arguments. collapse_dimension can be of a dummy type, and indicate that that extent should be "collapsed" or removed from the resulting subset, similarly to passing a number instead of a pair to the current submdspan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions