CSimpleArray::Find

更新 : 2007 年 11 月

配列内の要素を検索します。

int Find(
   const T& t 
) const;

パラメータ

  • t
    検索対象の要素。

戻り値

見つかった要素のインデックスを返します。要素が見つからない場合は -1 を返します。

使用例

// Create an array of floats and search for a particular element

CSimpleArray<float> fMyArray;

for (int i = 0; i < 10; i++)
   fMyArray.Add((float)i * 100);

int e = fMyArray.Find(200);
if (e == -1)
   _tprintf_s(_T("Could not find element\n"));
else
   _tprintf_s(_T("Found the element at location %d\n"), e);   

必要条件

ヘッダー : atlsimpcoll.h

参照

参照

CSimpleArray クラス

その他の技術情報

CSimpleArray のメンバ