std::extents<IndexType,Extents...>::rank
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::rank
static constexpr rank_type rank() const noexcept;
(since C++23)
Returns the number of dimensions in extents
.
Contents
[edit] Parameters
(none)
[edit] Return value
The number of dimensions.
[edit] Example
Run this code
#include <iostream> #include <mdspan> int main() { std::extents <int, 1, 2> e1; std::extents <int, 3, 4, std::dynamic_extent > e2(5); std::cout << e1.rank() << ", " << e2.rank() << '\n'; }
Output:
2, 3