find_end
Searches for the last occurrence of a subrang
Definition
The find_end() algorithm is defined in the standard header <algorithm> and in the nonstandard backward-compatibility header <algo.h>.
Interface
#include <algorithm>
template < class ForwardIterator1, class ForwardIterator2 >
ForwardIterator1 find_end(
ForwardIterator1 first1,
ForwardIterator1 last1,
ForwardIterator2 first2,
ForwardIterator2 last2
);
template < class ForwardIterator1, class ForwardIterator2, class Pr >
ForwardIterator1 find_end(
ForwardIterator1 first1,
ForwardIterator1 last1,
ForwardIterator2 first2,
ForwardIterator2 last2,
BinaryPredicate comp
);Parameters:
| Parameter | Description |
| first1 | A forward iterator addressing the position of the first element in the range to be searched |
| last1 | A forward iterator addressing the position one past the final element in the range to be searched |
| first2 | A forward iterator addressing the position of the first element in the range to be searched |
| last2 | A forward iterator addressing the position one past the final element in the range to be searched |
| comp | User-defined predicate function object that defines the condition to be satisfied if two elements are to be taken as equivalent. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied |
Description
Find_end finds the last subsequence (elements between first2 and last2) contained into a sequence (elements between first1 and last1 ).
Return Value
Returns a forward iterator addressing the position of the first element of the last subsequence that matches the specified sequence or that is equivalent in a sense specified by a binary predicate.
Complexity
The complexity is linear, find_end performs at most (last1 - first1) * (last2 - first2) comparisons.
References
See Also
- http://www.codecogs.com/reference/computing/algorithms/nonmodifying/find.php"find"
- http://www.codecogs.com/reference/computing/algorithms/nonmodifying/find_if.php"find_if"
- http://www.codecogs.com/reference/computing/stl/algorithms/nonmodifying/find_first_of.php"find_first_of"
- http://www.codecogs.com/reference/computing/stl/algorithm/nonmodifying/search.php"search"