Name
find_if function template — Searches for when a predicate returns true
Synopsis
template<typename InIter, typename Predicate>
InIter find_if(InIter first, InIter last, Predicate pred);
The find_if
function
template (similar to find
)
searches the range [first
,
last
) for the first item for
which pred(*iter)
is true. It
returns an iterator that points to the matching item. If no matching
item is found, last
is
returned.
Technical Notes
The find_if
function
template returns i = first + n, in which n is the smallest value such that
pred(*(first + n), value) is true. If there is no such
n, i = last.
Complexity is linear: pred
is called at most last -
first times.
See Also
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.