std::experi...r::operator=(3)

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

πŸ’… NAME πŸ’…

std::experimental::atomic_weak_ptr::operator= β€” okay so this is literally the assignment operator for std::experimental::atomic_weak_ptr, and yes bestie, it's giving very niche, very C++ Standard Libary (that's the manual name, not my typo, I promise 🫢), very "you either know or you don't" energy. iykyk.


✨ SYNOPSIS ✨

void operator=( weak_ptr<T> desired ) noexcept;    (1)
void operator=( const atomic_weak_ptr& ) = delete; (2)

okay so there's exactly two of these and they are NOT the same vibe:

  1. the real one β€” atomically assigns a value desired to the atomic variable. Equivalent to store(desired). slay. ✨
  2. the deleted one β€” atomic variables are not CopyAssignable. so this overload is = delete and it is very much not invited to the party πŸ’€

πŸŽ€ PARAMETERS πŸŽ€

  • desired β€” the value to assign. that's it, that's the whole parameter. she's simple, she's iconic.

🌸 NOTES 🌸

okay here's the tea πŸ‘‘ β€” unlike most assignment operators (which hand you back a reference so you can chain them like a = b = c), the assignment operators for atomic_weak_ptr return void. so no chaining, no sneaky return value, just vibes and completion. periodt.

πŸ¦‹ Remarks πŸ¦‹

  • All changes to the atomic_weak_ptr object itself, and all associated use_count increments, are guaranteed to be performed atomically. no cap, that's the whole point πŸ”₯
  • Associated use_count decrements take place after the atomic operation, but they are not required to be part of it. so they're like, adjacent to the main character moment, not in it.
  • Any associated destruction or deallocation operations take place after the atomic operation and are not part of it either. they show up fashionably late πŸ™ˆ

⭐ SEE ALSO ⭐

  • constructor β€” constructs an atomic_weak_ptr object (public member function)
  • store β€” atomically replaces the value of the atomic object with a non-atomic argument (public member function)

aaand the whole std::shared_ptr atomic operations crew, which specializes atomic operations for std::shared_ptr (function template) β€” here's the full roll call, no one gets left out bestie πŸ’œ:

  • 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)
⚠️ heads up: some of that last group is (deprecated in C++20) and some is (removed in C++26), so check before you build your whole personality around them 😭

okay that's the whole page, we ate and left no crumbs πŸ“. this gem came from http://cppreference.com, dated 2024.06.10, and it's page std::experi...r::operator=(3) β€” see you in the next manpage, mwah πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from