Forward declaration of weak ownership. More...
#include <StormByte/safe/pointers.hxx>
Public Types | |
| using | element_type = T |
| Pointee type. | |
Public Member Functions | |
| Weak () noexcept | |
| Construct an empty observer. | |
| Weak (std::nullptr_t null) noexcept | |
| Construct an empty observer from null. | |
| template<class U> requires Type::ConvertibleTo<U*, T*> | |
| Weak (const Shared< U > &owner) noexcept | |
| Observe an owner. | |
| Weak (const Weak &other) noexcept | |
| Copy an observer. | |
| Weak (Weak &&other) noexcept | |
| Take an observer. | |
| Weak & | operator= (const Weak &other) noexcept |
| Copy an observer. | |
| Weak & | operator= (Weak &&other) noexcept |
| Take an observer. | |
| ~Weak () | |
| Drop this observer. | |
| Shared< T > | lock () const noexcept |
| Lock the control block. | |
| bool | expired () const noexcept |
| Test whether the object is already gone. | |
| long | use_count () const noexcept |
| Return the number of owners. | |
| void | reset () noexcept |
| Drop this observer. | |
| void | swap (Weak &other) noexcept |
| Exchange observers. | |
| template<class U> | |
| bool | owner_before (const Weak< U > &other) const noexcept |
| Order control blocks by identity. | |
| template<class U> | |
| bool | owner_before (const Shared< U > &other) const noexcept |
| Order this control block against an owner. | |
Friends | |
| template<class U> | |
| class | Weak |
| template<class U> | |
| class | Shared |
| template<class U> | |
| class | EnableSharedFromThis |
Forward declaration of weak ownership.
Non-owning observer of a Shared control block.
| T | Pointee. |
| T | Pointee type. void is allowed. |
Construct it only from a Shared. lock returns a Shared, or an empty owner when the object is gone.
| using StormByte::Safe::Weak< T >::element_type = T |
Pointee type.
|
noexcept |
Construct an empty observer.
|
noexcept |
Construct an empty observer from null.
| null | Null pointer constant. |
|
noexcept |
Observe an owner.
| U | Source pointee. U* must convert to T*. |
| owner | Owner to watch. |
|
noexcept |
Copy an observer.
| other | Observer to copy. |
|
noexcept |
Take an observer.
other is left empty.
| other | Observer to take. |
| StormByte::Safe::Weak< T >::~Weak | ( | ) |
Drop this observer.
The last observer frees an expired block.
|
noexcept |
|
noexcept |
Lock the control block.
|
noexcept |
Copy an observer.
| other | Observer to copy. |
|
noexcept |
Take an observer.
other is left empty.
| other | Observer to take. |
|
noexcept |
Order this control block against an owner.
| U | Other pointee. |
| other | Owner. |
other.
|
noexcept |
Order control blocks by identity.
| U | Other pointee. |
| other | Other observer. |
other.
|
noexcept |
Drop this observer.
|
noexcept |
Exchange observers.
| other | Observer to exchange with. |
|
noexcept |
Return the number of owners.
|
friend |
|
friend |
|
friend |