CSimpleArray::Find

尋找在陣列的項目。

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);   

需求

Header: atlsimpcoll.h

請參閱

參考

CSimpleArray 類別