From: Mikko Rasa Date: Sat, 29 Oct 2022 17:20:55 +0000 (+0300) Subject: Use template lambdas to avoid repetition of types X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6a5d5f8f7bab46c2567752f7bbabca075b926ce3;p=libs%2Fgame.git Use template lambdas to avoid repetition of types --- diff --git a/source/game/eventbus.h b/source/game/eventbus.h index e096635..c78cb0d 100644 --- a/source/game/eventbus.h +++ b/source/game/eventbus.h @@ -23,7 +23,7 @@ struct EventDispatcher { handlers.emplace_back(obs, std::move(cb)); } void remove_observer(EventObserver *obs) - { std::erase_if(handlers, [obs](const Handler &h){ return h.observer==obs; }); } + { std::erase_if(handlers, [obs](auto &h){ return h.observer==obs; }); } void dispatch(const T &) const; }; diff --git a/source/game/transformpropagator.cpp b/source/game/transformpropagator.cpp index 73ecf64..631e529 100644 --- a/source/game/transformpropagator.cpp +++ b/source/game/transformpropagator.cpp @@ -12,8 +12,8 @@ TransformPropagator::TransformPropagator(Stage &s): System(s), observer(s.get_event_bus()) { - observer.observe([this](const Events::EntityCreated &){ transforms_dirty = true; }); - observer.observe([this](const Events::EntityDestroyed &){ transforms_dirty = true; }); + observer.observe([this](auto &){ transforms_dirty = true; }); + observer.observe([this](auto &){ transforms_dirty = true; }); } void TransformPropagator::tick(Time::TimeDelta)