std::extents<IndexType,Extents...>::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::extent
constexpr index_type extent( rank_type i ) const noexcept;
(since C++23)
Returns dynamic extent size of an extents
at a certain rank index.
Contents
[edit] Parameters
i
-
The rank index to get the extent size of
[edit] Return value
The dynamic extent size of an extents
at a certain rank index.
[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.extent(0) << ", " << e1.extent(1) << '\n'; std::cout << e2.extent(0) << ", " << e2.extent(1) << ", " << e2.extent(2) << '\n'; }
Output:
1, 2 3, 4, 5
[edit] See also
[static]
extents
at a certain rank index (public static member function) [edit]