std::extents<IndexType,Extents...>::static_extent
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Containers library
(C++17)
(C++11)
(C++26)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++23)
(C++23)
(C++20)
(C++23)
Tables
std::mdspan
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
std::extents
extents::static_extent
static constexpr std::size_t static_extent( rank_type i ) noexcept;
(since C++23)
Returns static extent size of an extents
at the rank index i. If the rank index i is a dynamic extent, returns std::dynamic_extent.
Contents
[edit] Parameters
i
-
The rank index to get the static extent size of
[edit] Return value
The static extent size or std::dynamic_extent value.
[edit] Example
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