std::extent...tatic_extent(3)
π NAME π
std::extents::static_extent β std::extents::static_extent. Yes bestie, the NAME section is literally the same thing twice, and we're on the std::extent...tatic_extent(3) page inside the C++ Standard Libary manual. Lowkey iconic.
β¨ Synopsis β¨
static constexpr std::size_t static_extent( rank_type i ) noexcept;
(since C++23) β this one has been serving since C++23, periodt.
Okay so this returns the static extent size of an extents at the rank index i. If the rank index i is a dynamic extent, it returns std::dynamic_extent. Slay.
π Parameters π
iβ the rank index to get the static extent size of. That's the whole assignment, bestie.
π¦ Return value π¦
The static extent size, or the std::dynamic_extent value. Simple as that. π
π Example π
Run this code, bestie:
// Run this code
#include <iostream>
#include <mdspan>
int main()
{
std::extents<int, 1, 2> e1;
std::extents<int, 3, std::dynamic_extent, std::dynamic_extent>
e2(4, 5);
std::cout << e1.static_extent(0) << ", " << e1.static_extent(1) <<
'\n';
std::cout << (e2.static_extent(0) == std::dynamic_extent) << ", "
<< (e2.static_extent(1) == std::dynamic_extent) << ", "
<< (e2.static_extent(2) == std::dynamic_extent) << '\n';
}
π Output π
1, 2
0, 1, 1
π See also π
extentβ returns dynamic extent size of an extents at a certain rank index (public member function).extentβ obtains the size of an array type along a specified dimension (C++11) (class template).
mwah π this little page is from http://cppreference.com, dated 2024.06.10, and the footer vibes are std::extent...tatic_extent(3). π
π¦ 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