std::adjacent_find
Template:cpp/algorithm/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td><algorithm>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td >ForwardIterator adjacent_find( ForwardIterator first, ForwardIterator last );
<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td >ForwardIterator adjacent_find( ForwardIterator first, ForwardIterator last, BinaryPredicate p );
<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
Searches the range [first, last)
for two consecutive identical elements. The first version uses operator==
to compare the elements, the second version uses the given binary predicate p
.
first, last | - | the range of elements to examine |
p | - | binary predicate which returns true if the elements should be treated as equal. The signature of the predicate function should be equivalent to the following: bool pred(const Type1 &a, const Type2 &b); While the signature does not need to have const &, the function must not modify the objects passed to it and must be able to accept all values of type (possibly const) |
an iterator to the first of the identical elements. If no such elements are found, last
is returned
This section is incomplete Reason: no eq fun |
This section is incomplete Reason: no example |
linear in the distance between first
and last