replace_copy_if

The function replace_copy_if is used to replace specific elements that match certain criteria while copying the entire range.

  template<class Iterator, 
  class OutputIterator, class Predicate, class T>
  OutputIterator replace_copy_if
  (Iterator first, Iterator last,
  OutputIterator result,Predicate pred, const T& new_value);
  
Remarks

The position of the last copied element is returned.