few days ago a new issue of Programista Magazine has been released. it contains an article, explaining in a great detail my concept of dispatcher pattern implementation, that allows very compact code on user side. example dispatcher for 3 messages can look like this:
struct MyDispatcher: public AutoDispatcher<MyDispatcher, Msg1, Msg2, Msg3> { void handle(Msg1 const& m) { /* handle code */ } void handle(Msg2 const& m) { /* handle code */ } void handle(Msg3 const& m) { /* handle code */ } };
AutoDispatcher is a part of BUT library i started recently. note that it also allows one-line mock creation.
the idea has been also presented on Wrocław's C++ users group, as an (almost) lightning talk. there is good chance, it will also be presented to the wider audience in Wrocław, around the end of 2014. stay tuned! :)