Multi dimensional std::span.
The aim is to provide a std::span
like interface and performance, but with multi-dimensional access and manipulation.
Any type contiguous memory (C-array, std::vector, std::array) are easily converted to a span_nd:
int array[100];
span_nd<int, 2> twoD(array, 100, {10, 10});
//works like all other containers
std::iota(twoD.begin(), twoD.end(), 0);
//easy access with [] operator
twoD[{8, 8}] = -1;
//you can get cross_section of dimensions:
//fill second row with 2
std::fill(twoD.cross_section(1).begin(), twoD.cross_section(1).end(), 2);