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.
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
submdspanyields 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,mdarraysupport is sorely missed.Here's a suggestion for an alternate subset function:
The idea is that the desired extents of the subset are passed as template parameters, while the offsets are passed as function arguments.
collapse_dimensioncan 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 currentsubmdspan.