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)
6 [section:adjacent_find adjacent_find]
11 template<class ForwardRange>
12 typename range_iterator<ForwardRange>::type
13 adjacent_find(ForwardRange& rng);
15 template<class ForwardRange>
16 typename range_iterator<const ForwardRange>::type
17 adjacent_find(const ForwardRange& rng);
19 template<class ForwardRange, class BinaryPredicate>
20 typename range_iterator<ForwardRange>::type
21 adjacent_find(ForwardRange& rng, BinaryPred pred);
23 template<class ForwardRange, class BinaryPredicate>
24 typename range_iterator<const ForwardRange>::type
25 adjacent_find(const ForwardRange& rng, BinaryPred pred);
27 template<range_return_value_re, class ForwardRange>
28 typename range_return<ForwardRange, re>::type
29 adjacent_find(ForwardRange& rng);
31 template<range_return_value_re, class ForwardRange>
32 typename range_return<const ForwardRange, re>::type
33 adjacent_find(const ForwardRange& rng);
36 range_return_value re,
40 typename range_return<ForwardRange, re>::type
41 adjacent_find(ForwardRange& rng, BinaryPredicate pred);
44 range_return_value re,
48 typename range_return<const ForwardRange, re>::type
49 adjacent_find(const ForwardRange& rng, BinaryPredicate pred);
54 [*Non-predicate versions:]
56 `adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `x == y`
58 [*Predicate versions:]
60 `adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `pred(x,y)` is `true`.
64 Defined in the header file `boost/range/algorithm/adjacent_find.hpp`
66 [heading Requirements]
68 [*For the non-predicate versions of adjacent_find:]
70 * `ForwardRange` is a model of the __forward_range__ Concept.
71 * `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
73 [*For the predicate versions of adjacent_find:]
75 * `ForwardRange` is a model of the __forward_range__ Concept.
76 * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
77 * `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
81 Linear. If `empty(rng)` then no comparisons are performed; otherwise, at most `distance(rng) - 1` comparisons.