Some of people make such thing:
listener.getBus().listen<T>()...
And they thought that listening with our listener.
So need to fix bad conceptual mistake.
In some cases using flag:`D_GLIBCXX_DEBUG` will cause some memory corruption
errors. For example our executable will link to this library without
`D_GLIBCXX_DEBUG` flag on it self.
Do not investigate it deeply but probably hardcoding compile options in library
isn't good idea.
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)