# std::mdspan<T,Extents,LayoutPolicy,AccessorPolicy>::rank

> C++ Atlas: `cppatlas.com/w/cpp/container/mdspan/rank` | Source: https://en.cppreference.com/w/cpp/container/mdspan/rank | Domain: Containers | Standards: C++23

Returns the number of dimensions in a mdspan. Equivalent to return Extents::rank().

## Official Specification Summary (cppreference)

```cpp
static constexpr rank_type rank() noexcept; // (since C++23)
```

Returns the number of dimensions in a `mdspan`. Equivalent to `return Extents::rank()`.

### Parameters

(none)

### Return value

The number of dimensions.

### Example

> Note: This section is incomplete Reason: no example

### See also

- [`rank`](https://en.cppreference.com/w/cpp/container/mdspan/extents/rank) [static]: returns the static rank of an `extents` (public static member function of `std::extents<IndexType,Extents...>`)
- [`rank_dynamic`](https://en.cppreference.com/w/cpp/container/mdspan/rank_dynamic) [static]: returns the dynamic rank of a `mdspan` (public static member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/container/mdspan/rank (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.