Freigeben über


find_if_not

Returns the first element in the indicated range that does not satisfy a condition.

template<class InputIterator, class Predicate>
InputIterator find_if_not(InputIterator first, InputIterator last, 
      Predicate pred);

Parameters

  • first
    An input iterator addressing the position of the first element in the range to be searched.

  • last
    An input iterator addressing the position one past the final element in the range to be searched.

  • pred
    User-defined predicate function object or lambda expression that defines the condition to be not satisfied by the element being searched for. A predicate takes single argument and returns true (satisfied) or false (not satisfied). The signature of pred must effectively be bool pred(const T& arg);, where T is a type to which InputIterator can be implicitly converted when dereferenced. The const keyword is shown only to illustrate that the function object or lambda should not modify the argument.

Return Value

An input iterator that refers to the first element in the range that does not satisfy the condition specified by the predicate (the predicate results in false). If all elements satisfy the predicate (the predicate results in true for every element), returns last.

Remarks

This template function is a generalization of the algorithm find, replacing the predicate "equals a specific value" with any predicate. For the logical opposite (find the first element that does satisfy the predicate), see find_if.

For a code example readily adaptable to find_if_not(), see find_if.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

<algorithm>

adjacent_find

find (STL)

find_if

find_end

mismatch

search