|
| | Shared () noexcept=default |
| | Empty owner.
|
| |
| | Shared (std::nullptr_t) noexcept |
| | Empty owner from nullptr.
|
| |
template<class U >
requires Type::SameAs<U, T> || Type::DerivedFrom<U, T> |
| | Shared (const Shared< U > &other) noexcept |
| | Share ownership with other.
|
| |
template<class U >
requires Type::SameAs<U, T> || Type::DerivedFrom<U, T> |
| | Shared (Shared< U > &&other) noexcept |
| | Take ownership from other.
|
| |
| | Shared (const Shared &) noexcept=default |
| | Copy constructor.
|
| |
| | Shared (Shared &&) noexcept=default |
| | Move constructor.
|
| |
| | Shared (const Weak< T > &weak) |
| | Take ownership from weak.
|
| |
| Shared & | operator= (const Shared &) noexcept=default |
| | Copy assignment.
|
| |
| Shared & | operator= (Shared &&) noexcept=default |
| | Move assignment.
|
| |
| | ~Shared ()=default |
| | Destructor.
|
| |
| T * | get () const noexcept |
| | Raw pointer, or null.
|
| |
| T & | operator* () const |
| | Dereference.
|
| |
| T * | operator-> () const noexcept |
| | Member access.
|
| |
| | operator bool () const noexcept |
| | Whether this owner holds an object.
|
| |
| | operator std::shared_ptr< T > () const noexcept |
| | Same control block as std::shared_ptr.
|
| |
| long | use_count () const noexcept |
| | Number of Shared sharing this object.
|
| |
| void | reset () noexcept |
| | Drop this owner's reference.
|
| |
| void | swap (Shared &other) noexcept |
| | Exchange owners with other.
|
| |
| template<class U > |
| bool | owner_before (const Shared< U > &other) const noexcept |
| | Ownership order, same as std::shared_ptr::owner_before.
|
| |
| template<class U > |
| bool | owner_before (const Weak< U > &other) const noexcept |
| | Ownership order against a Weak.
|
| |
|
| template<class U > |
| class | Shared |
| |
| template<class U > |
| class | Weak |
| |
| bool | operator== (const Shared &lhs, std::nullptr_t) noexcept |
| | Equality with null.
|
| |
| bool | operator!= (const Shared &lhs, std::nullptr_t) noexcept |
| | Inequality with null.
|
| |
| bool | operator== (std::nullptr_t, const Shared &rhs) noexcept |
| | Equality with null.
|
| |
| bool | operator!= (std::nullptr_t, const Shared &rhs) noexcept |
| | Inequality with null.
|
| |
| bool | operator== (const Shared &lhs, const Shared &rhs) noexcept |
| | Same stored pointer.
|
| |
| auto | operator<=> (const Shared &lhs, const Shared &rhs) noexcept |
| | Order of the stored pointers.
|
| |
| void | swap (Shared &left, Shared &right) noexcept |
| | Exchange left and right.
|
| |
| template<class U , class... Args> |
| Shared< U > | Heap::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 |
| |
template<class T>
class StormByte::Shared< T >
Shared owner of a T allocated on Base's heap.
- Template Parameters
-
Complements std::shared_ptr. It does not replace it. Use std::shared_ptr when the object does not cross a DLL. Use Shared when the object and its control block must be freed on Base's heap.
Construct the exact type with Heap::MakeShared. Construct a derived type with Shared::MakePointer. The daily operations match std::shared_ptr. There is no constructor from a raw pointer or from std::shared_ptr, and no release. Implicit conversion to std::shared_ptr<T> keeps Base's deleter, so a std::shared_ptr parameter does not need a new signature. There is no conversion back.