std::atomic...:atomic_flag(3)
π NAME π
okay so we're in the C++ Standard Libary manual (yes, that's the spelling in the header, no cap π«Ά), and this page is std::atomic...:atomic_flag(3). The NAME line is literally:
std::atomic_flag::atomic_flag - std::atomic_flag::atomic_flag
yes bestie, same string twice β she's giving main character energy π iconic behavior, honestly.
β¨ Synopsis β¨
This constructor lives in header <atomic>, and here's the exact synopsis, copied with love:
Defined in header <atomic>
atomic_flag() noexcept = default; (since C++11)
(1) (until C++20)
constexpr atomic_flag() noexcept; (since C++20)
atomic_flag( const atomic_flag& ) = delete; (2) (since C++11)
This thing constructs a new std::atomic_flag. That's the whole vibe. Now the numbered tea:
- 1) Trivial default constructor, initializes
std::atomic_flagto unspecified state. (until C++20) - 1) Initializes
std::atomic_flagto clear state. (since C++20) - 2) The copy constructor is deleted;
std::atomic_flagis not copyable.
So likeβ¦ if you were thinking about copying one, don't π the copy constructor is literally = delete. She said not copyable and she meant it.
Also, std::atomic_flag can be value-initialized to clear state with the expression ATOMIC_FLAG_INIT. And for an atomic_flag with static storage duration, this guarantees static initialization: the flag can be used in constructors of static objects. That's a very specific little power move, and we respect it π«‘β¨.
π See also π
ATOMIC_FLAG_INITβ initializes anstd::atomic_flagtofalse(C++11) (macro constant).
mwah π source is http://cppreference.com, version/date 2024.06.10, page std::atomic...:atomic_flag(3) β go forth and flag your atomics, bestie ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms