[mdspan.extents.overview] (original) (raw)
23 Containers library [containers]
23.7 Views [views]
23.7.3 Multidimensional access [views.multidim]
23.7.3.3 Class template extents [mdspan.extents]
23.7.3.3.1 Overview [mdspan.extents.overview]
The class template extents represents a multidimensional index space of rank equal to sizeof...(Extents).
In ([views]),extents is used synonymously with multidimensional index space.
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(see below) 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...) -> see below;}
Mandates:
- IndexType is a signed or unsigned integer type, and
- each element of Extents is either equal to dynamic_extent, or is representable as a value of type IndexType.
Each specialization of extents models regular and is trivially copyable.
Let be the element of Extents.
is a dynamic extent if it is equal to dynamic_extent, otherwise is a static extent.
Let be the value of _dynamic-extents_[dynamic-index(r)]if is a dynamic extent, otherwise .
The interval of the multidimensional index space represented by an extents object is .