I've been experimenting with mdspan for a few days, and one thing remains unclear to me: Is it possible to use submdspan to create an mdspan that "views" the original data in reverse order?
For example, consider a span with 9 rows and 10 columns:
constexpr int num_rows = 9;
constexpr int num_columns = 10;
auto data = std::views::iota(0, num_columns * num_rows) | std::ranges::to<std::vector>();
const exstd::mdspan<const int, exstd::extents<int, num_rows, num_columns>, exstd::layout_right> span{data.data()};
At this point, I think I do not understand how this is supposed to be done. As far as I understand, the original intention of this proposal was to have a tool similar to indexing in NumPy, MATLAB, or Fortran, which can handle this task easily.
I've been experimenting with mdspan for a few days, and one thing remains unclear to me: Is it possible to use submdspan to create an mdspan that "views" the original data in reverse order?
For example, consider a span with 9 rows and 10 columns:
This represents the following table:
Is there a way to call the submdspan function to get the same data but with the rows flipped?
I tried to achieve this by passing a negative stride into strided_slice, but it returned incorrect results (with negative extents):
At this point, I think I do not understand how this is supposed to be done. As far as I understand, the original intention of this proposal was to have a tool similar to indexing in NumPy, MATLAB, or Fortran, which can handle this task easily.