次の方法で共有


index クラス

N 次元の index ベクターを定義します。

構文

template <int _Rank>
class index;

パラメーター

_Rank
ランク (次元数)。

メンバー

パブリック コンストラクター

名前 説明
index コンストラクター index クラスの新しいインスタンスを初期化します。

パブリック演算子

名前 説明
operator-- index オブジェクトの各要素をデクリメントします。
operator%= その要素がある数で除算された場合、index オブジェクトの各要素の剰余を計算します。
operator*= index オブジェクトの各要素をある数で乗算します。
operator/= index オブジェクトの各要素をある数で除算します。
index::operator[] 指定したインデックス位置にある要素を返します。
operator++ index オブジェクトの各要素をインクリメントします。
operator+= 指定した数を index オブジェクトの各要素に加算します。
operator= 指定された index オブジェクトの内容をこのオブジェクトにコピーします。
operator-= 指定した数を index オブジェクトの各要素から減算します。

パブリック定数

名前 説明
rank 定数 index オブジェクトのランクを格納します。

継承階層

index

解説

index 構造体は、N 次元の空間の一意の場所を指定する N 整数の座標ベクターを表します。 ベクターの値は最上位から最下位へ順に並べ替えられます。 operator= を使用して、コンポーネントの値を取得できます。

必要条件

ヘッダー: amp.h

名前空間: Concurrency

index コンストラクター

インデックス クラスの新しいインスタンスを初期化します。

index() restrict(amp,cpu);

index(
   const index<_Rank>& _Other
) restrict(amp,cpu);

explicit index(
   int _I
) restrict(amp,cpu);

index(
   int _I0,
   int _I1
) restrict(amp,cpu);

index(
   int _I0,
   int _I1,
   int _I2
) restrict(amp,cpu);

explicit index(
   const int _Array[_Rank]
) restrict(amp,cpu);

パラメーター

_Array
ランク値を持つ 1 次元配列。

_I
1 次元インデックスのインデックス位置。

_I0
最上位の次元の長さ。

_I1
最上位の次の次元の長さ。

_I2
最下位の次元の長さ。

_Other
新しい index オブジェクトが基づく index オブジェクト。

operator--

インデックス オブジェクトの各要素をデクリメントします。

index<_Rank>& operator--() restrict(amp,cpu);

index operator--(
   int
) restrict(amp,cpu);

戻り値

前置演算子の場合は、index オブジェクト (*this) です。 サフィックス演算子の場合は、新しい index オブジェクトです。

operator%=

その要素が指定の数で除算された場合、index オブジェクトの各要素の剰余を計算します。

index<_Rank>& operator%=(
   int _Rhs
) restrict(cpu, amp);

パラメーター

_Rhs
剰余を求めるために除算する数値。

戻り値

index オブジェクトです。

operator*=

インデックス オブジェクト内の各要素に、指定した数を乗算します。

index<_Rank>& operator*=(
   int _Rhs
) restrict(amp,cpu);

パラメーター

_Rhs
乗算対象の数です。

operator/=

インデックス オブジェクト内の各要素を指定した数で除算します。

index<_Rank>& operator/=(
   int _Rhs
) restrict(amp,cpu);

パラメーター

_Rhs
除数。

operator[]

指定した位置にあるインデックスのコンポーネントを返します。

int operator[] (
   unsigned _Index
) const restrict(amp,cpu);

int& operator[] (
   unsigned _Index
) restrict(amp,cpu);

パラメーター

_Index
0 からランク - 1 までの整数。

戻り値

指定したインデックス位置にある要素。

解説

次の例では、インデックスのコンポーネント値を表示します。

// Prints 1 2 3.
concurrency::index<3> idx(1, 2, 3);
std::cout << idx[0] << "\n";
std::cout << idx[1] << "\n";
std::cout << idx[2] << "\n";

operator++

インデックス オブジェクトの各要素をインクリメントします。

index<_Rank>& operator++() restrict(amp,cpu);

index<_Rank> operator++(
   int
) restrict(amp,cpu);

戻り値

前置演算子の場合は、index オブジェクト (*this) です。 サフィックス演算子の場合は、新しい index オブジェクトです。

operator+=

指定した番号をインデックス オブジェクトの各要素に追加します。

index<_Rank>& operator+=(
   const index<_Rank>& _Rhs
) restrict(amp,cpu);

index<_Rank>& operator+=(
   int _Rhs
) restrict(amp,cpu);

パラメーター

_Rhs
加算する数。

戻り値

index オブジェクトです。

operator=

指定したインデックス オブジェクトの内容をこのオブジェクトにコピーします。

index<_Rank>& operator=(
   const index<_Rank>& _Other
) restrict(amp,cpu);

パラメーター

_Other
コピーする index オブジェクト。

戻り値

この index オブジェクトへの参照。

operator-=

インデックス オブジェクトの各要素から指定した数を減算します。

index<_Rank>& operator-=(
   const index<_Rank>& _Rhs
) restrict(amp,cpu);

index<_Rank>& operator-=(
   int _Rhs
) restrict(amp,cpu);

パラメーター

_Rhs
減算する数。

戻り値

index オブジェクトです。

順位

index オブジェクトの順位を取得します。

static const int rank = _Rank;

関連項目

コンカレンシー名前空間 (C++ AMP)