mirror of
https://github.com/gelldur/EventBus.git
synced 2024-12-31 06:23:03 +08:00
fc1dbe335f
I was wondering if it is a good step for EventBus. Of course, it will break back compatibility again as well as it was when changing v1 -> v2, but this change is smaller. Those changes were inspired by Boost::MSM how it handles events. Why i decided to change: + It will prevent from bugs like typo in Event string eg. Event<int>{"text"} + If we want to change signature of Event, we won't have to update all listeners and their signature + Less includes for listener. Simply in our class header we will have eg. pointer/ref to event type not to all args + Strongly typed (this is always better) + Storing event for future reuse + More easy to introduce thread safe EventBus in future + EventBus is more simple + const Event forbids some kind of communication. Eg. passing and modifying reference + Less errors when using std::bind - Breaking back compatibility - Need fixes in projects that using this lib - Someone can add methods etc. to Event :( - We can't generate easily multiple "types" of events like in 'for' loop - Worst performance (still not such bad as CCNotificationCenter)