std::experi...d_ptr::load(3)

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

πŸ’… std::experimental::atomic_shared_ptr::load

okay so bestie, welcome to the glow-up era of the C++ Standard Library docs 🌸 β€” this page lives in the C++ Standard Library and it's brought to you by cppreference.com. The whole thing is about std::experimental::atomic_shared_ptr::load, which, yes, is a mouthful, but we move. ✨


πŸŽ€ NAME

std::experimental::atomic_shared_ptr::load β€” literally just std::experimental::atomic_shared_ptr::load, the icon itself, no notes πŸ‘‘


πŸ¦‹ Synopsis

shared_ptr<T> load( std::memory_order order =
   std::memory_order_seq_cst ) const
   noexcept;

So what does she do? She atomically loads and returns the current value of the atomic_shared_ptr, and the memory gets affected according to whatever you passed in as order. That's it. That's the whole vibe. 🫢

⚠️ Heads up bestie, this is important: order must be one of std::memory_order_relaxed, std::memory_order_consume, std::memory_order_acquire or std::memory_order_seq_cst. Anything else? The behavior is undefined. Not "undefined-ish", not "well it depends" β€” undefined, periodt. πŸ’€ Don't test her.

πŸ’– Parameters

  • order β€” the memory order constraints you want to enforce. That's it. That's the parameter. Slay. πŸ’…

🌟 Remarks

All associated use_count increments are guaranteed to be performed as part of the atomic operation. no cap, that's a real guarantee, she said what she said ✨


🌈 Return value

The current value of the atomic_shared_ptr. πŸ’«


🧚 See also

  • std::atomic::load β€” loads a value from an atomic object (public member function)
  • 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)

πŸŽ€ and a lil note on that whole cluster: they specialize atomic operations for std::shared_ptr β€” that's a (function template) situation β€” and they're deprecated in C++20 and removed in C++26. So like… use them while they're still here bestie, they're lowkey on their way out πŸ˜­πŸ‘‹


and that's the page!! brought to you by cppreference.com, dated 2024.06.10 β€” catch you in the next one, mwah πŸ“πŸ’œπŸŽ€

πŸ“¦ where this page comes from