title: C++ wrapper for the Observer pattern
body: <p>C++ newbie. I have a class with a vector of listeners following the observer pattern. Listeners inherit from an abstract class defining different methods like on_start, on_stop, on_such_event, etc. <em>These methods are not having the same signature.</em></p>
  <p>I'd like to write an event processing method and call from it, when appropriate, the registered listeners, with the appropriate methods and providing the needed arguments. I could, of course, call in a loop the appropriate method for each listener. But this is not DRY and code is difficult to follow.</p>
  <p>Is it possible to have a function wrapping my above calls? Something like</p>
  <pre><code>void notify_listeners(?);
  </code></pre>
  <p>where &quot;?&quot; stands for something I don't know right now. notify_listeners() would call each registered listener with the appropriate method and arguments. I'd like to call this from my evens processing method like this:</p>
  <pre><code>if (some_event)
    notify_listeners(on_start(some arguments)); // calls on_start for each listener
  if (other_event)
    notify_listeners(on_stop(some other arguments));
  </code></pre>
  <p>&quot;on_start&quot; and &quot;on_stop&quot; are in a header as public method defined by the listeners. Thanks.</p>