Template Class ComponentWeakHandle

Class Documentation

template<typename T>
class ComponentWeakHandle

A weak reference to the component. Can be constructed from a ComponentHandle<T>

Public Functions

ComponentWeakHandle() = default

Constructs a null ComponentWeakHandle. lock() will always return empty.

inline ComponentWeakHandle(const ComponentHandle<T> &other)

Copy-constructs a new ComponentWeakHandle from other.

inline std::optional<ComponentHandle<T>> lock() const

Returns a new strong ComponentHandle<T> if the component the weak handle points to is still referenced by any other ComponentHandle<T>. An empty std::optional is returned otherwise.