MT Core (C++)
Core library for replacing C++ standard in project usage
|
Weak Automic Reference Count. More...
#include <arc.hpp>
Public Member Functions | |
Result< Arc< T >, ArcError > | obtain (Allocator &alloc) |
Tries to obtain a strong reference to what's pointed at. | |
void | deinit (Allocator &alloc) |
Deinitializes a weak pointer (may Result in memory cleanup if last weak counter) | |
bool | valid () const |
Checks if a weak pointer is "valid" as in it's set to point to something Does NOT check if the referenced object is still alive (use obtain for that) | |
Result< WeakArc, ArcError > | copy () |
Tries to copy a weak reference. | |
Public Attributes | |
impl::RefCount< impl::RefCount< T > > * | rc = nullptr |
Weak Automic Reference Count.
A thread-safe weak reference count (basically a shared pointer replacement) WeakArc holds weak references. References must be upgraded to strong references before dereferencing Unlike std::weak_ptr, you must copy() and denit() manually (use mtdefer)
T | Type of data pointed to |
|
inline |
Tries to copy a weak reference.
Definition at line 180 of file arc.hpp.
|
inline |
Result< Arc< T >, ArcError > mtcore::thread::WeakArc< T >::obtain | ( | Allocator & | alloc | ) |
|
inlinenodiscard |
impl::RefCount<impl::RefCount<T> >* mtcore::thread::WeakArc< T >::rc = nullptr |