std::extents<IndexType,Extents...>:: index-cast
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::mdspan
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::extents
| Member functions | ||||
| Observers | ||||
| Helpers | ||||
|
extents::
index-cast
|
||||
| Non-member functions | ||||
| Deduction guides |
|
template
<
class
OtherIndexType
>
static constexpr auto /*index-cast*/ ( OtherIndexType && i ) noexcept ; |
(depuis C++23)
( exposition uniquement* ) |
|
Convertit l'index
i
de type
OtherIndexType
en un certain type intégral.
C'est équivalent à :
-
return
i
;
, si
OtherIndexTypeest un type intégral autre que bool et - return static_cast < index_type > ( i ) ; sinon.
Paramètres
| i | - | l'indice à convertir |
Valeur de retour
Index de cast.
Notes
Un appel à cette fonction retournera toujours un type intégral autre que
bool
.
Les
types de classe entière
peuvent utiliser la branche
static_cast
sans perte de précision car les sites d'appel de cette fonction sont déjà contraints sur la convertibilité de
OtherIndexType
en
index_type
.