Vector of Vector of (member) function pointers
<p>I'm constructing an simple listener / callback mechanism, for my current experimental project.  And i'm stuck with implementing a container structure what seems should be vector of vector of pointers. I choose this way because i want the root vector to simple have KEY of event type let's say is an enum (int), then at this key i want to store vector of pointers to available methods for this event type. In logical representation something like:</p>

<pre><code>[EVENT_TYPE_QUIT]
                 [ptr1]
                 [ptr2]
                 [ptr3]
                 [ptr4]
                 [....]
[EVENT_TYPE_HELLO]
                 [....]
                 [....]

typedef enum {
   EVENT_TYPE_QUIT,
   EVENT_TYPE_HELLO,
   ...
} EventType;
</code></pre>

<p>So the simplified implementation looks something like this (it's an template in reality but imagine T is any user type you can map an event).</p>

<pre><code>class EventMapper {
    ...

    typedef void (T::*functionPtr)(); // simple pointer to T member function with no args.

    std::vector&lt; std::vector&lt;functionPtr&gt; &gt; eventCallbacks;

    void mapEvent(const EventType type, functionPtr callback) {

        // here i need to map type to callback
        // each type can have multiple callbacks
        // T can have only distinct event types as "key"

        // this i tried but doesn't work

        eventCallbacks[type].push_back(callback);

    }

    ...
}
</code></pre>

<p>The intended implementation would look something like:</p>

<pre><code>EventMapper&lt;SupaDupaClass&gt; mapper;
mapper.mapEvent(EVENT_TYPE_HELLO, &amp;SupaDupaClass::didYouSayHello);
</code></pre>

<p>etc ... </p>

<p>I really would like to use vector instead of map for easier unique key assignment ?
Thank you</p>
