std::atomic::atomic(3)
π std::atomic::atomic(3) π
Okay bestie, this is the std::atomic::atomic(3) page from the C++ Standard Libary β yes, that's how the header spells it, and we are not fixing it, we are simply reading it. π
No cap, this is literally the constructor page for std::atomic, and it's giving "tiny page, big lifetime decisions." Slay. π
π NAME π
std::atomic::atomic β and that is exactly std::atomic::atomic. No mysterious alias, no extra name, just the constructor showing up with main character energy. π
β¨ Synopsis β¨
Here are the signatures, bestie β keep these exactly as written:
atomic() noexcept = default;
- since C++11
- until C++20
constexpr atomic() noexcept(std::is_nothrow_default_constructible_v<T>);
(1)since C++20
constexpr atomic( T desired ) noexcept;
(2)since C++11
atomic( const atomic& ) = delete;
(3)since C++11
Constructs a new atomic variable. π«Ά
- (until C++20) The default constructor is trivial: no initialization takes place other than zero initialization of static and thread-local objects.
std::atomic_initmay be used to complete initialization. (since C++20) Value-initializes the underlying object (i.e. withT()). The initialization is not atomic. The program is ill-formed ifstd::is_default_constructible_v<T>is false. - Initializes the underlying object with
desired. The initialization is not atomic. - Atomic variables are not
CopyConstructible.
π Parameters π
desiredβ value to initialize with
π¦ Notes π¦
Until C++20, the default-initialized std::atomic<T> does not contain a T object, and its only valid uses are destruction and initialization by std::atomic_init, see LWG issue 2334.
And that's the whole vibe check, bestie. This page came from http://cppreference.com, dated 2024.06.10, and it's the std::atomic::atomic(3) page β so now you know, and honestly? iconic. ππ
π¦ 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