std::atomic_ref::fetch_max(3)
π std::atomic_ref::fetch_max(3) π
okay so bestie, this page is from the C++ Standard Libary manual β manual name folded in right here at the top, periodt. We're talking about std::atomic_ref::fetch_max, and the vibe is atomic maximum with zero chill. π
π NAME π
std::atomic_ref::fetch_max β std::atomic_ref::fetch_max
yes, the name section said it twice. she's consistent, okay? π
β¨ Synopsis β¨
member only of atomic_ref<Integral > specializations
T fetch_max( T arg, std::memory_order order =
std::memory_order_seq_cst ) const
(1) (since C++26)
noexcept;
member only of atomic_ref<T*> partial specialization
T* fetch_max( T* arg, std::memory_order order =
std::memory_order_seq_cst ) const
(2) (since C++26)
noexcept;
so what does it actually do, bestie? It atomically replaces the current value of the referenced object with the result of std::max of the value and arg. That is, it performs atomic maximum operation. The operation is a read-modify-write operation. Memory is affected according to the value of order.
β οΈ for overload 2): if the pointers point to different complete objects (or subobjects thereof), pointer comparison does not establish a strict weak ordering. that's the spicy caveat, bestie.
πΈ Parameters πΈ
argβ the other argument ofstd::maxorderβ memory order constraints to enforce
π¦ Return value π¦
The value immediately preceding the effects of this function in the modification order of *this. that's what you get back, no cap. β¨
π Notes π
feature-test macro tea β:
- Feature-test macro:
__cpp_lib_atomic_min_maxβ Value:202403Lβ Std:C++26β Feature:Atomic minimum/maximum
π Example π
This section is incomplete.
Reason: no example.
not me staring at an empty example section ππ
π§ Category π§
* Todo no example
mwah π β source/version: http://cppreference.com, date: 2024.06.10, page: std::atomic_ref::fetch_max(3). that's the whole footer tea, folded into a cute little sign-off. π«Ά
π¦ 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