std::extents<IndexType,Extents...>::index-cast
來自 cppreference.com
template< class OtherIndexType > static constexpr auto /*index-cast*/( OtherIndexType&& i ) noexcept; |
(C++23 起) (僅作說明*) |
|
將型別為 OtherIndexType
的索引 i 轉換為某個整數型別。
它等價於
- return i;,如果
OtherIndexType
是除 bool 之外的整數型別,並且 - 否則為 return static_cast<index_type>(i);。
[編輯] 引數
i | - | 要轉換的索引 |
[編輯] 返回值
轉換後的索引。
[編輯] 注意
對該函式的呼叫將始終返回除 bool 之外的整數型別。整數類型別可以使用 static_cast 分支而不會丟失精度,因為此函式的呼叫點已經限制了 OtherIndexType
到 index_type
的可轉換性。