Standard C++ Library Class Reference
Click on the banner to return to the Class Reference home page.
©Copyright 1996 Rogue Wave Software
replace_copy_if
 Algorithm
Summary
Substitutes elements stored in a collection with new values.
Contents
Synopsis● 
Description● 
Complexity● 
Example● 
Warning● 
See Also● 
Synopsis
#include <algorithm>
template <class InputIterator,
 class OutputIterator,
 class Predicate,
 class T>
OutputIterator replace_copy_if (InputIterator first,
 InputIterator last,
 OutputIterator result,
 Predicate pred,
 const T& new_value);
Description
The replace_copy_if algorithm leaves the original sequence intact and places a revised sequence into result. The algorithm
compares each element *i in the range [first,last) with the conditions specified by pred. If pred(*i)==false, replace_copy_if
copies *i to result+(first-i). If pred(*i)==true, then replace_copy copies new_value to result+(first-i). replace_copy_if returns
result+(last-first).
Complexity
Exactly last - first applications of the predicate are performed.
Example
//
// replace.cpp
//










