find_end()
This algorithm takes two iterator pairs. The first pair marks the container to be searched. The second pair marks a sequence to match against. The elements within the first container are compared for the last occurrence of the sequence using either the equality operator or the specified binary operation. If a match is found, an iterator addressing the first element of the matched sequence is returned; otherwise, the iterator marking the end of the first container is returned. For example, given the character sequence Mississippi and a second sequence ss, find_end() returns an iterator to the first s of the second ss sequence.
#include <algorithm>
int ia[ 17 ] = { 7,3,3,7,6,5,8,7,2,1,3,7,6,3,8,4,3 };
int seq[ 3 ] = { 3, 7, 6 };
// found_it addresses ia[10]
found_it = find_end( ia, ia+17, seq, seq+3 );
|