Namespaces
Variants
Actions

Standard library header <mdspan> (C++23)

From cppreference.com
< cpp‎ | header
 
 
Standard library headers
 

This header is part of the containers library.

Contents

Classes

(C++23)
a multi-dimensional non-owning array view
(class template)[edit]
(C++23)
a descriptor of a multidimensional index space of some rank
(class template)[edit]
column-major multidimensional array layout mapping policy; leftmost extent has stride 1
(class)[edit]
row-major multidimensional array layout mapping policy; rightmost extent has stride 1
(class)[edit]
a layout mapping policy with user-defined strides
(class)[edit]
column-major layout mapping policy with padding stride that can be greater than or equal to the leftmost extent
(class template)[edit]
row-major layout mapping policy with padding stride that can be greater than or equal to the rightmost extent
(class template)[edit]
a type for indexed access to elements of mdspan
(class template)[edit]
a slice specifier representing a set of regularly spaced indices as indicated by an offset, an extent, and a stride
(class template)[edit]
a return type of the overloads of submdspan_mapping
(class template)[edit]

Alias templates

(C++23)(C++26)
convenience alias template for an all-dynamic std::extents
(alias template)[edit]

Functions

creates new extents from the existing extents and slice specifiers
(function template)[edit]
(C++26)
returns a view of a subset of an existing mdspan
(function template)[edit]

Tags

a slice specifier tag describing full range of indices in the specified extent.
(tag)[edit]

[edit]Synopsis

// all freestandingnamespace std {// class template extentstemplate<class IndexType, size_t... Extents>class extents;   // alias template dextentstemplate<class IndexType, size_t Rank>using dextents =/* see description */;   // alias template dimstemplate<size_t Rank, class IndexType = size_t>using dims =/* see description */;   // layout mappingstruct 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;   // class template default_accessortemplate<class ElementType>class default_accessor;   // class template mdspantemplate<class ElementType, class Extents, class LayoutPolicy = layout_right, class AccessorPolicy = default_accessor<ElementType>>class mdspan;   // submdspan creationtemplate<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;};inlineconstexpr full_extent_t full_extent{};   template<class IndexType, class... Extents, class... SliceSpecifiers>constexprauto submdspan_extents(const extents<IndexType, Extents...>&, SliceSpecifiers...);   // submdspan function templatetemplate<class ElementType, class Extents, class LayoutPolicy, class AccessorPolicy, class... SliceSpecifiers>constexprauto submdspan(const mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>& src, SliceSpecifiers... slices)->/* see description */;   template<class T, class IndexType> concept /*index-pair-like*/=// exposition only/*pair-like*/<T>&& convertible_to<tuple_element_t<0, T>, IndexType>&& convertible_to<tuple_element_t<1, T>, IndexType>;}

[edit]Class template 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::reference;   staticconstexpr rank_type rank()noexcept{return extents_type::rank();}staticconstexpr rank_type rank_dynamic()noexcept{return extents_type::rank_dynamic();}staticconstexpr size_t static_extent(rank_type r)noexcept{return extents_type::static_extent(r);}constexpr index_type extent(rank_type r)constnoexcept{return extents().extent(r);}   // constructorsconstexpr mdspan();constexpr mdspan(const mdspan& rhs)=default;constexpr mdspan(mdspan&& rhs)=default;   template<class... OtherIndexTypes>constexprexplicit mdspan(data_handle_type ptr, OtherIndexTypes... exts);template<class OtherIndexType, size_t N>constexprexplicit(N != rank_dynamic()) mdspan(data_handle_type p, span<OtherIndexType, N> exts);template<class OtherIndexType, size_t N>constexprexplicit(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>constexprexplicit(/* see description */) mdspan(const mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessorPolicy>& other);   constexpr mdspan& operator=(const mdspan& rhs)=default;constexpr mdspan& operator=(mdspan&& rhs)=default;   // memberstemplate<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()constnoexcept;constexprbool empty()constnoexcept;   friendconstexprvoid swap(mdspan& x, mdspan& y)noexcept;   constexprconst extents_type& extents()constnoexcept{return/*map_*/.extents();}constexprconst data_handle_type& data_handle()constnoexcept{return/*ptr_*/;}constexprconst mapping_type& mapping()constnoexcept{return/*map_*/;}constexprconst accessor_type& accessor()constnoexcept{return/*acc_*/;}   staticconstexprbool is_always_unique(){return mapping_type::is_always_unique();}staticconstexprbool is_always_exhaustive(){return mapping_type::is_always_exhaustive();}staticconstexprbool is_always_strided(){return mapping_type::is_always_strided();}   constexprbool is_unique()const{return/*map_*/.is_unique();}constexprbool is_exhaustive()const{return/*map_*/.is_exhaustive();}constexprbool is_strided()const{return/*map_*/.is_strided();}constexpr index_type stride(rank_type r)const{return/*map_*/.stride(r);}   private: accessor_type /*acc_*/;// exposition only mapping_type /*map_*/;// exposition only data_handle_type /*ptr_*/;// exposition only};   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... Integrals> 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(consttypename AccessorType::data_handle_type&, const MappingType&, const AccessorType&)-> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, typename MappingType::layout_type, AccessorType>;}

[edit]Class template 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;   // observers of the multidimensional index spacestaticconstexpr rank_type rank()noexcept{return sizeof...(Extents);}staticconstexpr rank_type rank_dynamic()noexcept{return/*dynamic-index*/(rank());}staticconstexpr size_t static_extent(rank_type)noexcept;constexpr index_type extent(rank_type)constnoexcept;   // constructorsconstexpr extents()noexcept=default;   template<class OtherIndexType, size_t... OtherExtents>constexprexplicit(/* see description */) extents(const extents<OtherIndexType, OtherExtents...>&)noexcept;template<class... OtherIndexTypes>constexprexplicit extents(OtherIndexTypes...)noexcept;template<class OtherIndexType, size_t N>constexprexplicit(N != rank_dynamic()) extents(span<OtherIndexType, N>)noexcept;template<class OtherIndexType, size_t N>constexprexplicit(N != rank_dynamic()) extents(const array<OtherIndexType, N>&)noexcept;   // comparison operatorstemplate<class OtherIndexType, size_t... OtherExtents>friendconstexprbool operator==(const extents&, const extents<OtherIndexType, OtherExtents...>&)noexcept;   // exposition only helpersconstexpr size_t /*fwd-prod-of-extents*/(rank_type)constnoexcept;// exposition onlyconstexpr size_t /*rev-prod-of-extents*/(rank_type)constnoexcept;// exposition onlytemplate<class OtherIndexType>staticconstexprauto/*index-cast*/(OtherIndexType&&)noexcept;// exposition only   private:staticconstexpr rank_type /*dynamic-index*/(rank_type)noexcept;// exposition onlystaticconstexpr rank_type /*dynamic-index-inv*/( rank_type)noexcept;// exposition only array<index_type, rank_dynamic()>/*dynamic-extents*/{};// exposition only};   template<class... Integrals>explicit extents(Integrals...)->/* see description */;}

[edit]Layout mapping policies

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;};}

[edit]Class template 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;   // constructorsconstexpr mapping()noexcept=default;constexpr mapping(const mapping&)noexcept=default;constexpr mapping(const extents_type&)noexcept;template<class OtherExtents>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const mapping<OtherExtents>&)noexcept;template<class OtherExtents>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_right::mapping<OtherExtents>&)noexcept;template<class LayoutLeftPaddedMapping>constexprexplicit(!is_convertible_v<typename LayoutLeftPaddedMapping::extents_type, extents_type>) mapping(const LayoutLeftPaddedMapping&)noexcept;template<class OtherExtents>constexprexplicit(extents_type::rank()>0) mapping(const layout_stride::mapping<OtherExtents>&);   constexpr mapping& operator=(const mapping&)noexcept=default;   // observersconstexprconst extents_type& extents()constnoexcept{return/*extents_*/;}   constexpr index_type required_span_size()constnoexcept;   template<class... Indices>constexpr index_type operator()(Indices...)constnoexcept;   staticconstexprbool is_always_unique()noexcept{returntrue;}staticconstexprbool is_always_exhaustive()noexcept{returntrue;}staticconstexprbool is_always_strided()noexcept{returntrue;}   staticconstexprbool is_unique()noexcept{returntrue;}staticconstexprbool is_exhaustive()noexcept{returntrue;}staticconstexprbool is_strided()noexcept{returntrue;}   constexpr index_type stride(rank_type)constnoexcept;   template<class OtherExtents>friendconstexprbool operator==(const mapping&, const mapping<OtherExtents>&)noexcept;   private: extents_type /*extents_*/{};// exposition only   // submdspan mapping specializationtemplate<class... SliceSpecifiers>constexprauto/*submdspan-mapping-impl*/(SliceSpecifiers...)const// exposition only->/* see description */;   template<class... SliceSpecifiers>friendconstexprauto submdspan_mapping(const mapping& src, SliceSpecifiers... slices){return src./*submdspan-mapping-impl*/(slices...);}};}

[edit]Class template std::layout_right::mapping

namespace std {template<class Extents>class layout_right::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_right;   // constructorsconstexpr mapping()noexcept=default;constexpr mapping(const mapping&)noexcept=default;constexpr mapping(const extents_type&)noexcept;template<class OtherExtents>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const mapping<OtherExtents>&)noexcept;template<class OtherExtents>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_left::mapping<OtherExtents>&)noexcept;template<class LayoutRightPaddedMapping>constexprexplicit(!is_convertible_v<typename LayoutRightPaddedMapping::extents_type, extents_type>) mapping(const LayoutRightPaddedMapping&)noexcept;template<class OtherExtents>constexprexplicit(extents_type::rank()>0) mapping(const layout_stride::mapping<OtherExtents>&)noexcept;   constexpr mapping& operator=(const mapping&)noexcept=default;   // observersconstexprconst extents_type& extents()constnoexcept{return/*extents_*/;}   constexpr index_type required_span_size()constnoexcept;   template<class... Indices>constexpr index_type operator()(Indices...)constnoexcept;   staticconstexprbool is_always_unique()noexcept{returntrue;}staticconstexprbool is_always_exhaustive()noexcept{returntrue;}staticconstexprbool is_always_strided()noexcept{returntrue;}   staticconstexprbool is_unique()noexcept{returntrue;}staticconstexprbool is_exhaustive()noexcept{returntrue;}staticconstexprbool is_strided()noexcept{returntrue;}   constexpr index_type stride(rank_type)constnoexcept;   template<class OtherExtents>friendconstexprbool operator==(const mapping&, const mapping<OtherExtents>&)noexcept;   private: extents_type /*extents_*/{};// exposition only   // submdspan mapping specializationtemplate<class... SliceSpecifiers>constexprauto/*submdspan-mapping-impl*/(SliceSpecifiers...)const// exposition only->/* see description */;   template<class... SliceSpecifiers>friendconstexprauto submdspan_mapping(const mapping& src, SliceSpecifiers... slices){return src./*submdspan-mapping-impl*/(slices...);}};}

[edit]Class template 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:staticconstexpr rank_type /*rank_*/= extents_type::rank();// exposition only   public:// constructorsconstexpr 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>constexprexplicit(/* see description */) mapping(const StridedLayoutMapping&)noexcept;   constexpr mapping& operator=(const mapping&)noexcept=default;   // observersconstexprconst extents_type& extents()constnoexcept{return/*extents_*/;}constexpr array<index_type, /*rank_*/> strides()constnoexcept{return/*strides_*/;}   constexpr index_type required_span_size()constnoexcept;   template<class... Indices>constexpr index_type operator()(Indices...)constnoexcept;   staticconstexprbool is_always_unique()noexcept{returntrue;}staticconstexprbool is_always_exhaustive()noexcept{returnfalse;}staticconstexprbool is_always_strided()noexcept{returntrue;}   staticconstexprbool is_unique()noexcept{returntrue;}constexprbool is_exhaustive()constnoexcept;staticconstexprbool is_strided()noexcept{returntrue;}   constexpr index_type stride(rank_type i)constnoexcept{return/*strides_*/[i];}   template<class OtherMapping>friendconstexprbool operator==(const mapping&, const OtherMapping&)noexcept;   private: extents_type /*extents_*/{};// exposition only array<index_type, /*rank_*/>/*strides_*/{};// exposition only   // submdspan mapping specializationtemplate<class... SliceSpecifiers>constexprauto/*submdspan-mapping-impl*/(SliceSpecifiers...)const// exposition only->/* see description */;   template<class... SliceSpecifiers>friendconstexprauto submdspan_mapping(const mapping& src, SliceSpecifiers... slices){return src./*submdspan-mapping-impl*/(slices...);}};}

[edit]Class template std::layout_left_padded::mapping

namespace std {template<size_t PaddingValue>template<class Extents>class layout_left_padded<PaddingValue>::mapping{public:staticconstexpr 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:staticconstexpr size_t /*rank_*/= extents_type::rank();// exposition onlystaticconstexpr size_t /*first-static-extent*/=// exposition only extents_type::static_extent(0);   // exposition only membersstaticconstexpr size_t /*static-padding-stride*/=/* see description */;// exposition only   public:// constructorsconstexpr 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>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_left::mapping<OtherExtents>&);template<class OtherExtents>constexprexplicit(extents_type::rank()>0) mapping(const layout_stride::mapping<OtherExtents>&);template<class LayoutLeftPaddedMapping>constexprexplicit(/* see description */) mapping(const LayoutLeftPaddedMapping&);template<class LayoutRightPaddedMapping>constexprexplicit(/* see description */) mapping(const LayoutRightPaddedMapping&)noexcept;   constexpr mapping& operator=(const mapping&)noexcept=default;   // observersconstexprconst extents_type& extents()constnoexcept{return/*extents_*/;}constexpr array<index_type, rank_> strides()constnoexcept;   constexpr index_type required_span_size()constnoexcept;template<class... Indices>constexpr index_type operator()(Indices...)constnoexcept;   staticconstexprbool is_always_unique()noexcept{returntrue;}staticconstexprbool is_always_exhaustive()noexcept;staticconstexprbool is_always_strided()noexcept{returntrue;}   staticconstexprbool is_unique()noexcept{returntrue;}constexprbool is_exhaustive()constnoexcept;staticconstexprbool is_strided()noexcept{returntrue;}   constexpr index_type stride(rank_type)constnoexcept;   template<class LayoutLeftPaddedMapping>friendconstexprbool operator==(const mapping&, const LayoutLeftPaddedMapping&)noexcept;   private:// exposition only members index_type /*stride-1*/=/*static-padding-stride*/;// exposition only extents_type /*extents_*/{};// exposition only// submdspan mapping specializationtemplate<class... SliceSpecifiers>constexprauto/*submdspan-mapping-impl*/(SliceSpecifiers...)const// exposition only->/* see description */;   template<class... SliceSpecifiers>friendconstexprauto submdspan_mapping(const mapping& src, SliceSpecifiers... slices){return src./*submdspan-mapping-impl*/(slices...);}};}

[edit]Class template std::layout_right_padded::mapping

namespace std {template<size_t PaddingValue>template<class Extents>class layout_right_padded<PaddingValue>::mapping{public:staticconstexpr 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:staticconstexpr size_t /*rank_*/= extents_type::rank();// exposition onlystaticconstexpr size_t /*last-static-extent*/=// exposition only extents_type::static_extent(/*rank_*/-1);   // exposition only membersstaticconstexpr size_t /*static-padding-stride*/=/* see description */;// exposition only   public:// constructorsconstexpr 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>constexprexplicit(!is_convertible_v<OtherExtents, extents_type>) mapping(const layout_right::mapping<OtherExtents>&);template<class OtherExtents>constexprexplicit(rank_ >0) mapping(const layout_stride::mapping<OtherExtents>&);template<class LayoutRightPaddedMapping>constexprexplicit(/* see description */) mapping(const LayoutRightPaddedMapping&);template<class LayoutLeftPaddedMapping>constexprexplicit(/* see description */) mapping(const LayoutLeftPaddedMapping&)noexcept;   constexpr mapping& operator=(const mapping&)noexcept=default;   // observersconstexprconst extents_type& extents()constnoexcept{return extents_;}constexpr array<index_type, rank_> strides()constnoexcept;   constexpr index_type required_span_size()constnoexcept;   template<class... Indices>constexpr index_type operator()(Indices...)constnoexcept;   staticconstexprbool is_always_unique()noexcept{returntrue;}staticconstexprbool is_always_exhaustive()noexcept;staticconstexprbool is_always_strided()noexcept{returntrue;}   staticconstexprbool is_unique()noexcept{returntrue;}constexprbool is_exhaustive()constnoexcept;staticconstexprbool is_strided()noexcept{returntrue;}   constexpr index_type stride(rank_type)constnoexcept;   template<class LayoutRightPaddedMapping>friendconstexprbool operator==(const mapping&, const LayoutRightPaddedMapping&)noexcept;   private:// exposition only members index_type /*stride-rm2*/=/*static-padding-stride*/;// exposition only extents_type /*extents_*/{};// exposition only   // submdspan mapping specializationtemplate<class... SliceSpecifiers>constexprauto/*submdspan-mapping-impl*/(SliceSpecifiers...)const// exposition only->/* see description */;   template<class... SliceSpecifiers>friendconstexprauto submdspan_mapping(const mapping& src, SliceSpecifiers... slices){return src./*submdspan-mapping-impl*/(slices...);}};}

[edit]Exposition-only helpers

template<class T>constexprbool/*is-extents*/=false;// exposition onlytemplate<class IndexType, size_t... Args>constexprbool/*is-extents*/<extents<IndexType, Args...>>=true;// exposition only;   template<class M> concept /*layout-mapping-alike*/= requires {// exposition only 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>constexprauto/*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>constexprauto/*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);

[edit]Class template 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)constnoexcept;constexpr data_handle_type offset(data_handle_type p, size_t i)constnoexcept;};}

[edit]Class template 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{};};}

[edit]Class template std::submdspan_mapping_result

namespace std {template<class LayoutMapping>struct submdspan_mapping_result {[[no_unique_address]] LayoutMapping mapping = LayoutMapping(); size_t offset{};};}

[edit]References

  • C++23 standard (ISO/IEC 14882:2024):
  • 24.7.4 Header <mdspan> synopsis [mdspan.syn]
close