Share via


remove_copy_if

remove_copy_if

template<class InIt, class OutIt, class Pred>
    OutIt remove_copy_if(InIt first, InIt last, OutIt x, Pred pr);

The template function effectively executes the statement:

if (!pr(*(first + N)))
    *x++ = *(first + N);

once for each N in the range [0, last - first). It then returns x. Thus, the function removes from the sequence all elements for which the predicate pr(*(first + N)) is true, without altering the relative order of remaining elements, and returns the iterator value that designates the end of the revised sequence.

If x and first designate regions of storage, the range [x, x + (last - first)) must not overlap the range [first, last).

See the related sample program.