Поделиться через


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 Class