[#absl-once_flag]
= xref:absl.adoc[absl]::once&lowbar;flag
:relfileprefix: ../
:mrdocs:

Objects of this type are used to distinguish calls to `call&lowbar;once()` and ensure the provided function is only invoked once across all threads&period; This type is not copyable or movable&period; However, it has a `constexpr` constructor, and is safe to use as a namespace&hyphen;scoped global variable&period;

== Synopsis

Declared in `&lt;absl&sol;base&sol;call&lowbar;once&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class once&lowbar;flag;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/once_flag/2constructor-0c.adoc[`once&lowbar;flag`]         [.small]#[constructor]#
| Constructors
| xref:absl/once_flag/operator_assign.adoc[`operator&equals;`]  [.small]#[deleted]#
| Deleted&colon; `once&lowbar;flag` is not copy&hyphen;assignable&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/call_once.adoc[`call&lowbar;once`]
| For all invocations using a given `once&lowbar;flag`, invokes a given `fn` exactly once across all threads&period; The first call to `call&lowbar;once()` with a particular `once&lowbar;flag` argument (that does not throw an exception) will run the specified function with the provided `args`&semi; other calls with the same `once&lowbar;flag` argument will not run the function, but will wait for the provided function to finish running (if it is still running)&period;
|===


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