find (STL)

Locates the position of the first occurrence of an element in a range that has a specified value.

template<class InputIterator, class T>
InputIterator find(InputIterator first, InputIterator last, 
      const T& val);

first

An input iterator addressing the position of the first element in the range to be searched for the specified value.

last

An input iterator addressing the position one past the final element in the range to be searched for the specified value.

val

The value to be searched for.

An input iterator addressing the first occurrence of the specified value in the range being searched. If no element is found with an equivalent value, returns last.

The operator== used to determine the match between an element and the specified value must impose an equivalence relation between its operands.

For a code example using find(), see find_if.

Header: <algorithm>

Namespace: std

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft