I have a list of functions which receive values of different types, like in std.concurrency...

    // example from std.concurrency
    receive(
         (int i) { writeln("Received the number ", i);}
     );

...although in my case I can probably live by with only accepting objects.

I built a list of the handlers and the message classes they accept. My problem is that I don't know how to check if the message I have to dispatch is of the class the handler accepts *or a subclass*. I only managed to check for class equality:

    if(typeid(msg) == typeHandler.type)
    {
        typeHandler.handler(msg);
    }

How can I also accept subclasses?

Thanks,
Luís

Reply via email to