MT Core (C++)
Core library for replacing C++ standard in project usage
|
Thread-local reference counted pointer Not thread safe, don't share Reference counting for cleaning up memory Supports weak references as well. More...
#include <rc.hpp>
Public Member Functions | |
T & | operator* () |
Dereferences pointer. | |
const T & | operator* () const |
Dereferences pointer. | |
T * | operator-> () |
Dereferences pointer. | |
const T * | operator-> () const |
Dereferences pointer. | |
bool | operator== (const Rc &other) const |
Compares to a pointer. | |
bool | operator== (T *other) const |
Compares to a pointer. | |
bool | operator== (const T *other) const |
Compares to a pointer. | |
bool | valid () const |
Checks if is valid. | |
operator bool () const | |
Checks if is valid. | |
template<typename... Args> | |
Result< void, AllocationError > | init (Allocator &alloc, Args... args) |
Initializes a reference counter to point to a new entity. | |
Result< Rc, RcError > | acquire () |
Tries to acquire another strong reference Will return either another strong reference or an error. | |
void | release (Allocator &alloc) |
Releases a reference. | |
void | deinit (Allocator &alloc) |
Same as release. | |
Result< WeakRc< T >, RcError > | weak () |
Attempts to get a weak reference. | |
Public Attributes | |
impl::ThreadLocalRefCount< T > * | rc = nullptr |
Thread-local reference counted pointer Not thread safe, don't share Reference counting for cleaning up memory Supports weak references as well.
T | Type pointed to |
|
inlinenodiscard |
Tries to acquire another strong reference Will return either another strong reference or an error.
Definition at line 243 of file rc.hpp.
|
inline |
|
inlinenodiscard |
Initializes a reference counter to point to a new entity.
Args | Types of constructor arguments |
alloc | Allocator for initial allocation |
args | Arguments to use for construction |
Definition at line 219 of file rc.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inline |
|
inlinenodiscard |
|
inline |
impl::ThreadLocalRefCount<T>* mtcore::Rc< T >::rc = nullptr |