title: Simple event system in C++
body: <p>I am designing a simple event system for my game engine.
  I want to implement the following event dispatcher interface:</p>
  
  <pre><code>// Create event dispatcher.
  Dispatcher dispatcher;
  
  // Create objects b and c.
  // Created objects extend base A class.
  A* b = new B();
  A* c = new C();
  
  // Register b and c in dispatcher.
  // I guess I should also pass member function pointer,
  // but I am not sure how to do it.
  // Like this; dispatcher.Add(b, &amp;B::DoWork) ?
  // Member function that I want to accept is always bool func(/*no params*/)
  dispatcher.Add(b /*, member function pointer?*/);
  dispatcher.Add(c /*, member function pointer?*/);
  
  // Trigger passed functions for registered objects.
  dispatcher.Trigger();
  </code></pre>
  
  <p>I guess, Im gonna need some kind of wrapper struct inside Dispatcher, to hold [pObject, pFunc] pair.</p>
  
  <pre><code>struct Wrapper
  {
     A* pObj; // Of base class A.
     // ??    // Pointer to given member function of A.
  };
  </code></pre>
  
  <p>I dont know how to implement member function pointer logic.
  As I need it for a real time system, I would like prefer a relatively fast solution. I appreciate all suggestions.</p>
  
  <p>I would prefer to avoid 3rd party libraries.</p>