Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
adjacent_find
Prototype

template<class ForwardRange>
typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange& rng);

template<class ForwardRange>
typename range_iterator<const ForwardRange>::type
adjacent_find(const ForwardRange& rng);

template<class ForwardRange, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange& rng, BinaryPred pred);

template<class ForwardRange, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
adjacent_find(const ForwardRange& rng, BinaryPred pred);

template<range_return_value_re, class ForwardRange>
typename range_return<ForwardRange, re>::type
adjacent_find(ForwardRange& rng);

template<range_return_value_re, class ForwardRange>
typename range_return<const ForwardRange, re>::type
adjacent_find(const ForwardRange& rng);

template<
    range_return_value re,
    class ForwardRange,
    class BinaryPredicate
    >
typename range_return<ForwardRange, re>::type
adjacent_find(ForwardRange& rng, BinaryPredicate pred);

template<
    range_return_value re,
    class ForwardRange,
    class BinaryPredicate
    >
typename range_return<const ForwardRange, re>::type
adjacent_find(const ForwardRange& rng, BinaryPredicate pred);

Description

Non-predicate versions:

adjacent_find finds the first adjacent elements [x,y] in rng where x == y

Predicate versions:

adjacent_find finds the first adjacent elements [x,y] in rng where pred(x,y) is true.

Definition

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

Requirements

For the non-predicate versions of adjacent_find:

For the predicate versions of adjacent_find:

Complexity

Linear. If empty(rng) then no comparisons are performed; otherwise, at most distance(rng) - 1 comparisons.


PrevUpHomeNext