std::extents<IndexType,Extents...>::index-cast
来自 cppreference.cn
template< class OtherIndexType > static constexpr auto /*index-cast*/( OtherIndexType&& i ) noexcept; |
(since C++23) (仅为说明目的*) |
|
将 OtherIndexType
类型的索引 i 转换为某种整型。
它等价于
- return i;,如果
OtherIndexType
是除 bool 之外的整型,并且 - return static_cast<index_type>(i); 否则。
[编辑] 参数
i | - | 要转换的索引 |
[编辑] 返回值
转换索引。
[编辑] 注解
调用此函数将始终返回一个非 bool 的整型。整数类类型 可以使用 static_cast 分支而不会损失精度,因为此函数的调用点已经约束了 OtherIndexType
到 index_type
的可转换性。