---
name: "std::once_flag"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::once_flag"
---

# std::once\_flag(3)

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.

References **std::\_\_invoke()**, and **std::forward()**.

## Author

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