Adjacent find

ForwardIterator adjacent_find (ForwardIterator first, ForwardIterator last) Function
ForwardIterator adjacent_find (ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred) Function

template 
ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last);

template 
ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last,
                              BinaryPredicate binary_pred);

adjacent_find returns the first iterator i such that both i and i + 1 are in the range [first, last) for which the following corresponding conditions hold:
*i == *(i + 1), binary_pred(*i, *(i + 1)) == true. If no such iterator i is found, last is returned. At most max((last - first) - 1, 0) applications of the corresponding predicate are done.