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

Returns the value (of type `T`) of an `absl&colon;&colon;Flag&lt;T&gt;` instance, by value&period; Do not construct an `absl&colon;&colon;Flag&lt;T&gt;` directly and call `absl&colon;&colon;GetFlag()`&semi; instead, refer to flag&apos;s constructed variable name (e&period;g&period; `FLAGS&lowbar;name`)&period; Because this function returns by value and not by reference, it is thread&hyphen;safe, but note that the operation may be expensive&semi; as a result, avoid `absl&colon;&colon;GetFlag()` within any tight loops&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
T
GetFlag(xref:absl/Flag.adoc[absl::Flag&lt;T&gt;] const& flag);
----

== Description

Example&colon;

&sol;&sol; FLAGS&lowbar;count is a Flag of type `int` int my&lowbar;count &equals; absl&colon;&colon;GetFlag(FLAGS&lowbar;count)&semi;

&sol;&sol; FLAGS&lowbar;firstname is a Flag of type `std&colon;&colon;string` std&colon;&colon;string first&lowbar;name &equals; absl&colon;&colon;GetFlag(FLAGS&lowbar;firstname)&semi;

== Return Value

The current value of `flag`&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *flag*
| The flag whose value to retrieve&period;
|===


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