From a2607bffb1c0f8699021b1b4b3e54fa372e3ed0a Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 3 Nov 2024 15:09:05 +0100 Subject: more WIP savemanager --- src/crepe/ValueBroker.hpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/crepe/ValueBroker.hpp') 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 ValueBroker::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 -ValueBroker::ValueBroker(T & value, const setter_t & setter, const getter_t & getter) : - value(value), +ValueBroker::ValueBroker(const setter_t & setter, const getter_t & getter) : setter(setter), getter(getter) { @@ -28,12 +26,12 @@ ValueBroker::ValueBroker(T & value, const setter_t & setter, const getter_t & template const T & ValueBroker::get() { - return this->getter(this->value); + return this->getter(); } template void ValueBroker::set(const T & value) { - this->setter(this->value, value); + this->setter(value); } } -- cgit v1.2.3