名前空間
変種
操作

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

From cppreference.com
< cpp‎ | container‎ | mdspan‎ | extents
 
 
 
 
 
template< class OtherIndexType >
static constexpr auto /*index-cast*/( OtherIndexType&& i ) noexcept;
(C++23から)
(説明用*)

インデックスiを特定の整数型にキャストします。OtherIndexTypeはキャストされる型です。

これは以下と同等です。

  • return i;、ただしOtherIndexTypebool以外の整数型である場合。
  • return static_cast<index_type>(i);、それ以外の場合。

[編集] パラメータ

i - キャストするインデックス。

[編集] 戻り値

キャストされたインデックス。

[編集] 注記

この関数は常にbool以外の整数型を返します。整数クラス型は、この関数の呼び出しサイトがすでにOtherIndexTypeindex_typeへの変換可能性に制約されているため、精度を失うことなくstatic_castブランチを使用できます。

English 日本語 中文(简体) 中文(繁體)