L4Re Operating System Framework
Interface and Usage Documentation
|
Typed weak reference to an object of type T
.
More...
#include <weak_ref>
Additional Inherited Members | |
Public Member Functions inherited from cxx::H_list_item_t< Weak_ref_base > | |
H_list_item_t () | |
Constructor. | |
~H_list_item_t () noexcept | |
Destructor. | |
Typed weak reference to an object of type T
.
T | The type of the referenced object. |
A weak reference is a reference that is invalidated when the referenced object is about to be deleted. All weak references to an object are kept in a linked list (see Weak_ref_base::List) and all the weak references are iterated and reset by the Weak_ref_base::List destructor or Weak_ref_base::List::reset().
The type T
must provide two methods that handle the housekeeping of weak references: remove_weak_ref(Weak_ref_base *)
and add_weak_ref(Weak_ref_base *)
. These functions must handle the insertion and removal of the weak reference into the respective Weak_ref_base::List object. For convenience one can use the cxx::Weak_ref_obj as a base class that handles weak references for you.
For example: