The repo of the exciting mdspan, a multi-dimensional analogue of std::span suggested for the C++ standard libraries, now also contains a reference implementation of the closely-related mdarray, which unlike mdspan owns its data.
But whereas the submdspan function can produce a subset of an mdspan, I can't find an analogue for mdarray. What I was expecting was a function that behaves exactly the same as submdspan and returns an mdspan, but which operates on an mdarray.
Is this planned but not implemented yet? If not, why not?
Edit:
I've temporarily solved it with a home-brew solution in the form of an overload of submdspan that takes an mdarray, then creates a temporary mdspan that maps to the entire mdarray, and calls submdspan on that.
It does the job for now! But I'm not confident this covers every conceivable mdarray, as there is almost no documentation at the moment. Would still love an answer to the original question.
template <class ElementType, class Extents, class LayoutPolicy, class... SliceSpecs>
auto submdspan(
    mdarray<ElementType, Extents, LayoutPolicy> &arr, 
    SliceSpecs... slices)
{
    return submdspan(
        mdspan<ElementType, Extents, LayoutPolicy>(arr.data(), arr.mapping()), 
        slices...);
}