std::experi...r::exchange(3)
πΈ NAME πΈ
okay so bestie, this is the C++ Standard Libary manual page for std::experimental::atomic_weak_ptr::exchange, and the NAME line is literally std::experimental::atomic_weak_ptr::exchange - std::experimental::atomic_weak_ptr::exchange β the repetition is iconic, we respect it. π It's the atomic exchange situation for a weak pointer, and we're gonna get through every detail together, no cap.
π¦ Synopsis π¦
weak_ptr<T> exchange( weak_ptr<T> desired, std::memory_order order =
std::memory_order_seq_cst ) noexcept;
This atomically replaces the underlying weak_ptr with desired. The operation is a read-modify-write operation. Memory is affected according to the value of order. Slay. β¨
π Parameters π
desiredβ value to assign. literally the new value going in. πorderβ memory order constraints to enforce. yes bestie, the memory-order vibe check. π
π Return value π
The value of the atomic variable before the call. so you get the old value back, periodt. π«Ά
π Remarks π
- All changes to the
atomic_weak_ptrobject itself, and all associateduse_countincrements, are guaranteed to be performed atomically. π₯ - Associated
use_countdecrements take place after the atomic operation, but are not required to be part of it. π - Any associated destruction or deallocation operations take place after the atomic operation and are not part of it. π
π See also π
the see-also crew, all present and accounted for:
std::atomic_is_lock_free(std::shared_ptr)std::atomic_load(std::shared_ptr)std::atomic_load_explicit(std::shared_ptr)std::atomic_store(std::shared_ptr)std::atomic_store_explicit(std::shared_ptr)std::atomic_exchange(std::shared_ptr)std::atomic_exchange_explicit(std::shared_ptr)std::atomic_compare_exchange_weak(std::shared_ptr)std::atomic_compare_exchange_strong(std::shared_ptr)std::atomic_compare_exchange_weak_explicit(std::shared_ptr)std::atomic_compare_exchange_strong_explicit(std::shared_ptr)
Also in the see-also zone, verbatim: specializes atomic operations for std::shared_ptr, (function template), (deprecated in C++20), (removed in C++26). The deprecated/removed tags are real caveats, bestie β don't ignore them. π
signing off with source http://cppreference.com, version/date 2024.06.10, and page std::experi...r::exchange(3) β bye bestie, go be atomic ππ¦
π¦ 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