[
Example 1: 
Given a rank-3 
mdspan grid3d representing a three-dimensional grid
of regularly spaced points in a rectangular prism,
the function 
zero_surface sets all elements on
the surface of the 3-dimensional shape to zero
.It does so by reusing a function 
zero_2d
that takes a rank-2 
mdspan.
template<class T, class E, class L, class A>
void zero_2d(mdspan<T, E, L, A> a) {
  static_assert(a.rank() == 2);
  for (int i = 0; i < a.extent(0); i++)
    for (int j = 0; j < a.extent(1); j++)
      a[i, j] = 0;
}
template<class T, class E, class L, class A>
void zero_surface(mdspan<T, E, L, A> grid3d) {
  static_assert(grid3d.rank() == 3);
  zero_2d(submdspan(grid3d, 0, full_extent, full_extent));
  zero_2d(submdspan(grid3d, full_extent, 0, full_extent));
  zero_2d(submdspan(grid3d, full_extent, full_extent, 0));
  zero_2d(submdspan(grid3d, grid3d.extent(0) - 1, full_extent, full_extent));
  zero_2d(submdspan(grid3d, full_extent, grid3d.extent(1) - 1, full_extent));
  zero_2d(submdspan(grid3d, full_extent, full_extent, grid3d.extent(2) - 1));
}
 — end example]