std::experi...ic_weak_ptr(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

std::experimental::atomic_weak_ptr β€” like, literally std::experimental::atomic_weak_ptr, that's the whole name bestie πŸ’…


🌸 SYNOPSIS 🌸

okay so first things first, this lives in header <experimental/atomic> β€” yes, the experimental one, she's a guest star 🧚

template< class T >                      (concurrency TS)
class atomic_weak_ptr;

The class template atomic_weak_ptr gives you thread-safe atomic pointer operations over a std::weak_ptr. That's it, that's the vibe πŸ¦‹


πŸŽ€ MEMBER FUNCTIONS πŸŽ€

  • constructor β€” constructs an atomic_weak_ptr object 🫢 (public member function)
  • operator= β€” stores a value into an atomic_weak_ptr object πŸ’– (public member function)
  • is_lock_free β€” checks if the atomic_weak_ptr object is lock-free πŸ‘‘ (public member function)
  • store β€” atomically replaces the value of the atomic object with a non-atomic argument πŸ”₯ (public member function)
  • load β€” atomically obtains the value of the atomic object ⭐ (public member function)
  • operator weak_ptr<T> β€” loads a value from an atomic object 🌈 (public member function)
  • exchange β€” atomically replaces the value of the atomic object and obtains the value held previously, like a little swap-and-grab situation πŸ™ˆ (public member function)
  • compare_exchange_weak β€” atomically compares the value of the atomic object with a non-atomic argument and performs atomic exchange if equal or atomic load if not πŸ’€ (public member function)
  • compare_exchange_strong β€” same deal as above: atomically compares the value of the atomic object with a non-atomic argument and performs atomic exchange if equal or atomic load if not β€” she's the strong one, no cap πŸ’œ (public member function)

ngl, the compare_exchange_weak and compare_exchange_strong descriptions got fused together in the original list β€” they're two separate member functions but they share that exact description, so that's how we're serving it πŸ“

and that's the whole page, bestie β€” this one's from the C++ Standard Library docs over at http://cppreference.com, dated 2024.06.10. go be lock-free and iconic πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from