Closed pauleonix closed 6 months ago
Thank you for reporting this! I agree that this is a bug. The two types need to be the same. mdspan's Mandates clause ([mdspan.mdspan.overview] 2.3) includes "is_same_v<ElementType, typename AccessorPolicy::element_type>
is true
." "Mandates" means "should be ill-formed if violated, e.g., by using a static_assert
."
Would you consider submitting a PR with a fix?
According to the standard draft, cppreference and common sense these need to be the same, but at least when using the single header version I can instantiate e.g.
std::mdspan<float, std::dextents<int, 2>, std::layout_right, std::default_accessor<double>>
orstd::mdspan<float const, std::dextents<int, 2>, std::layout_right, std::default_accessor<float>>
without a compiler error.See https://godbolt.org/z/nx4YE91G3