Container‐based version of the <algorithm> std::replace_copy_if() function to replace a container's elements of some value with a new value based on some condition, and return the results within an iterator.

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename C,
    typename OutputIterator,
    typename Pred,
    typename T>
constexpr
OutputIterator
c_replace_copy_if(
    C const& c,
    OutputIterator result,
    Pred&& pred,
    T const& new_value);

Return Value

An iterator to the end of the copied range in the output.

Parameters

Name

Description

c

The container whose elements to copy.

result

The output iterator receiving the copied elements.

pred

The predicate selecting which elements to replace.

new_value

The value to substitute for matching elements.

Created with MrDocs