
Category: algorithms  Component type: function 
template <class ForwardIterator> ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last); template <class ForwardIterator, class BinaryPredicate> ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred);
The second version of adjacent_find returns the first iterator i such that i and i+1 are both valid iterators in [first, last), and such that binary_pred(*i, *(i+1)) is true. It returns last if no such iterator exists.
int A[] = {1, 2, 3, 4, 6, 5, 7, 8}; const int N = sizeof(A) / sizeof(int); const int* p = adjacent_find(A, A + N, greater<int>()); cout << "Element " << p  A << " is out of order: " << *p << " > " << *(p + 1) << "." << endl;
Contact Us  Site Map  Trademarks  Privacy  Using this site means you accept its Terms of Use 
Copyright © 2009  2017 Silicon Graphics International. All rights reserved. 