X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Feventsource.h;h=ccb830fb9fb3d4da7c91b265e6002285d9b1d937;hb=fce6e7846814e54de9d38000d2f5e2295ee2119e;hp=0856e08c452a7abd48b263db1bcb54092e4c75bb;hpb=db01a6ed506ea2352b20f10b2694e249d2bba6c5;p=libs%2Fgame.git diff --git a/source/game/eventsource.h b/source/game/eventsource.h index 0856e08..ccb830f 100644 --- a/source/game/eventsource.h +++ b/source/game/eventsource.h @@ -41,6 +41,9 @@ private: public: template void emit(Args &&...) const; + + template + void emit_to(EventObserver &, Args &&...) const; }; @@ -61,6 +64,15 @@ inline void EventSource::emit(Args &&... args) const bus.dispatch(event); } +template +template +inline void EventSource::emit_to(EventObserver &obs, Args &&... args) const +{ + T event(std::forward(args)...); + static_cast &>(*this).dispatch_to(obs, event); + bus.dispatch_to(obs, event); +} + } // namespace Msp::Game #endif