std::experi..._shared_ptr(3)
π NAME
std::experimental::atomic_shared_ptr β bestie, that's literally the whole name, it's std::experimental::atomic_shared_ptr π
Okay so real talk, this is the manual page for it, from the C++ Standard Library, and we're gonna get into it β¨
β¨ SYNOPSIS
First things first, where does it live? It's defined in header <experimental/atomic> π
template< class T > (concurrency TS)
class atomic_shared_ptr;
So the class template atomic_shared_ptr gives you thread-safe atomic pointer operations over a std::shared_ptr. No cap. And the glow-up here? It's a better alternative to the non-member shared_ptr atomic access functions π¦ like, genuinely, she ate π
πΈ MEMBER FUNCTIONS
Here's the whole cast of characters, and yes they're all public member functions π
constructorβ constructs anatomic_shared_ptrobject β¨operator=β stores a value into anatomic_shared_ptrobject πis_lock_freeβ checks if theatomic_shared_ptrobject is lock-free π¦storeβ atomically replaces the value of the atomic object with a non-atomic argument πloadβ atomically obtains the value of the atomic object βoperator shared_ptr<T>β loads a value from an atomic object πexchangeβ atomically replaces the value of the atomic object and obtains the value held previously π₯compare_exchange_weak/compare_exchange_strongβ atomically compares the value of the atomic object with a non-atomic argument and performs atomic exchange if equal, or atomic load if not π (yes those two are listed together, they're a package deal, iykyk)
No notes, she's iconic, go be thread-safe about it π«Ά
π source: cppreference.com, version 2024.06.10, and the original was std::experi..._shared_ptr(3) from the C++ Standard Libary β mwah, bye bestie π
π¦ 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