std::atomic::load(3)
π NAME π
okay so bestie, this is the std::atomic::load page from the C++ Standard Libary manual β yes, that's the manual name up top, and we're folding it in here instead of copy-pasting the whole header line. The name is literally std::atomic::load, and the one-line description is also std::atomic::load. That's the whole name. π
β¨ Synopsis β¨
The signatures, copied exactly so nobody comes for me:
T load( std::memory_order order
(1) (since C++11)
= std::memory_order_seq_cst ) const noexcept;
T load( std::memory_order order
(2) (since C++11)
= std::memory_order_seq_cst ) const volatile noexcept;
So both overloads are (since C++11), both take a std::memory_order order that defaults to std::memory_order_seq_cst, overload (1) is const noexcept, and overload (2) is const volatile noexcept. Slay. β¨
What it does: it atomically loads and returns the current value of the atomic variable. Memory is affected according to the value of order. That's the whole vibe.
β οΈ warning bestie: iforderis one ofstd::memory_order_releaseandstd::memory_order_acq_rel, the behavior is undefined. Not "maybe weird" β undefined. Do not do it. π
Also, it is deprecated if std::atomic<T>::is_always_lock_free is false and (since C++20) overload (2) participates in overload resolution. So that combo is giving deprecated energy. π«
π Parameters π
orderβ memory order constraints to enforce. That's it. That's the parameter. π
π¦ Return value π¦
The current value of the atomic variable. Periodt. π
π See also π
operator Tβ loads a value from an atomic object (public member function)atomic_loadβ (C++11)atomic_load_explicitβ atomically obtains the value stored in an atomic object (function template) (C++11)
mwah π β source: http://cppreference.com, version/date: 2024.06.10, page: std::atomic::load(3). byeee π¦
π¦ 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