Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
find_if
Prototype

template<class SinglePassRange, class UnaryPredicate>
typename range_iterator<SinglePassRange>::type
find_if(SinglePassRange& rng, UnaryPredicate pred);

template<
    range_return_value re,
    class SinglePassRange,
    class UnaryPredicate
    >
typename range_return<SinglePassRange, re>::type
find_if(SinglePassRange& rng, UnaryPredicate pred);

Description

The versions of find_if that return an iterator, returns the first iterator in the range rng such that pred(*i) is true. end(rng) is returned if no such iterator exists.

The versions of find_if that return a range_return, defines found in the same manner as the returned iterator described above.

Definition

Defined in the header file boost/range/algorithm/find_if.hpp

Requirements
Precondition:

For each iterator i in rng, *i is in the domain of UnaryPredicate.

Complexity

Linear. At most distance(rng) invocations of pred.


PrevUpHomeNext