std::layout...ide::mapping(3)
π 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 spaceExtents()isn't representable as a value of typeExtents::index_typewhenExtents::rank_dynamic()is0. 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 ofstd::extents, no exceptions. π
π Member types π
extents_typeβExtentsindex_typeβextents_type::index_typesize_typeβextents_type::size_typerank_typeβextents_type::rank_typelayout_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 typeextents_type. (exposition-only member object*)strides_(private) β the strides, of typestd::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 oflayout_left(public member class template ofstd::layout_left)mappingβ a layout mapping oflayout_right(public member class template ofstd::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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms