std::extents,std::dextents(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

Okay bestie, welcome to the std::extents,std::dextents(3) page from the C++ Standard Libary manual β€” yes, that's the spelling in the header, we're keeping it πŸ’€. This whole page is about std::extents and std::dextents, and that's literally the name. No cap.


✨ Synopsis ✨

Defined in header <mdspan>:

template< class IndexType, std::size_t... Extents > (1) (since C++23)
class extents;
template< class IndexType, std::size_t Rank >       (2) (since C++23)
using dextents = /* see below */
  1. Represents a multidimensional index space of rank equal to sizeof...(Extents).
  2. A convenient alias template for an all-dynamic extents. Let d denote std::dynamic_extent, each specialization of it dextents<IndexType, Rank> is equivalent to extents<IndexType /*, d, d, ..., d*/> (i.e. d is repeated a total of Rank times).

Each specialization of extents models regular and is TriviallyCopyable. Periodt. πŸ’…


πŸŽ€ Template parameters πŸŽ€

  • IndexType β€” the type of each non-dynamic Extents. Shall be a signed or unsigned integer type. Otherwise, the program is ill-formed.
  • Extents β€” represents extent (size of an integer interval) for each rank index. Each element of it is either equal to std::dynamic_extent (in this case, it represents a dynamic extent and the extent size will be determined dynamically), or is representable as a value of type IndexType (then it represents a static extent and the extent size is just the value of it), or else the program is ill-formed.
  • Rank β€” denotes the rank of an all-dynamic extents.

πŸ¦‹ Member types πŸ¦‹

  • index_type β€” IndexType
  • size_type β€” std::make_unsigned_t<index_type>
  • rank_type β€” std::size_t

πŸ’… Member objects πŸ’…

  • dynamic-extents (private) β€” an array of type std::array<index_type, rank_dynamic()>, which stores the size of each dynamic extents. (exposition-only member object*)

πŸ’– Member functions πŸ’–

  • constructor β€” constructs an extents (public member function)

⭐ Observers ⭐

  • rank [static] β€” returns the static rank of an extents (public static member function)
  • rank_dynamic [static] β€” returns the dynamic rank of an extents (public static member function)
  • static_extent [static] β€” returns static extent size of an extents at a certain rank index (public static member function)
  • extent β€” returns dynamic extent size of an extents at a certain rank index (public member function)

🧚 Helpers 🧚

  • fwd-prod-of-extents β€” returns the product of extent size in range [0, i) (exposition-only member function*)
  • rev-prod-of-extents β€” returns the product of extents size in range [i + 1, rank()) (exposition-only member function*)
  • index-cast β€” casts the input into an integer type (exposition-only member function*)
  • dynamic-index (private) β€” returns the number of dynamic extents below a certain rank index (exposition-only member function*)
  • dynamic-index-inv (private) β€” returns the number r such that in range [0, r + 1) there is exactly i + 1 dynamic extents for a certain argument i (exposition-only member function*)

πŸ”₯ Non-member functions πŸ”₯

  • operator== (C++23) β€” compare underlying extents in each dimension of two extents (function)

🌈 Deduction guides(C++23) 🌈

This one is just listed on the page as Deduction guides(C++23) β€” no extra details here, bestie. That's the whole vibe check. πŸ’€


πŸ“ Example πŸ“

This section is incomplete Reason: no example

πŸ‘‘ See also πŸ‘‘

  • rank (C++11) β€” obtains the number of dimensions of an array type (class template)
  • extent (C++11) β€” obtains the size of an array type along a specified dimension (class template)

πŸ’œ Category πŸ’œ

  • Todo no example

Source/version/date sign-off: http://cppreference.com Β· 2024.06.10 Β· std::extents,std::dextents(3) β€” love u, bye bestie πŸ’–βœ¨
πŸ“¦ where this page comes from