mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
add observer_handler class
This commit is contained in:
parent
b3feb5945b
commit
3beafe953f
6 changed files with 72 additions and 13 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "delegates.hpp"
|
||||
#include "typedefs.hpp"
|
||||
#include "util/observer_handler.hpp"
|
||||
|
||||
enum class setting_format { simple, percent };
|
||||
|
||||
|
|
@ -47,9 +48,8 @@ public:
|
|||
if (callOnStart) {
|
||||
callback(value);
|
||||
}
|
||||
return std::shared_ptr<int>(new int(id), [this](int* id) { //-V508
|
||||
observers.erase(*id);
|
||||
delete id;
|
||||
return observer_handler([this, id]() {
|
||||
observers.erase(id);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue