diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 15:09:05 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-03 15:09:05 +0100 |
commit | a2607bffb1c0f8699021b1b4b3e54fa372e3ed0a (patch) | |
tree | 6ce416f4be55b9d8e3f73d6556450ee86f18774e /src/crepe/ValueBroker.hpp | |
parent | 83ce876b4c1b12c3654413515840f5f71907ea6c (diff) |
more WIP savemanager
Diffstat (limited to 'src/crepe/ValueBroker.hpp')
-rw-r--r-- | src/crepe/ValueBroker.hpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/crepe/ValueBroker.hpp b/src/crepe/ValueBroker.hpp index ef31c17..61f7f6c 100644 --- a/src/crepe/ValueBroker.hpp +++ b/src/crepe/ValueBroker.hpp @@ -8,19 +8,17 @@ namespace crepe { template <typename T> ValueBroker<T>::ValueBroker(T & value) : - value(value), - setter([] (T & value, const T & target) { + setter([&value] (const T & target) { value = std::move(target); }), - getter([] (T & value) -> const int & { + getter([&value] () -> const int & { return value; }) { } template <typename T> -ValueBroker<T>::ValueBroker(T & value, const setter_t & setter, const getter_t & getter) : - value(value), +ValueBroker<T>::ValueBroker(const setter_t & setter, const getter_t & getter) : setter(setter), getter(getter) { @@ -28,12 +26,12 @@ ValueBroker<T>::ValueBroker(T & value, const setter_t & setter, const getter_t & template <typename T> const T & ValueBroker<T>::get() { - return this->getter(this->value); + return this->getter(); } template <typename T> void ValueBroker<T>::set(const T & value) { - this->setter(this->value, value); + this->setter(value); } } |