---
name: "std::once_flag"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::once_flag/3cxx"
---

# std::once\_flag(3cxx)

Flag type used by std::call\_once.

## NAME

std::once\_flag - Flag type used by std::call\_once.

## SYNOPSIS

`#include <mutex>`

### Public Member Functions

**once\_flag** (const **once\_flag** &)=**delete**\
 Deleted copy constructor.  **once\_flag** & **operator=** (const **once\_flag** &)=**delete**\
 Deleted assignment operator.

### Friends

template\<**typename** \_Callable , typename... \_Args\> **void** **call\_once** (**once\_flag** &**\_\_once**, \_Callable &&\_\_f, **\_Args** &&... **\_\_args**)\
 Invoke a callable and synchronize with other calls using the same flag.

## Detailed Description

Flag type used by std::call\_once.

## Constructor & Destructor Documentation

### std::once\_flag::once\_flag (const once\_flag &)` [delete]`

Deleted copy constructor.

## Member Function Documentation

### once\_flag & std::once\_flag::operator= (const once\_flag &)` [delete]`

Deleted assignment operator.

## Friends And Related Symbol Documentation

### template\<typename \_Callable , typename... \_Args\> void call\_once (once\_flag & \_\_once, \_Callable && \_\_f, \_Args &&... \_\_args)` [friend]`

Invoke a callable and synchronize with other calls using the same flag.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
