absl::c_replace_if

Container-based version of the <algorithm> std::replace_if() function to replace a container's elements of some value with a new value based on some condition. The container is modified in place.

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename C,
    typename Pred,
    typename T>
constexpr
void
c_replace_if(
    C& c,
    Pred&& pred,
    T&& new_value);

Parameters

NameDescription
cThe container to modify.
predThe predicate selecting which elements to replace.
new_valueThe value to substitute for matching elements.