dextents not available in std::experimental namespace
dextents is not available in the std::experimental namespace (by default), even though mdspan and other mdspan components are. Instead, dextents can only be found in the std namespace by default.
// does NOT compile
//template <typename T, size_t dimensions = 1>
//using slice0 = stdex::mdspan<T, stdex::dextents<size_t, dimensions>, std::experimental::layout_stride>;
// compiles
template <typename T, size_t dimensions = 1>
using slice1 = stdex::mdspan<T, std::dextents<size_t, dimensions>, std::experimental::layout_stride>;
// compiles
template <typename T, size_t dimensions = 1>
using slice2 = std::mdspan<T, std::dextents<size_t, dimensions>, std::layout_stride>;
One of my colleagues verified today that the problem exists in the headers, not just in the generated godbolt single header. The following code in the example
namespace MDSPAN_IMPL_STANDARD_NAMESPACE {
inline constexpr int foobar = 42;
}
suggests what I think is the problem, namely that extents.hpp doesn't appear to import extents into the std namespace.
Hmm... stdex::mdspan shouldn't compile, we might have a stray using declaration somewhere. All of the stuff merged into the standard should be under std:: or, better yet, Kokkos:: (include <mdspan/mdspan.hpp> for that namespace).
Just ran into this, the header does not have a using for dextents: https://github.com/kokkos/mdspan/blob/260f525ed71669e5dcf2438622d2c433b3e5c281/include/experimental/mdspan#L30-L39