Condividi tramite


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

Parameters

  • 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.

Return Value

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.

Remarks

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.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

<algorithm>

adjacent_find

find_if

find_if_not

find_end

mismatch

search