@@ -19,7 +19,11 @@ namespace std {
1919 template<class ElementType, class... Integrals>
2020 requires ((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
2121 explicit mdspan(ElementType* , Integrals...)
22- -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals >...>>; // (3)
22+ -> mdspan<ElementType, dextents<size_t, sizeof...(Integrals)>>; // (3) C++23
23+ template<class ElementType, class... Integrals>
24+ requires ((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
25+ explicit mdspan(ElementType* , Integrals...)
26+ -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals >...>>; // (3) C++26
2327
2428 template<class ElementType, class OtherIndexType, size_t N>
2529 mdspan(ElementType* , span<OtherIndexType, N>)
@@ -105,12 +109,13 @@ int main()
105109 assert(m2[] == *ptr);
106110 // m2 := 0次元配列ビュー
107111 }
108- { // (3) : 要素数リストから型推論
112+ { // (3) : C++23 要素数リストから型推論
109113 std::mdspan m3a{arr, 2, 3};
110114 static_assert(m3a.rank_dynamic() == 2);
111115 assert(m3a.size() == 6);
112116 // m3a := 動的要素数 2x3 の2次元配列ビュー
113-
117+ }
118+ { // (3) : C++26 整数定数要素数リストから型推論
114119 std::mdspan m3b{arr, Int<2>, Int<3>};
115120 static_assert(m3b.rank_dynamic() == 0);
116121 assert(m3b.size() == 6);
@@ -190,3 +195,4 @@ int main()
190195## 参照
191196- [ P0009R18 MDSPAN] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html )
192197- [ P3029R1 Better ` mdspan ` 's CTAD] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3029r1.html )
198+ - C++26から、(3)で静的要素数への推論がサポートされる。
0 commit comments