<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2014:09:10</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Thu, 07 May 2026 08:03:36 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>dispatcher_in_c_14</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2014:09:10:dispatcher_in_c_14</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;dispatcher_in_c_14&quot;&gt;2014-09-10 - dispatcher in C++14&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.baszerr.eu/lib/exe/detail.php?id=blog%3A2014%3A09%3A10%3Adispatcher_in_c_14&amp;amp;media=blog:2014:09:10:prog_mag_cpp.jpg&quot; class=&quot;media&quot; title=&quot;blog:2014:09:10:prog_mag_cpp.jpg&quot;&gt;&lt;img src=&quot;https://www.baszerr.eu/lib/exe/fetch.php?w=350&amp;amp;tok=d25fde&amp;amp;media=blog:2014:09:10:prog_mag_cpp.jpg&quot; class=&quot;mediaright&quot; align=&quot;right&quot; loading=&quot;lazy&quot; title=&quot;issue cover&quot; alt=&quot;issue cover&quot; width=&quot;350&quot; /&gt;&lt;/a&gt;
few days ago &lt;a href=&quot;http://programistamag.pl/programista-82014-26-wyjatki-od-kuchni-w-c-spis-tresci&quot; class=&quot;urlextern&quot; title=&quot;http://programistamag.pl/programista-82014-26-wyjatki-od-kuchni-w-c-spis-tresci&quot; rel=&quot;ugc nofollow&quot;&gt;a new issue of Programista Magazine&lt;/a&gt; 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:
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; MyDispatcher&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; public AutoDispatcher&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;MyDispatcher&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; Msg1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; Msg2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; Msg3&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; handle&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Msg1 const&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;coMULTI&quot;&gt;/* handle code */&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; handle&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Msg2 const&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;coMULTI&quot;&gt;/* handle code */&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; handle&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;Msg3 const&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span class=&quot;coMULTI&quot;&gt;/* handle code */&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
&lt;a href=&quot;https://github.com/el-bart/but/blob/master/But/Pattern/Dispatcher.hpp&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/but/blob/master/But/Pattern/Dispatcher.hpp&quot; rel=&quot;ugc nofollow&quot;&gt;AutoDispatcher&lt;/a&gt; is a part of &lt;a href=&quot;https://github.com/el-bart/but/tree/master/But&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/but/tree/master/But&quot; rel=&quot;ugc nofollow&quot;&gt;BUT&lt;/a&gt; library i started recently. note that it also allows &lt;a href=&quot;https://github.com/el-bart/but/blob/master/But/Pattern/DispatcherMock.hpp&quot; class=&quot;urlextern&quot; title=&quot;https://github.com/el-bart/but/blob/master/But/Pattern/DispatcherMock.hpp&quot; rel=&quot;ugc nofollow&quot;&gt;one-line mock creation&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
the idea has been also presented on &lt;a href=&quot;http://www.cppwroclaw.pl/dokuwiki/spotkania/007/info#lightning_talkdyspozytor_w_c_11&quot; class=&quot;urlextern&quot; title=&quot;http://www.cppwroclaw.pl/dokuwiki/spotkania/007/info#lightning_talkdyspozytor_w_c_11&quot; rel=&quot;ugc nofollow&quot;&gt;Wrocław&amp;#039;s C++ users group&lt;/a&gt;, 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! :)
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:08:54 +0000</pubDate>
        </item>
    </channel>
</rss>
