//********************************************************
// 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 <mdspan>
#include "print2d.hpp"
#include "memacc.hpp"

int main()
{
  // initialize the accessor holding memory of the necessary size:
  std::layout_right::mapping layout{std::extents{4, 3}};
  MemoryAccessor<int> acc{layout.required_span_size()};

  // initialize an mdspan with the accessor:
  std::mdspan mds(acc.dataHandle(), layout, acc);

  // print its initial content:
  print2D(mds);
}

