Q: Coupling multiple MSM Statemachines together My question is more an architectural question. I have multiple statemachines of the same type. Say 
controller_type1_sm controller1;
controller_type2_sm controller2;

std::array<worker1_sm,10> workers1;
std::array<worker2_sm,10> workers2;

Now when one controller sends messages, should i use a dispatcher that dispatches a name or id to an queue which gets worked by a thread which calls process_event() on the specified msm? 
The events could be kept in a generic queue when they get derived from a common base but the process_event() would need to know what kind of event it is. Visitor class to dispatch them? Any better solution?
When i limit the events to just numeric IDs, i could remove a lot of problems, but on the other hand MSM needs types and not IDs.
The threads which call the process_event(), needs to know the type of the state machine they work at. Template obviously ... 
EDIT:
The goal is to decouple the implementations.

A: In fact, it boiled down how to Queue up the different messages in a queue and get them back without a visitor which knows all events.
#include <queue>
#include <iostream>

struct runtime
{
    template <class T>
    void accept(const T& evt)
    {
        std::cout << "Accept: " << typeid(evt).name() << std::endl;
        // fsm.process_evt(evt);
    }
};
struct action
{
    virtual void operator()(runtime& rt) = 0;
};
template <class T>
struct carrier : action
{
    virtual void operator()(runtime& rt)
    {
        rt.accept(T());
    }
};

struct ev_test {};

int main(int argc, char** argv)
{
    using queue_t = std::deque<action*>;

    queue_t q;

    // capsulue the two functions
    runtime rt;
    carrier<int> f1;
    carrier<ev_test> f2;
    q.push_back(&f1);
    q.push_back(&f2);

    while (q.size())
    {
        auto& c = q.front();
        (*c)(rt);
        q.pop_front();
    }
}

In this example, the "runtime" holds my FSM. 
