@@ -804,32 +804,36 @@ template<size_t k, class S_k, class IndexType, size_t... Exts>
804804template <class T >
805805constexpr bool is_constant_wrapper = false ;
806806
807- template <auto Value>
808- constexpr bool is_constant_wrapper<std::constant_wrapper<Value>> = true ;
807+ template <auto Value, class Type >
808+ constexpr bool is_constant_wrapper<std::constant_wrapper<Value, Type >> = true ;
809809
810810// [mdspan.sub.slices] 1
811811template <class IndexType , class T >
812- constexpr bool is_canonical_submdspan_index_type =
813- std::is_same_v<T, IndexType> || (
814- is_constant_wrapper<T> &&
815- std::is_same_v<typename T::value_type, IndexType>
816- );
812+ constexpr bool is_canonical_submdspan_index_type () {
813+ if constexpr (is_constant_wrapper<T>) {
814+ using value_type = typename T::value_type;
815+ return std::is_same_v<value_type, IndexType>;
816+ }
817+ else {
818+ return std::is_same_v<T, IndexType>;
819+ }
820+ }
817821
818822// [mdspan.sub.slices] 2
819823template <class IndexType , class Slice >
820824MDSPAN_INLINE_FUNCTION
821825constexpr bool is_canonical_slice_type () {
822- if constexpr (
823- std::is_same_v<Slice, full_extent_t > || // 2.1
824- is_canonical_submdspan_index_type<IndexType, Slice>) // 2.2
825- {
826+ if constexpr (std::is_same_v<Slice, full_extent_t >) { // 2.1
827+ return true ;
828+ }
829+ else if constexpr (is_canonical_submdspan_index_type<IndexType, Slice>()) { // 2.2
826830 return true ;
827831 }
828832 else if constexpr (is_strided_slice<Slice>::value) { // 2.3
829833 if constexpr ( // 2.3.1
830- is_canonical_submdspan_index_type<IndexType, typename Slice::offset_type> &&
831- is_canonical_submdspan_index_type<IndexType, typename Slice::extent_type> &&
832- is_canonical_submdspan_index_type<IndexType, typename Slice::stride_type>)
834+ is_canonical_submdspan_index_type<IndexType, typename Slice::offset_type>() &&
835+ is_canonical_submdspan_index_type<IndexType, typename Slice::extent_type>() &&
836+ is_canonical_submdspan_index_type<IndexType, typename Slice::stride_type>() )
833837 {
834838 if constexpr (
835839 is_constant_wrapper<typename Slice::stride_type> &&
@@ -840,7 +844,7 @@ constexpr bool is_canonical_slice_type() {
840844 return Extent == 0 || Stride > 0 ; // 2.3.2
841845 }
842846 else {
843- return false ;
847+ return true ;
844848 }
845849 }
846850 else {
0 commit comments