std::layout_right::mapping(3)

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

πŸŽ€ NAME πŸŽ€

okay so bestie, this is the std::layout_right::mapping(3) page from the C++ Standard Libary manual, and the name situation is literally:

std::layout_right::mapping - std::layout_right::mapping

Periodt. That’s the whole NAME vibe. πŸ’…

πŸ¦‹ Synopsis πŸ¦‹

First things first, bestie β€” it’s defined in header <mdspan>, and it’s been around since C++23. Here’s the exact code energy:

Defined in header <mdspan>
template< class Extents >     (since C++23)
class layout_right::mapping;

okay so what does this icon actually do? The class template layout_right::mapping controls how multidimensional indices are mapped in a row-major manner to a one-dimensional value representing the offset. The mapping has stride 1 at rightmost extent and strides increase right-to-left as the products of extents. no cap, that’s the whole mapping moment. 🌈

Every specialization of mapping is a LayoutMapping and a TriviallyCopyable type which satisfies regular. it’s giving very well-behaved, tbh. 🫢

⚠️ and this part is serious: the program is ill-formed if the size of the multidimensional index space Extents() is not representable as a value of type Extents::index_type when Extents::rank_dynamic() is 0. not a vibe, fr fr. πŸ’€

πŸ’… Template parameters πŸ’…

  • Extents β€” specifies the number of dimensions, their sizes, and which are known at compile time. Must be a specialization of std::extents. 🧚

🌸 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_right

πŸ“ Member objects πŸ“

  • extents_ (private) β€” the extents of type extents_type. (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).
  • 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 [static] β€” determines if this mapping is exhaustive (every underlying element can be accessed with some combination of indexes) (public static 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).
πŸ‘€ lowkey note: for is_strided, the page literally uses the same β€œunique” wording as above β€” I’m keeping it exactly as written, no editing, iykyk.

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

  • operator== β€” compares this layout mapping with other mapping (function template).
  • submdspan_mapping(std::layout_right::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_stride (public member class template of std::layout_stride)

that’s the whole page, bestie 🫢 source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::layout_right::mapping(3) πŸ’–βœ¨

πŸ“¦ where this page comes from