Support mutable lambdas in ecs::dispatcher
This commit is contained in:
parent
13a86a76c8
commit
04443b1e3a
1 changed files with 2 additions and 2 deletions
|
|
@ -30,7 +30,7 @@ namespace psemek::ecs
|
|||
template <typename Event, typename Handler>
|
||||
void handler(Handler handler)
|
||||
{
|
||||
handlers_[Event::uuid()].push_back([handler = std::move(handler), this](void const * event_ptr){
|
||||
handlers_[Event::uuid()].push_back([handler = std::move(handler), this](void const * event_ptr) mutable {
|
||||
auto const & event = *reinterpret_cast<Event const *>(event_ptr);
|
||||
|
||||
if constexpr (std::invocable<Handler, Event const &, ecs::container &>)
|
||||
|
|
@ -47,7 +47,7 @@ namespace psemek::ecs
|
|||
template <typename Event, typename ... Components, typename System>
|
||||
void system(System system)
|
||||
{
|
||||
handlers_[Event::uuid()].push_back([system = std::move(system), this, cache = container_->cache<Components...>()](void const * event_ptr){
|
||||
handlers_[Event::uuid()].push_back([system = std::move(system), this, cache = container_->cache<Components...>()](void const * event_ptr) mutable {
|
||||
auto const & event = *reinterpret_cast<Event const *>(event_ptr);
|
||||
|
||||
if constexpr (std::invocable<System, Event const &, ecs::container &, handle, Components & ...>)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue