MT Core (C++)
Core library for replacing C++ standard in project usage
|
Automic Reference Count. More...
#include <arc.hpp>
Public Member Functions | |
T * | operator-> () |
Dereferences an Arc pointer. | |
const T * | operator-> () const |
Dereferences an Arc pointer. | |
T & | operator* () |
Dereferences an Arc pointer. | |
const T & | operator* () const |
Dereferences an Arc pointer. | |
bool | operator== (const Arc &o) const |
Checks if an Arc is equivalent to another Arc. | |
bool | operator== (T *other) const |
Checks if an Arc is equivalent to a pointer (used for nullptr checks) | |
bool | operator== (const T *other) const |
Checks if an Arc is equivalent to a pointer (used for nullptr checks) | |
bool | valid () const |
Checks if an Arc is valid (it points to something, and that something still exists) | |
operator bool () const | |
Checks if an Arc is valid (it points to something, and that something still exists) | |
template<typename... Args> | |
Result< void, AllocationError > | init (Allocator &alloc, Args... args) |
Tries to initialize an ARC to point to a new object. | |
Result< Arc, ArcError > | acquire (Allocator &alloc) |
Acquires a new Arc reference (increments ref count by 1) | |
void | release (Allocator &alloc) |
Releases an Arc reference (decrements ref count by 1) | |
void | deinit (Allocator &alloc) |
Result< WeakArc< T >, ArcError > | weak () |
Tries to get a weak pointer. | |
Public Attributes | |
impl::RefCount< impl::RefCount< T > > * | rc = nullptr |
Automic Reference Count.
A thread-safe reference count (basically a shared pointer replacement) Arc holds strong references Unlike std::shared_ptr, you must acquire() and release() manually (use mtdefer)
T | Type of data pointed to |
|
inlinenodiscard |
Acquires a new Arc reference (increments ref count by 1)
alloc | Allocator for new pointer allocation |
Definition at line 308 of file arc.hpp.
|
inline |
Definition at line 343 of file arc.hpp.
|
inlinenodiscard |
Tries to initialize an ARC to point to a new object.
Args | Constructor argument types |
alloc | Allocator for memory allocation |
args | Constructor arguments |
Definition at line 282 of file arc.hpp.
|
inlinenodiscard |
Checks if an Arc is valid (it points to something, and that something still exists)
Definition at line 272 of file arc.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
Checks if an Arc is equivalent to a pointer (used for nullptr checks)
|
inlinenodiscard |
Checks if an Arc is equivalent to a pointer (used for nullptr checks)
|
inline |
|
inlinenodiscard |
|
inline |
impl::RefCount<impl::RefCount<T> >* mtcore::thread::Arc< T >::rc = nullptr |