The following code example is taken from the book
C++23 - The Complete Guide
by Nicolai M. Josuttis,
Leanpub, 2026
The code is licensed under a
Creative Commons Attribution 4.0 International License.
// raw code
#include <print>
void print2D(const auto& mds)
{
std::print("mdspan of {} rows:\n ", mds.extent(0));
for (std::size_t i=0; i != mds.extent(0); i++) {
for (std::size_t j=0; j != mds.extent(1); j++) {
std::print("{} ", mds[i, j]);
}
std::print("\n ");
}
std::print("\n");
}