Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Standard C++ Library Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

find_end()

Module:  Standard C++ Library   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

Copyright (c) 1994-2006 Rogue Wave Software, a Quovadx Division.
Licensed under the Apache License, Version 2.0.
Contact Rogue Wave about documentation or support issues. You can also seek help from other developers through the Apache stdcxx community (see below).

For more information on the Rogue Wave Standard C++ Library under open source, see Section 1.2 of the user's guide.