std::experi...d_ptr::load(3)
π 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:ordermust be one ofstd::memory_order_relaxed,std::memory_order_consume,std::memory_order_acquireorstd::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
- 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