|
ecor
|
Reference-counted smart pointer to an object managed by an async_arena.
More...
#include <ecor.hpp>
Public Member Functions | |
| async_ptr () noexcept=default | |
Default constructor creates a null async_ptr. | |
| async_ptr (async_ptr &&o) noexcept | |
| Move constructor and move assignment operator transfer ownership without modifying the reference count. | |
| async_ptr (async_ptr const &o) noexcept | |
| Copy constructor and copy assignment operator increment the reference count. | |
| async_ptr (std::nullptr_t) noexcept | |
Constructing from nullptr creates a null async_ptr. | |
| T * | get () const noexcept |
Get the raw pointer to the managed object, or nullptr if the async_ptr is null. | |
| operator bool () const noexcept | |
Explicit bool conversion operator returns true if the async_ptr is non-null. | |
| T & | operator* () const noexcept |
| Dereference operators return the managed object. More... | |
| T * | operator-> () const noexcept |
| Arrow operator returns a pointer to the managed object. More... | |
| async_ptr & | operator= (async_ptr &&o) noexcept |
Move assignment operator: release the current object (if any), transfer the control block pointer from the other async_ptr, and set the other async_ptr to null without modifying the reference count. | |
| async_ptr & | operator= (async_ptr const &o) noexcept |
Copy assignment operator: release the current object (if any), copy the control block pointer from the other async_ptr, and increment the reference count if the new control block is not null. | |
| void | reset () noexcept |
Reset the async_ptr to null, releasing the current object (if any) by decrementing the reference count and initiating async destruction if the count reaches zero. | |
| ~async_ptr () | |
| Destructor releases the current object (if any) by decrementing the reference count and initiating async destruction if the count reaches zero. | |
Friends | |
| template<typename , typename > | |
| struct | async_arena |
| bool | operator!= (async_ptr const &a, async_ptr const &b) noexcept |
| Comparison operators compare the control block pointers for inequality. More... | |
| bool | operator!= (async_ptr const &a, std::nullptr_t) noexcept |
| Comparison operators with nullptr compare the control block pointer to null. More... | |
| bool | operator== (async_ptr const &a, async_ptr const &b) noexcept |
| Comparison operators compare the control block pointers for equality. More... | |
| bool | operator== (async_ptr const &a, std::nullptr_t) noexcept |
| Comparison operators with nullptr compare the control block pointer to null. More... | |
Reference-counted smart pointer to an object managed by an async_arena.
When the last async_ptr is dropped, the async destroy protocol is initiated — the object is not immediately destructed but instead queued for asynchronous cleanup via the arena.
Copyable, movable, nullable. Dereferenceable via * and ->.
|
inlinenoexcept |
Dereference operators return the managed object.
Precondition: the async_ptr must be non-null.
|
inlinenoexcept |
Arrow operator returns a pointer to the managed object.
Precondition: the async_ptr must be non-null.
|
friend |
Comparison operators compare the control block pointers for inequality.
Two async_ptrs are not equal if they point to different control blocks (i.e., manage different objects), and equal otherwise.
|
friend |
Comparison operators with nullptr compare the control block pointer to null.
An async_ptr is not equal to nullptr if its control block pointer is not null.
|
friend |
Comparison operators compare the control block pointers for equality.
Two async_ptrs are equal if they point to the same control block (i.e., manage the same object), and not equal otherwise.
|
friend |
Comparison operators with nullptr compare the control block pointer to null.
An async_ptr is equal to nullptr if its control block pointer is null.