Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

remove_copy_if


Algorithm

Summary

Moves desired elements to the front of a container, and returns an iterator that describes where the sequence of desired elements ends.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

None

Synopsis

#include <algorithm>
template <class InputIterator,
          class OutputIterator,
          class Predicate>
 OutputIterator remove_copy_if (InputIterator first,
                                InputIterator last,
                                OutputIterator result,
                                Predicate pred);

Description

The remove_copy_if algorithm copies all the elements referred to by the iterator i in the range [first, last) for which the following condition does not hold: pred(*i) == true. remove_copy_if returns an iterator that points to the end of the resulting range. remove_copy_if is stable, which means that the relative order of the elements in the resulting range is the same as their relative order in the original range.

Complexity

Exactly last1 - first1 applications of the corresponding predicate are done.

Example

Program Output

Warnings

If your compiler does not support default template parameters, then you always need to supply the Allocator template argument. For instance, you need to write:

vector<int, allocator<int> >

instead of:

vector<int>

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

remove, remove_if, remove_copy



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998