I have a distributed c++ application and one machine wants the other machine to invoke a specific function on a specific object. The sender knows the type of the object and the pointer of it on the receiver. I can send a member function pointer to the receiver but I'm not sure how to send the type to enable a cast of the this pointer to the appropriate type.

Ideally the mapping could be done statically (is there a way using boost::mpl and boost::variant)? I know the set of types that could be invoked at compile time (both machines run the exact same binary as well). Also the signature of the function is fixed (let's say it returns void and takes an int always, regardless of type).