• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:find_if find_if]
7
8[heading Prototype]
9
10``
11template<class SinglePassRange, class UnaryPredicate>
12typename range_iterator<SinglePassRange>::type
13find_if(SinglePassRange& rng, UnaryPredicate pred);
14
15template<
16    range_return_value re,
17    class SinglePassRange,
18    class UnaryPredicate
19    >
20typename range_return<SinglePassRange, re>::type
21find_if(SinglePassRange& rng, UnaryPredicate pred);
22``
23
24[heading Description]
25
26The 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.
27
28The versions of `find_if` that return a `range_return`, defines found in the same manner as the returned iterator described above.
29
30[heading Definition]
31
32Defined in the header file `boost/range/algorithm/find_if.hpp`
33
34[heading Requirements]
35
36* `SinglePassRange` is a model of the __single_pass_range__ Concept.
37* `UnaryPredicate` is a model of the `PredicateConcept`.
38* The value type of `SinglePassRange` is convertible to the argument type of `UnaryPredicate`.
39
40[heading Precondition:]
41
42For each iterator `i` in `rng`, `*i` is in the domain of `UnaryPredicate`.
43
44[heading Complexity]
45
46Linear. At most `distance(rng)` invocations of `pred`.
47
48[endsect]
49
50
51