Vector::IndexOf Method

Vector::IndexOf Method


Searches for the specified item in the current Vector, and if found, returns the index of the item.

virtual bool IndexOf(
   T value,
   unsigned int* index


The item to find.


The zero-based index of the item if parameter value is found; otherwise, 0.

The index parameter is 0 if either the item is the first element of the Vector or the item was not found. If the return value is true, the item was found and it is the first element; otherwise, the item was not found.

true if the specified item is found; otherwise, false.

IndexOf uses std::find_if to find the item. Custom element types should therefore overload the == and != operator in order to enable the equality comparisons that find_if requires.


Header: collection.h

Namespace: Platform::Collections

© 2016 Microsoft