Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

remove_copy


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 T>
 OutputIterator remove_copy (InputIterator first,
                             InputIterator last,
                             OutputIterator result,
                             const T& value);

Description

The remove_copy algorithm copies all the elements referred to by the iterator i in the range [first, last) for which the following corresponding condition does not hold: *i == value. remove_copy returns an iterator that points to the end of the resulting range. remove_copy 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. The elements in the original sequence are not altered by remove_copy.

Complexity

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

Example

Program Output

Warnings

If your compiler does not support default template parameters, 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_if



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