VCV Rack API v2
|
A weak pointer to a subclass of WeakBase. More...
#include <weakptr.hpp>
Public Member Functions | |
WeakPtr () | |
WeakPtr (T *ptr) | |
WeakPtr (const WeakPtr &other) | |
WeakPtr & | operator= (const WeakPtr &other) |
~WeakPtr () | |
void | set (T *ptr) |
T * | get () const |
T * | operator-> () const |
T & | operator* () const |
operator T* () const | |
operator bool () const | |
Public Attributes | |
WeakHandle * | weakHandle = NULL |
A weak pointer to a subclass of WeakBase.
Weak pointers behave like raw pointers but can be accessed safely (returning nullptr) after the pointed object is deleted.
Example:
Foo* foo = new Foo; WeakPtr<Foo> weakFoo = foo; weakFoo.get(); // returns foo delete foo; weakFoo.get(); // returns nullptr
Not thread safe. In multithreaded environments, the object pointed to by the WeakPtr could be deleted at any time after obtaining its pointer from WeakPtr.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
WeakHandle* rack::WeakPtr< T >::weakHandle = NULL |