![]() |
Botcraft 1.21.4
|
Wrapper around a reference that will run a callback on destruct. More...
#include <Blackboard.hpp>
Public Member Functions | |
NotifyOnEndUseRef (T &r, const std::function< void()> &on_destruct_callback_) | |
~NotifyOnEndUseRef () | |
T & | ref () const & |
Reference getter. | |
T & | ref () const &&=delete |
Private Attributes | |
T & | _ref |
std::function< void()> | on_destruct_callback |
Wrapper around a reference that will run a callback on destruct.
T | Type of the reference |
Definition at line 14 of file Blackboard.hpp.
|
inline |
Definition at line 17 of file Blackboard.hpp.
|
inline |
Definition at line 18 of file Blackboard.hpp.
References Botcraft::NotifyOnEndUseRef< T >::on_destruct_callback.
|
inline |
Reference getter.
Only works on lvalue to prevent calling it on a temporary object (which would run the callback immediately instead of when going out of scope.
Definition at line 29 of file Blackboard.hpp.
References Botcraft::NotifyOnEndUseRef< T >::_ref.
|
delete |
|
private |
Definition at line 33 of file Blackboard.hpp.
Referenced by Botcraft::NotifyOnEndUseRef< T >::ref().
|
private |
Definition at line 34 of file Blackboard.hpp.
Referenced by Botcraft::NotifyOnEndUseRef< T >::~NotifyOnEndUseRef().