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:adjacent_find adjacent_find] 7 8[heading Prototype] 9 10`` 11template<class ForwardRange> 12typename range_iterator<ForwardRange>::type 13adjacent_find(ForwardRange& rng); 14 15template<class ForwardRange> 16typename range_iterator<const ForwardRange>::type 17adjacent_find(const ForwardRange& rng); 18 19template<class ForwardRange, class BinaryPredicate> 20typename range_iterator<ForwardRange>::type 21adjacent_find(ForwardRange& rng, BinaryPred pred); 22 23template<class ForwardRange, class BinaryPredicate> 24typename range_iterator<const ForwardRange>::type 25adjacent_find(const ForwardRange& rng, BinaryPred pred); 26 27template<range_return_value_re, class ForwardRange> 28typename range_return<ForwardRange, re>::type 29adjacent_find(ForwardRange& rng); 30 31template<range_return_value_re, class ForwardRange> 32typename range_return<const ForwardRange, re>::type 33adjacent_find(const ForwardRange& rng); 34 35template< 36 range_return_value re, 37 class ForwardRange, 38 class BinaryPredicate 39 > 40typename range_return<ForwardRange, re>::type 41adjacent_find(ForwardRange& rng, BinaryPredicate pred); 42 43template< 44 range_return_value re, 45 class ForwardRange, 46 class BinaryPredicate 47 > 48typename range_return<const ForwardRange, re>::type 49adjacent_find(const ForwardRange& rng, BinaryPredicate pred); 50`` 51 52[heading Description] 53 54[*Non-predicate versions:] 55 56`adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `x == y` 57 58[*Predicate versions:] 59 60`adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `pred(x,y)` is `true`. 61 62[heading Definition] 63 64Defined in the header file `boost/range/algorithm/adjacent_find.hpp` 65 66[heading Requirements] 67 68[*For the non-predicate versions of adjacent_find:] 69 70* `ForwardRange` is a model of the __forward_range__ Concept. 71* `ForwardRange`'s value type is a model of the `EqualityComparableConcept`. 72 73[*For the predicate versions of adjacent_find:] 74 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. 78 79[heading Complexity] 80 81Linear. If `empty(rng)` then no comparisons are performed; otherwise, at most `distance(rng) - 1` comparisons. 82 83[endsect] 84 85 86