absl::c_replace_copy

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

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename C,
    typename OutputIterator,
    typename T>
constexpr
OutputIterator
c_replace_copy(
    C const& c,
    OutputIterator result,
    T&& old_value,
    T&& new_value);

Return Value

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

Parameters

NameDescription
cThe container whose elements to copy.
resultThe output iterator receiving the copied elements.
old_valueThe value to be replaced.
new_valueThe value to substitute for old_value.