====== 2014-09-10 - dispatcher in C++14 ====== {{ :blog:2014:09:10:prog_mag_cpp.jpg?350|issue cover}} few days ago [[http://programistamag.pl/programista-82014-26-wyjatki-od-kuchni-w-c-spis-tresci|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 { void handle(Msg1 const& m) { /* handle code */ } void handle(Msg2 const& m) { /* handle code */ } void handle(Msg3 const& m) { /* handle code */ } }; [[https://github.com/el-bart/but/blob/master/But/Pattern/Dispatcher.hpp|AutoDispatcher]] is a part of [[https://github.com/el-bart/but/tree/master/But|BUT]] library i started recently. note that it also allows [[https://github.com/el-bart/but/blob/master/But/Pattern/DispatcherMock.hpp|one-line mock creation]]. the idea has been also presented on [[http://www.cppwroclaw.pl/dokuwiki/spotkania/007/info#lightning_talkdyspozytor_w_c_11|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! :)