Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

find_end()

Library:  Algorithms


Function

Local Index

No Entries

Summary

Algorithm that finds the last occurrence of a sub-sequence in a sequence

Synopsis

#include <algorithm>

namespace std {
  template <class ForwardIterator1, class ForwardIterator2>
  ForwardIterator1 find_end(ForwardIterator1 start1, 
                            ForwardIterator1 finish1,
                            ForwardIterator2 start2, 
                            ForwardIterator2 finish2);
  template <class Forward Iterator1, class ForwardIterator2, 
            class BinaryPredicate>
  ForwardIterator1 find_end(ForwardIterator1 start1, 
                            ForwardIterator1 finish1,
                            ForwardIterator2 start2,
                            ForwardIterator2 finish2,
                            BinaryPredicate binary_pred);
}

Description

The find_end() algorithm finds the last occurrence of a sub-sequence, indicated by [start2, finish2), in a sequence, [start1,finish1). The algorithm returns an iterator pointing to the first element of the found sub-sequence, or finish1 if no match is found.

More precisely, the find_end() algorithm returns the last iterator i in the range [start1, finish1 - (finish2-start2)) such that for any non-negative integer n < (finish2-start2), the following corresponding conditions hold:

Or returns finish1 if no such iterator is found.

Two versions of the algorithm exist. The first uses the equality operator as the default binary predicate, and the second allows you to specify a binary predicate.

Complexity

At most (finish2-start2)*(finish1-start1-(finish2-start2)+1) applications of the corresponding predicate are done.

Example

See Also

Algorithms, find(), find_if(), adjacent_find()

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 25.1.3



Previous fileTop of DocumentContentsIndex pageNext file