//********************************************************
// The following code example is taken from the book
//  C++23 - The Complete Guide
//  by Nicolai M. Josuttis (www.josuttis.com)
//  https://www.cppstd23.com
//
// The code is licensed under a
//  Creative Commons Attribution 4.0 International License
//  https://creativecommons.org/licenses/by/4.0/
//********************************************************


#include <print>

void print3D(const auto& mds)
{
  std::print("3D mdspan ({}*{}*{}):\n", mds.extent(0), mds.extent(1),
                                        mds.extent(2));  
  for(std::size_t i = 0; i < mds.extent(0); ++i) {
    std::print("  ");
    for(std::size_t j = 0; j < mds.extent(1); ++j) {
      for(std::size_t k = 0; k < mds.extent(2); ++k) {
        std::print("{} ", mds[i, j, k]);
      }
      std::print("\n  ");
    }
    std::print("\n");
  } 
}

