Next : Mutating sequence operations, Previous : Equal, Top : Table of  Contents


Search

ForwardIterator1 search (ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2) Function
ForwardIterator1 search( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2  last2,BinaryPredicate binary_pred) Function

template 
ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
                        ForwardIterator2 first2, ForwardIterator2 last2);

template 
ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
                        ForwardIterator2 first2, ForwardIterator2 last2,
                        BinaryPredicate binary_pred);

search finds a subsequence of equal values in a sequence. search returns the first iterator i in the range [first1, last1 - (last2 - first2)) such that for any non-negative integer n less than last2 - first2 the following corresponding conditions hold:
*(i + n) == *(first2 + n)
 binary_pred(*(i + n), *(first2 + n)) == true

If no such iterator is found, last1 is returned. At most (last1 - first1) * (last2 - first2) applications of the corresponding predicate are done. The quadratic behavior, however, is highly unlikely.


 

Top