Namespaces
Variants
Actions

std::extents<IndexType,Extents...>::index-cast

From cppreference.com
< cpp‎ | container‎ | mdspan‎ | extents
 
C++
 
Containers library
 
std::mdspan
 
std::extents
template< class OtherIndexType >
static constexpr auto /*index-cast*/( OtherIndexType&& i ) noexcept;
(since C++23)
(exposition only*)

Casts the index i of type OtherIndexType into a certain integral type.

It is equivalent to:

  • return i;, if OtherIndexType is an integral type other than bool and
  • return static_cast<index_type>(i); otherwise.

[edit] Parameters

i - the index to be cast

[edit] Return value

Cast index.

[edit] Notes

A call to this function will always return an integral type other than bool. Integer-class types can use the static_cast branch without loss of precision because this function's call sites are already constrained on the convertibility of OtherIndexType to index_type.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant