std::layout...ide::mapping(3)

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

πŸ’… NAME πŸ’…

std::layout_stride::mapping β€” literally the mapping class for std::layout_stride, bestie


✨ Synopsis ✨

Okay so first things first, this whole situation lives in the header <mdspan> 🫢

template< class Extents >      (since C++23)
class layout_stride::mapping;

So the class template layout_stride::mapping is the main character that controls how multidimensional indices get mapped β€” using user-defined strides, no less β€” onto a one-dimensional value that represents the offset. Slay.

Every single specialization of mapping is a LayoutMapping and a TriviallyCopyable type, and it also satisfies regular. Like, it's giving well-behaved, honestly.

🚨 Real talk though: the program is ill-formed if the size of the multidimensional index space Extents() isn't representable as a value of type Extents::index_type when Extents::rank_dynamic() is 0. So watch out for that, okay? Not a drill.

🌸 Template parameters 🌸

  • Extents β€” specifies the number of dimensions, their sizes, and which ones are known at compile time. Has to be a specialization of std::extents, no exceptions. πŸ’–

πŸŽ€ Member types πŸŽ€

  • extents_type β€” Extents
  • index_type β€” extents_type::index_type
  • size_type β€” extents_type::size_type
  • rank_type β€” extents_type::rank_type
  • layout_type β€” std::layout_stride

πŸ¦‹ Member constants πŸ¦‹

  • constexpr rank_type rank_ (private) β€” extents_type::rank(). Also flagged [static] β€” it's an *exposition-only static member constant**. iykyk ✨

🌈 Member objects 🌈

  • extents_ (private) β€” the extents, of type extents_type. (exposition-only member object*)
  • strides_ (private) β€” the strides, of type std::array<index_type, rank_>. (exposition-only member object*)

πŸ‘‘ Member functions πŸ‘‘

  • constructor β€” constructs a new mapping (public member function)
  • operator= β€” assigns a mapping (public member function)

πŸ’œ Observers πŸ’œ

  • extents β€” obtains the extents object (public member function)
  • strides β€” obtains the array of strides (public member function)
  • required_span_size β€” returns the required size of the mapping (public member function)
  • operator() β€” maps multidimensional indices into an offset value (public member function)
  • is_unique [static] β€” determines if this mapping is unique (every combination of indexes maps to a different underlying element) (public static member function)
  • is_exhaustive β€” determines if this mapping is exhaustive (every underlying element can be accessed with some combination of indexes) (public member function)
  • is_strided [static] β€” determines if this mapping is unique (every combination of indexes maps to a different underlying element) (public static member function)
  • is_always_unique [static] β€” determines if this layout mapping is always unique (public static member function)
  • is_always_exhaustive [static] β€” determines if this layout mapping is always exhaustive (public static member function)
  • is_always_strided [static] β€” determines if this layout mapping is always strided (public static member function)
  • stride β€” obtains the stride along the specified dimension (public member function)

🧚 Non-member functions 🧚

  • operator== β€” compares this layout mapping with other mapping (function template)
  • submdspan_mapping(std::layout_stride::mapping) (C++26) β€” calculates the mapping and data handle offset used for subdmspan (public member function)

πŸ“ See also πŸ“

  • mapping β€” a layout mapping of layout_left (public member class template of std::layout_left)
  • mapping β€” a layout mapping of layout_right (public member class template of std::layout_right)

and that's the whole vibe, bestie βœ¨πŸ’– This little beauty comes to you from http://cppreference.com, dated 2024.06.10 β€” std::layout...ide::mapping(3), periodt. πŸŽ€

πŸ“¦ where this page comes from