[#absl-c_replace_if]
= xref:absl.adoc[absl]::c&lowbar;replace&lowbar;if
:relfileprefix: ../
:mrdocs:

Container&hyphen;based version of the &lt;algorithm&gt; `std&colon;&colon;replace&lowbar;if()` function to replace a container&apos;s elements of some value with a new value based on some condition&period; The container is modified in place&period;

== Synopsis

Declared in `&lt;absl&sol;algorithm&sol;container&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename C,
    typename Pred,
    typename T&gt;
constexpr
void
c&lowbar;replace&lowbar;if(
    C& c,
    Pred&& pred,
    T&& new&lowbar;value);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *c*
| The container to modify&period;
| *pred*
| The predicate selecting which elements to replace&period;
| *new&lowbar;value*
| The value to substitute for matching elements&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
