C++ Algorithm Function search()
C++ Algorithm search() function searches the range [first1, last1) for the occurrence of a subsequence defined by the range [first2, last2), and an iterator to the first element is returned. If the subsequence does not exist then an iterator to the last1 is returned.
first1: It is a forward iterator to the first element of the [first1, last1).
last1: It is a forward iterator to the last element of the [first1, last1).
first2: It is a forward iterator to the first element of the [first2, last2).
pred: It is a binary function that accepts two elements as arguments and performs the task designed by the function.
The function returns an iterator to the first element of the first occurrence of the subsequence, else returns the last1 element.
patt1 found at position 1 patt2 not found
Vector2 is present at index:2
The function has linear complexity from the first1 element to the last1 element.
Objects in both ranges are accessed.
The function throws an exception if any of the argument throws one.