[#absl-SetFlag-00]
= xref:absl.adoc[absl]::SetFlag
:relfileprefix: ../
:mrdocs:

`SetFlag` overloads

== Synopses

Declared in `&lt;absl&sol;flags&sol;flag&period;h&gt;`

Sets the value of an `absl&colon;&colon;Flag` to the value `v`&period; Do not construct an `absl&colon;&colon;Flag&lt;T&gt;` directly and call `absl&colon;&colon;SetFlag()`&semi; instead, use the flag&apos;s variable name (e&period;g&period; `FLAGS&lowbar;name`)&period; This function is thread&hyphen;safe, but is potentially expensive&period; Avoid setting flags in general, but especially within performance&hyphen;critical code&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
void
xref:absl/SetFlag-0d.adoc[SetFlag](
    xref:absl/Flag.adoc[absl::Flag&lt;T&gt;]* flag,
    T const& v);
----

[.small]#xref:absl/SetFlag-0d.adoc[_» more&period;&period;&period;_]#

Overload of `SetFlag()` to allow callers to pass in a value that is convertible to `T`&period; E&period;g&period;, use this overload to pass a &quot;const char&ast;&quot; when `T` is `std&colon;&colon;string`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename T,
    typename V&gt;
void
xref:absl/SetFlag-07.adoc[SetFlag](
    xref:absl/Flag.adoc[absl::Flag&lt;T&gt;]* flag,
    V const& v);
----

[.small]#xref:absl/SetFlag-07.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *flag*
| The flag to update&period;
| *v*
| The new value to assign to `flag`&period;
|===


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