Namespaces
Variants

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

From cppreference.net
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 的可转换性进行了约束。