次の方法で共有


CSimpleArray::operator

配列から要素を取得します。

T& operator[](
   int nIndex 
);

パラメーター

  • nIndex
    要素のインデックス。

戻り値

nIndex で参照される配列の要素を返します。

使用例

// Create an array and display its contents
 CSimpleArray<int> iMySampleArray;

 for (int i = 0; i < 10; i++)
    iMySampleArray.Add(i);

 for (int i = 0; i < iMySampleArray.GetSize(); i++)
    _tprintf_s(_T("Array index %d contains %d\n"), i, iMySampleArray[i]);

必要条件

**ヘッダー:**atlsimpcoll.h

参照

参照

CSimpleArray クラス

その他の技術情報

CSimpleArray のメンバー