Standard library header <mdspan> (C++23)
From cppreference.net
このヘッダは containers ライブラリの一部です。
クラス |
|
|
(C++23)
|
多次元非所有配列ビュー
(クラステンプレート) |
|
(C++23)
|
多次元インデックス空間の記述子(あるランクの)
(クラステンプレート) |
|
(C++23)
|
列優先多次元配列レイアウトマッピングポリシー; 左端の次元がストライド
1
(クラス) |
|
(C++23)
|
行優先多次元配列レイアウトマッピングポリシー; 右端の次元がストライド
1
(クラス) |
|
(C++23)
|
ユーザー定義のストライドを持つレイアウトマッピングポリシー
(クラス) |
|
(C++26)
|
左端の範囲以上になるパディングストライドを持つカラムメジャーレイアウトマッピングポリシー
(クラステンプレート) |
|
(C++26)
|
右端の範囲以上となるパディングストライドを持つ行優先レイアウトマッピングポリシー
(クラステンプレート) |
|
(C++23)
|
mdspan
の要素へのインデックス付きアクセスのための型
(クラステンプレート) |
|
(C++26)
|
オフセット、範囲、ストライドで示される規則的に間隔を置いたインデックスの集合を表すスライス指定子
(クラステンプレート) |
|
(C++26)
|
submdspan_mapping
のオーバーロードの戻り値の型
(クラステンプレート) |
エイリアステンプレート |
|
|
(C++23)
(C++26)
|
すべて動的次元のための便利なエイリアステンプレート
std::extents
(エイリアステンプレート) |
関数 |
|
|
(C++26)
|
既存のエクステントとスライス指定子から新しいエクステントを作成する
(関数テンプレート) |
|
(C++26)
|
既存の
mdspan
の部分集合のビューを返す
(関数テンプレート) |
タグ |
|
|
(C++26)
|
指定されたエクステント内の全インデックス範囲を記述するスライス指定子タグ。
(タグ) |
概要
// すべてフリースタンディング namespace std { // クラステンプレート extents template<class IndexType, size_t... Extents> class extents; // エイリアステンプレート dextents template<class IndexType, size_t Rank> using dextents = /* 説明を参照 */; // エイリアステンプレート dims template<size_t Rank, class IndexType = size_t> using dims = /* 説明を参照 */; // レイアウトマッピング struct layout_left; struct layout_right; struct layout_stride; template<size_t PaddingValue = dynamic_extent> struct layout_left_padded; template<size_t PaddingValue = dynamic_extent> struct layout_right_padded; // クラステンプレート default_accessor template<class ElementType> class default_accessor; // クラステンプレート mdspan template<class ElementType, class Extents, class LayoutPolicy = layout_right, class AccessorPolicy = default_accessor<ElementType>> class mdspan; // submdspan 作成 template<class OffsetType, class LengthType, class StrideType> struct strided_slice; template<class LayoutMapping> struct submdspan_mapping_result; struct full_extent_t { explicit full_extent_t() = default; }; inline constexpr full_extent_t full_extent{}; template<class IndexType, class... Extents, class... SliceSpecifiers> constexpr auto submdspan_extents(const extents<IndexType, Extents...>&, SliceSpecifiers...); // submdspan 関数テンプレート template<class ElementType, class Extents, class LayoutPolicy, class AccessorPolicy, class... SliceSpecifiers> constexpr auto submdspan( const mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>& src, SliceSpecifiers... slices) -> /* 説明を参照 */; template<class T, class IndexType> concept /*index-pair-like*/ = // 説明専用 /*pair-like*/<T> && convertible_to<tuple_element_t<0, T>, IndexType> && convertible_to<tuple_element_t<1, T>, IndexType>; }
クラステンプレート std::mdspan
namespace std { template<class ElementType, class Extents, class LayoutPolicy = layout_right, class AccessorPolicy = default_accessor<ElementType>> class mdspan { public: using extents_type = Extents; using layout_type = LayoutPolicy; using accessor_type = AccessorPolicy; using mapping_type = typename layout_type::template mapping<extents_type>; using element_type = ElementType; using value_type = remove_cv_t<element_type>; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using data_handle_type = typename accessor_type::data_handle_type; using reference = typename accessor_type::リファレンス; static constexpr rank_type rank() noexcept { return extents_type::rank(); } static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); } static constexpr size_t static_extent(rank_type r) noexcept { return extents_type::static_extent(r); } constexpr index_type extent(rank_type r) const noexcept { return extents().extent(r); } // コンストラクタ constexpr mdspan(); constexpr mdspan(const mdspan& rhs) = default; constexpr mdspan(mdspan&& rhs) = default; template<class... OtherIndexTypes> constexpr explicit mdspan(data_handle_type ptr, OtherIndexTypes... exts); template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) mdspan(data_handle_type p, span<OtherIndexType, N> exts); template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) mdspan(data_handle_type p, const array<OtherIndexType, N>& exts); constexpr mdspan(data_handle_type p, const extents_type& ext); constexpr mdspan(data_handle_type p, const mapping_type& m); constexpr mdspan(data_handle_type p, const mapping_type& m, const accessor_type& a); template<class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherAccessorPolicy> constexpr explicit(/* 説明を参照 */) mdspan(const mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessorPolicy>& other); constexpr mdspan& operator=(const mdspan& rhs) = default; constexpr mdspan& operator=(mdspan&& rhs) = default; // メンバー template<class... OtherIndexTypes> constexpr reference operator[](OtherIndexTypes... indices) const; template<class OtherIndexType> constexpr reference operator[](span<OtherIndexType, rank()> indices) const; template<class OtherIndexType> constexpr reference operator[] (注:元のテキストは閉じ括弧のみのため、日本語でも同じ記号を保持します)(const array<OtherIndexType, rank()>& indices) const; constexpr size_type size() const noexcept; constexpr bool empty() const noexcept; friend constexpr void swap(mdspan& x, mdspan& y) noexcept; constexpr const extents_type& extents() const noexcept { return /*map_*/.extents(); } constexpr const data_handle_type& data_handle() const noexcept { return /*ptr_*/; } constexpr const mapping_type& mapping() const noexcept { return /*map_*/; } constexpr const accessor_type& accessor() const noexcept { return /*acc_*/; } static constexpr bool is_always_unique() { return mapping_type::is_always_unique(); } static constexpr bool is_always_exhaustive() { return mapping_type::is_always_exhaustive(); } static constexpr bool is_always_strided() { return mapping_type::is_always_strided(); } constexpr bool is_unique() const { return /*map_*/.is_unique(); } constexpr bool is_exhaustive() const { return /*map_*/.is_exhaustive(); } constexpr bool is_strided() const { return /*map_*/.is_strided(); } constexpr index_type stride(rank_type r) const { return /*map_*/.stride(r); } private: accessor_type /*acc_*/; // 説明専用 mapping_type /*map_*/; // 説明専用 data_handle_type /*ptr_*/; // 説明専用 }; template<class CArray> requires(is_array_v<CArray> && rank_v<CArray> == 1) mdspan(CArray&) -> mdspan<remove_all_extents_t<CArray>, extents<size_t, extent_v<CArray, 0>>>; template<class Pointer> requires(is_pointer_v<remove_reference_t<Pointer>>) mdspan(Pointer&&) -> mdspan<remove_pointer_t<remove_reference_t<Pointer>>, extents<size_t>>; template<class ElementType, class... 積分> requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0) explicit mdspan(ElementType*, Integrals...) -> mdspan<ElementType, extents<size_t, /*maybe-static-ext*/<Integrals>...>>; template<class ElementType, class OtherIndexType, size_t N> mdspan(ElementType*, span<OtherIndexType, N>) -> mdspan<ElementType, dextents<size_t, N>>; template<class ElementType, class OtherIndexType, size_t N> mdspan(ElementType*, const array<OtherIndexType, N>&) -> mdspan<ElementType, dextents<size_t, N>>; template<class ElementType, class IndexType, size_t... ExtentsPack> mdspan(ElementType*, const extents<IndexType, ExtentsPack...>&) -> mdspan<ElementType, extents<IndexType, ExtentsPack...>>; template<class ElementType, class MappingType> mdspan(ElementType*, const MappingType&) -> mdspan<ElementType, typename MappingType::extents_type, typename MappingType::layout_type>; template<class MappingType, class AccessorType> mdspan(const typename AccessorType::data_handle_type&, const MappingType&, const AccessorType&) -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, typename MappingType::layout_type, AccessorType>; }
クラステンプレート std::extents
namespace std { template<class IndexType, size_t... Extents> class extents { public: using index_type = IndexType; using size_type = make_unsigned_t<index_type>; using rank_type = size_t; // 多次元インデックス空間の観測機能 static constexpr rank_type rank() noexcept { return sizeof...(Extents); } static constexpr rank_type rank_dynamic() noexcept { return /*dynamic-index*/(rank()); } static constexpr size_t static_extent(rank_type) noexcept; constexpr index_type extent(rank_type) const noexcept; // コンストラクタ constexpr extents() noexcept = default; template<class OtherIndexType, size_t... OtherExtents> constexpr explicit(/* 説明を参照 */) extents(const extents<OtherIndexType, OtherExtents...>&) noexcept; template<class... OtherIndexTypes> constexpr explicit extents(OtherIndexTypes...) noexcept; template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) extents(span<OtherIndexType, N>) noexcept; template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) extents(const array<OtherIndexType, N>&) noexcept; // 比較演算子 template<class OtherIndexType, size_t... OtherExtents> friend constexpr bool operator==( const extents&, const extents<OtherIndexType, OtherExtents...>&) noexcept; // 説明専用ヘルパー constexpr size_t /*fwd-prod-of-extents*/(rank_type) const noexcept; // 説明専用 constexpr size_t /*rev-prod-of-extents*/(rank_type) const noexcept; // 説明専用 template<class OtherIndexType> static constexpr auto /*index-cast*/(OtherIndexType&&) noexcept; // 説明専用 private: static constexpr rank_type /*dynamic-index*/(rank_type) noexcept; // 説明専用 static constexpr rank_type /*dynamic-index-inv*/( rank_type) noexcept; // 説明専用 array<index_type, rank_dynamic()> /*dynamic-extents*/{}; // 説明専用 }; template<class... Integrals> explicit extents(Integrals...)->/* 説明を参照 */; }
レイアウトマッピングポリシー
namespace std { struct layout_left { template<class Extents> class mapping; }; struct layout_right { template<class Extents> class mapping; }; struct layout_stride { template<class Extents> class mapping; }; template<size_t PaddingValue> struct layout_left_padded { template<class Extents> class mapping; }; template<size_t PaddingValue> struct layout_right_padded { template<class Extents> class mapping; }; }
クラステンプレート std::layout_left::mapping
namespace std { template<class Extents> class layout_left::mapping { public: using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_left; // コンストラクタ constexpr mapping() noexcept = default; constexpr mapping(const mapping&) noexcept = default; constexpr mapping(const extents_type&) noexcept; template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const mapping<OtherExtents>&) noexcept; template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_right::mapping<OtherExtents>&) noexcept; template<class LayoutLeftPaddedMapping> constexpr explicit( !is_convertible_v<typename LayoutLeftPaddedMapping::extents_type, extents_type>) mapping(const LayoutLeftPaddedMapping&) noexcept; template<class OtherExtents> constexpr explicit(extents_type::rank() > 0) mapping(const layout_stride::mapping<OtherExtents>&); constexpr mapping& operator=(const mapping&) noexcept = default; // オブザーバ constexpr const extents_type& extents() const noexcept { return /*extents_*/; } constexpr index_type required_span_size() const noexcept; template<class... Indices> constexpr index_type operator()(Indices...) const noexcept; static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept { return true; } static constexpr bool is_always_strided() noexcept { return true; } static constexpr bool is_unique() noexcept { return true; } static constexpr bool is_exhaustive() noexcept { return true; } static constexpr bool is_strided() noexcept { return true; } constexpr index_type stride(rank_type) const noexcept; template<class OtherExtents> friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept; private: extents_type /*extents_*/{}; // 説明専用 // submdspanマッピング特殊化 template<class... SliceSpecifiers> constexpr auto /*submdspan-mapping-impl*/(SliceSpecifiers...) const // 説明専用 -> /* 説明を参照 */; template<class... SliceSpecifiers> friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) { return src./*submdspan-mapping-impl*/(slices...); } }; }
クラステンプレート std::layout_right::mapping
namespace std { template<class Extents> class layout_right::マッピング { public: using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_right; // コンストラクタ constexpr mapping() noexcept = default; constexpr mapping(const mapping&) noexcept = default; constexpr mapping(const extents_type&) noexcept; template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const mapping<OtherExtents>&) noexcept; template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_left::マッピング<OtherExtents>&) noexcept; template<class LayoutRightPaddedMapping> constexpr explicit( !is_convertible_v<typename LayoutRightPaddedMapping::extents_type, extents_type>) mapping(const LayoutRightPaddedMapping&) noexcept; template<class OtherExtents> constexpr explicit(extents_type::rank() > 0) mapping(const layout_stride::マッピング<OtherExtents>&) noexcept; constexpr mapping& operator=(const mapping&) noexcept = default; // オブザーバー constexpr const extents_type& extents() const noexcept { return /*extents_*/; } constexpr index_type required_span_size() const noexcept; template<class... インデックス> constexpr index_type operator()(Indices...) const noexcept; static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept { return true; } static constexpr bool is_always_strided() noexcept { return true; } static constexpr bool is_unique() noexcept { return true; } static constexpr bool is_exhaustive() noexcept { return true; } static constexpr bool is_strided() noexcept { return true; } constexpr index_type stride(rank_type) const noexcept; template<class OtherExtents> friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept; private: extents_type /*extents_*/{}; // 説明専用 // submdspan マッピング特殊化 template<class... SliceSpecifiers> constexpr auto /*submdspan-mapping-impl*/(SliceSpecifiers...) const // 説明専用 -> /* 詳細は説明を参照 */; template<class... SliceSpecifiers> friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) { return src./*submdspan-mapping-impl*/(slices...); } }; }
クラステンプレート std::layout_stride::mapping
namespace std { template<class Extents> class layout_stride::mapping { public: using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_stride; private: static constexpr rank_type /*rank_*/ = extents_type::rank(); // 説明のみ public: // コンストラクタ constexpr mapping() noexcept; constexpr mapping(const mapping&) noexcept = default; template<class OtherIndexType> constexpr mapping(const extents_type&, span<OtherIndexType, /*rank_*/>) noexcept; template<class OtherIndexType> constexpr mapping(const extents_type&, const array<OtherIndexType, /*rank_*/>&) noexcept; template<class StridedLayoutMapping> constexpr explicit(/* 説明を参照 */) mapping(const StridedLayoutMapping&) noexcept; constexpr mapping& operator=(const mapping&) noexcept = default; // オブザーバ constexpr const extents_type& extents() const noexcept { return /*extents_*/; } constexpr array<index_type, /*rank_*/> strides() const noexcept { return /*strides_*/; } constexpr index_type required_span_size() const noexcept; template<class... Indices> constexpr index_type operator()(Indices...) const noexcept; static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept { return false; } static constexpr bool is_always_strided() noexcept { return true; } static constexpr bool is_unique() noexcept { return true; } constexpr bool is_exhaustive() const noexcept; static constexpr bool is_strided() noexcept { return true; } constexpr index_type stride(rank_type i) const noexcept { return /*strides_*/[i]; } template<class OtherMapping> friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept; private: extents_type /*extents_*/{}; // 説明のみ array<index_type, /*rank_*/> /*strides_*/{}; // 説明のみ // submdspan マッピング特殊化 template<class... SliceSpecifiers> constexpr auto /*submdspan-mapping-impl*/(SliceSpecifiers...) const // 説明のみ -> /* 説明を参照 */; template<class... SliceSpecifiers> friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) { return src./*submdspan-mapping-impl*/(slices...); } }; }
クラステンプレート std::layout_left_padded::mapping
namespace std { template<size_t PaddingValue> template<class Extents> class layout_left_padded<PaddingValue>::マッピング { public: static constexpr size_t padding_value = PaddingValue; using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_left_padded<PaddingValue>; private: static constexpr size_t /*rank_*/ = extents_type::rank(); // 説明専用 static constexpr size_t /*first-static-extent*/ = // 説明専用 extents_type::static_extent(0); // 説明専用メンバー static constexpr size_t /*static-padding-stride*/ = /* 説明を参照 */; // 説明専用 public: // コンストラクタ constexpr mapping() noexcept : mapping(extents_type{}) { } constexpr mapping(const mapping&) noexcept = default; constexpr mapping(const extents_type&); template<class OtherIndexType> constexpr mapping(const extents_type&, OtherIndexType); template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_left::マッピング<OtherExtents>&); template<class OtherExtents> constexpr explicit(extents_type::rank() > 0) mapping(const layout_stride::マッピング<OtherExtents>&); template<class LayoutLeftPaddedMapping> constexpr explicit(/* 説明を参照 */) mapping(const LayoutLeftPaddedMapping&); template<class LayoutRightPaddedMapping> constexpr explicit(/* 説明を参照 */) mapping(const LayoutRightPaddedMapping&) noexcept; constexpr mapping& operator=(const mapping&) noexcept = default; // オブザーバー constexpr const extents_type& extents() const noexcept { return /*extents_*/; } constexpr array<index_type, rank_> strides() const noexcept; constexpr index_type required_span_size() const noexcept; template<class... インデックス> constexpr index_type operator()(Indices...) const noexcept; static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept; static constexpr bool is_always_strided() noexcept { return true; } static constexpr bool is_unique() noexcept { return true; } constexpr bool is_exhaustive() const noexcept; static constexpr bool is_strided() noexcept { return true; } constexpr index_type stride(rank_type) const noexcept; template<class LayoutLeftPaddedMapping> friend constexpr bool operator==(const mapping&, const LayoutLeftPaddedMapping&) noexcept; private: // 説明専用メンバ index_type /*ストライド1*/ = /*static-padding-stride*/; // 説明専用 extents_type /*extents_*/{}; // 説明専用 // submdspan マッピング特殊化 template<class... SliceSpecifiers> constexpr auto /*submdspan-mapping-impl*/(SliceSpecifiers...) const // 説明専用 -> /* 説明を参照 */; template<class... SliceSpecifiers> friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) { return src./*submdspan-mapping-impl*/(slices...); } }; }
クラステンプレート std::layout_right_padded::mapping
namespace std { template<size_t PaddingValue> template<class Extents> class layout_right_padded<PaddingValue>::マッピング { public: static constexpr size_t padding_value = PaddingValue; using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_right_padded<PaddingValue>; private: static constexpr size_t /*rank_*/ = extents_type::rank(); // 説明専用 static constexpr size_t /*last-static-extent*/ = // 説明専用 extents_type::static_extent(/*rank_*/ - 1); // 説明専用メンバ static constexpr size_t /*static-padding-stride*/ = /* 説明を参照 */; // 説明専用 public: // コンストラクタ constexpr mapping() noexcept : mapping(extents_type{}) { } constexpr mapping(const mapping&) noexcept = default; constexpr mapping(const extents_type&); template<class OtherIndexType> constexpr mapping(const extents_type&, OtherIndexType); template<class OtherExtents> constexpr explicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_right::マッピング<OtherExtents>&); template<class OtherExtents> constexpr explicit(rank_ > 0) mapping(const layout_stride::マッピング<OtherExtents>&); template<class LayoutRightPaddedMapping> constexpr explicit(/* 説明を参照 */) mapping(const LayoutRightPaddedMapping&); template<class LayoutLeftPaddedMapping> constexpr explicit(/* 説明を参照 */) mapping(const LayoutLeftPaddedMapping&) noexcept; constexpr mapping& operator=(const mapping&) noexcept = default; // オブザーバー constexpr const extents_type& extents() const noexcept { return extents_; } constexpr array<index_type, rank_> strides() const noexcept; constexpr index_type required_span_size() const noexcept; template<class... インデックス> constexpr index_type operator()(Indices...) const noexcept; static constexpr bool is_always_unique() noexcept { return true; } static constexpr bool is_always_exhaustive() noexcept; static constexpr bool is_always_strided() noexcept { return true; } static constexpr bool is_unique() noexcept { return true; } constexpr bool is_exhaustive() const noexcept; static constexpr bool is_strided() noexcept { return true; } constexpr index_type stride(rank_type) const noexcept; template<class LayoutRightPaddedMapping> friend constexpr bool operator==(const mapping&, const LayoutRightPaddedMapping&) noexcept; private: // 説明専用メンバ index_type /*ストライド-rm2*/ = /*static-padding-stride*/; // 説明専用 extents_type /*extents_*/{}; // 説明専用 // submdspan マッピング特殊化 template<class... SliceSpecifiers> constexpr auto /*submdspan-mapping-impl*/(SliceSpecifiers...) const // 説明専用 -> /* 詳細は説明を参照 */; template<class... SliceSpecifiers> friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) { return src./*submdspan-mapping-impl*/(slices...); } }; }
説明専用ヘルパー
template<class T> constexpr bool /*is-extents*/ = false; // 説明専用 template<class IndexType, size_t... Args> constexpr bool /*is-extents*/<extents<IndexType, Args...>> = true; // 説明専用 template<class M> concept /*layout-mapping-alike*/ = requires { // 説明専用 requires /*is-extents*/<typename M::extents_type>; { M::is_always_strided() } -> same_as<bool>; { M::is_always_exhaustive() } -> same_as<bool>; { M::is_always_unique() } -> same_as<bool>; bool_constant<M::is_always_strided()>::value; bool_constant<M::is_always_exhaustive()>::value; bool_constant<M::is_always_unique()>::value; }; template<class T> constexpr T /*de-ice*/(T val) { return val; } template</*integral-constant-like*/ T> constexpr auto /*de-ice*/(T) { return T::value; } template<class IndexType, size_t k, class... SliceSpecifiers> constexpr IndexType /*first_*/(SliceSpecifiers... slices); template<size_t k, class Extents, class... SliceSpecifiers> constexpr auto /*last_*/(const Extents& src, SliceSpecifiers... slices); template<class IndexType, size_t N, class... SliceSpecifiers> constexpr array<IndexType, sizeof...(SliceSpecifiers)> /*src-indices*/(const array<IndexType, N>& indices, SliceSpecifiers... slices);
クラステンプレート std::default_accessor
namespace std { template<class ElementType> struct default_accessor { using offset_policy = default_accessor; using element_type = ElementType; using reference = ElementType&; using data_handle_type = ElementType*; constexpr default_accessor() noexcept = default; template<class OtherElementType> constexpr default_accessor(default_accessor<OtherElementType>) noexcept; constexpr reference access(data_handle_type p, size_t i) const noexcept; constexpr data_handle_type offset(data_handle_type p, size_t i) const noexcept; }; }
クラステンプレート std::strided_slice
namespace std { template<class OffsetType, class ExtentType, class StrideType> struct strided_slice { using offset_type = OffsetType; using extent_type = ExtentType; using stride_type = StrideType; [[no_unique_address]] offset_type offset{}; [[no_unique_address]] extent_type extent{}; [[no_unique_address]] stride_type stride{}; }; }
クラステンプレート std::submdspan_mapping_result
namespace std { template<class LayoutMapping> struct submdspan_mapping_result { [[no_unique_address]] LayoutMapping mapping = LayoutMapping(); size_t offset{}; }; }
参考文献
- C++23規格 (ISO/IEC 14882:2024):
-
-
24.7.4 ヘッダ
<mdspan>概要 [mdspan.syn]
-
24.7.4 ヘッダ