|
| LWeak () noexcept=default |
| Creates an empty LWeak.
|
|
| LWeak (T *object) noexcept |
| Creates a reference for the given LObject, or initializes an empty LWeak if nullptr is passed.
|
|
| ~LWeak () noexcept |
| Destructor, removes the LWeak from the LObject references.
|
|
| LWeak (const LWeak< T > &other) noexcept |
| Copy constructor, assigns the LObject of another LWeak.
|
|
LWeak< T > & | operator= (const LWeak< T > &other) noexcept |
| Assignment operator, assigns the LObject of another LWeak.
|
|
T * | get () const noexcept |
| Gets a pointer to the LObject or nullptr if not set or the object has been destroyed.
|
|
| operator T* () const noexcept |
| Implicit conversion to raw pointer.
|
|
T * | operator-> () const noexcept |
| Access underlying object via pointer semantics.
|
|
UInt64 | count () const noexcept |
| Return the number of existing references to the current LObject.
|
|
void | reset (T *object=nullptr) noexcept |
| Replace the reference with another object.
|
|
void | setOnDestroyCallback (const OnDestroyCallback &callback) noexcept |
| Set the onDestroy callback function.
|
|
template<class T>
class Louvre::LWeak< T >
Weak reference to an LObject.
The LWeak class template provides a mechanism for creating weak pointer references to subclasses of LObject.
It is conceptually similar to std::weak_ptr
but is specifically tailored for LObject subclasses, avoiding the pointer indirection and associated performance overhead of the std::weak_ptr
thread-safe mechanisms.
When the object being referenced is destroyed, an optional on destroy callback event is emitted, and get() returns nullptr
.