std::atomic::fetch_or(3)
π NAME π
NAME vibe check: std::atomic::fetch_or β std::atomic::fetch_or. This is the std::atomic::fetch_or(3) page from the C++ Standard Libary manual, and it's a member only of atomic<Integral > specializations. slay, bestie π
.
π Synopsis π
okay so here's the synopsis, copied exactly because we do not play with signatures:
member only of atomic<Integral > specializations
T fetch_or( T arg, std::memory_order order =
(1) (since C++11)
std::memory_order_seq_cst ) noexcept;
T fetch_or( T arg, std::memory_order order =
std::memory_order_seq_cst ) volatile
(2) (since C++11)
noexcept;
So overload (1) is the regular one β noexcept, since C++11. Overload (2) is the volatile one β also noexcept, also since C++11. Both take T arg and std::memory_order order = std::memory_order_seq_cst.
Atomically replaces the current value with the result of bitwise OR of the value and arg. It's a read-modify-write operation. Memory is affected according to the value of order. iykyk β¨
π¨ technical caveat, no cap: it is deprecated if std::atomic<T>::is_always_lock_free is false and β since C++20 β overload (2) participates in overload resolution. that's the fine print, bestie.
πΈ Parameters πΈ
argβ the other argument of bitwise OR π«Άorderβ memory order constraints to enforce β¨
π Return value π
The value immediately preceding the effects of this function in the modification order of *this. that's the return value, periodt π
π See also π
the cross-refs are giving:
atomic_fetch_or replaces the atomic object with the result
of bitwise OR
atomic_fetch_or_explicit with a non-atomic argument and obtains the
previous value
(C++11) of the atomic
(C++11) (function template)
mwah π β source: http://cppreference.com; version/date: 2024.06.10; page: std::atomic::fetch_or(3). now go atomically slay, 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