Forward declaration of shared ownership. More...
#include <StormByte/safe/pointers.hxx>
Public Types | |
| using | element_type = T |
| Pointee type. | |
| using | weak_type = Weak<T> |
| Matching observer. | |
Public Member Functions | |
| Shared () noexcept | |
| Construct an empty owner. | |
| Shared (std::nullptr_t null) noexcept | |
| Construct an empty owner from null. | |
| template<class U> requires Type::ConvertibleTo<U*, T*> | |
| Shared (const Shared< U > &other) noexcept | |
| Share ownership with another owner. | |
| template<class U> requires Type::ConvertibleTo<U*, T*> | |
| Shared (Shared< U > &&other) noexcept | |
| Take ownership from another owner. | |
| Shared (const Shared &other) noexcept | |
| Copy an owner. | |
| Shared (Shared &&other) noexcept | |
| Take an owner. | |
| Shared (const Weak< T > &weak) | |
| Lock an observer. | |
| Shared & | operator= (const Shared &other) noexcept |
| Share ownership. | |
| Shared & | operator= (Shared &&other) noexcept |
| Take ownership. | |
| ~Shared () | |
| Drop this owner. | |
| T * | get () const noexcept |
| Return the stored pointer. | |
| std::add_lvalue_reference_t< T > | operator* () const noexcept |
| Dereference the stored pointer. | |
| T * | operator-> () const noexcept |
| Access a member of the pointee. | |
| operator bool () const noexcept | |
| Test whether this owner holds an object. | |
| long | use_count () const noexcept |
| Return the number of owners. | |
| void | reset () noexcept |
| Drop this owner. | |
| void | swap (Shared &other) noexcept |
| Exchange owners. | |
| template<class U> | |
| bool | owner_before (const Shared< U > &other) const noexcept |
| Order control blocks by identity. | |
| template<class U> | |
| bool | owner_before (const Weak< U > &other) const noexcept |
| Order this control block against an observer. | |
| STORMBYTE_FORCE_INLINE | operator std::shared_ptr< T > () const |
| Copy the owner into caller-owned STL storage. | |
Static Public Member Functions | |
| template<class Target, class... Args> requires Type::SameAs<Target, T> || Type::DerivedFrom<Target, T> | |
| static Shared< T > | MakePointer (Args &&... args) |
Allocate Target on Base's heap and own it as T. | |
Friends | |
| template<class U> | |
| class | Shared |
| template<class U> | |
| class | Weak |
| template<class U> | |
| class | AtomicShared |
| template<class U, class... Args> | |
| Shared< U > | MakeShared (Args &&...) |
| template<class X, class Y> | |
| Shared< X > | StaticPointerCast (const Shared< Y > &) noexcept |
| template<class X, class Y> | |
| Shared< X > | DynamicPointerCast (const Shared< Y > &) noexcept |
| template<class X, class Y> | |
| Shared< X > | ConstPointerCast (const Shared< Y > &) noexcept |
| template<class X, class Y> | |
| Shared< X > | ReinterpretPointerCast (const Shared< Y > &) noexcept |
Forward declaration of shared ownership.
Shared owner of an object allocated on Base's heap.
| T | Pointee. |
| T | Pointee type. void is allowed, as in std::shared_ptr<void>. |
The control block is a Detail::Control allocated with Heap::Allocate. Copying a Shared copies that pointer. There is no std::shared_ptr inside. There is no constructor from a raw pointer, from std::shared_ptr or from std::unique_ptr.
| using StormByte::Safe::Shared< T >::element_type = T |
Pointee type.
| using StormByte::Safe::Shared< T >::weak_type = Weak<T> |
Matching observer.
|
noexcept |
Construct an empty owner.
|
noexcept |
Construct an empty owner from null.
| null | Null pointer constant. |
|
noexcept |
Share ownership with another owner.
| U | Source pointee. U* must convert to T*. |
| other | Owner to share. |
|
noexcept |
Take ownership from another owner.
| U | Source pointee. U* must convert to T*. |
| other | Owner to take. |
|
noexcept |
|
noexcept |
|
explicit |
Lock an observer.
| weak | Observer of a live control block. |
| ExpiredWeakPointerError | weak is empty or expired. |
| StormByte::Safe::Shared< T >::~Shared | ( | ) |
Drop this owner.
The last owner destroys the object.
|
noexcept |
Return the stored pointer.
|
static |
Allocate Target on Base's heap and own it as T.
| Target | Concrete type. It is T or derived from T. |
| Args | Constructor argument types. |
| args | Arguments forwarded to Target. |
Target's. | AllocationError | The block could not be allocated. |
|
explicitnoexcept |
Test whether this owner holds an object.
|
inlineexplicit |
Copy the owner into caller-owned STL storage.
|
noexcept |
Dereference the stored pointer.
T is void, so the class can be formed.
|
noexcept |
Access a member of the pointee.
|
noexcept |
|
noexcept |
|
noexcept |
Order control blocks by identity.
| U | Other pointee. |
| other | Other owner. |
other.
|
noexcept |
Order this control block against an observer.
| U | Other pointee. |
| other | Observer. |
other.
|
noexcept |
Drop this owner.
|
noexcept |
Exchange owners.
| other | Owner to exchange with. |
|
noexcept |
Return the number of owners.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |