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 /*索引转换*/ ( OtherIndexType && i ) noexcept ; |
(C++23 起)
( 仅用于说明* ) |
|
将类型为
OtherIndexType
的索引
i
转换为特定整数类型。
它等价于:
-
return
i
;
,当
OtherIndexType是除 bool 之外的整型时 - return static_cast < index_type > ( i ) ; 其他情况。
参数
| i | - | 要转换的索引 |
返回值
强制转换索引。
注释
调用此函数将始终返回除
bool
之外的整数类型。
整数类类型
可使用
static_cast
分支而不会损失精度,因为此函数的调用点已对
OtherIndexType
到
index_type
的可转换性进行了约束。