c++ A Generic Callback object implementation

  actionscript-3, boost, c++, c++11, flash

I have a generic interface of callbacks for c++ written for flash, you can see an example here:

I’m looking for a standard implementation for generic callback like that (in std or in boost), that is not coupled with flash player.
What it does basically is to implement a generic Callback object that can be called with arbitrary number of arguments of primitive types.

typedef std::map<std::wstring, Callback> callbacks;
string functionName = "SomethingHappened";
string xml = "<some xml document/>";
Callbacks::iterator itCallback = callbacks.find(functionName);
if (itCallback != callbacks.end())
        //parse arguments
        std::vector<std::wstring> args;
        _Args::split(xml, args);
        ASValue::Array arguments;
        for (size_t i = 0, s = args.size(); i < s; ++i)
            ASValue arg; arg.FromXML(args[i]);
        ASValue returnValue;
        //***this is where the magic happens: call the function***
        HRESULT result = itCallback->second.Call(arguments, returnValue);
        return result;

Source: Windows Questions C++