title: Event emitter and automatic registrations of member methods as listeners
body: <p><sub>This is a <em>question with answer</em>, the aim of which is to invite the readers to suggest their own solutions.<br>
  I'm quite sure that out there there are more clever approaches than mine, so I'd like to know what those solutions are.<br>
  Please, share your knowledge by adding your own answers!!</sub></p>
  
  <hr>
  
  <p>The goal is to create an <em>emitter class</em> that can be used to dispatch a few events.</p>
  
  <p>An important feature I want to be in the emitter is an <em>easy to use registration facility</em> to attach the listeners to the emitter.</p>
  
  <p>In other terms, I don't want to write functions/methods aimed to attach all the listeners to the emitter, for it could be error prone and I found myself more than once looking for a bug that was due to a missed line of code because of that (a line that would have registered the <em>N-th</em> listener, of course).</p>
  
  <p>Imagine the following structs:</p>
  
  <pre><code>struct E1 { };
  
  struct S {
      void receive(const E1 &amp;ev) { /* do something */ }
  };
  </code></pre>
  
  <p>The registration facility I'm looking for is such a solution for which the following lines of code are enough:</p>
  
  <pre><code>S s;
  emitter.reg(s);
  </code></pre>
  
  <p>And that's all, even if in the future it arises the requirement for one more listener to be added to the struct <code>S</code>, as an example:</p>
  
  <pre><code>struct E1 { };
  struct E2 { };
  
  struct S {
      void receive(const E1 &amp;ev) { /* do something */ }
      void receive(const E2 &amp;ev) { /* do something */ }
  };
  </code></pre>
  
  <p>How could I write such an emitter?</p>