// Cast a dynamically allocated string to 'void*'.
void *vp = static_cast<void*>(new std::string("it's easy to break stuff like this!"));
// Then, in the function that's using the UserEvent:
// Cast it back to a string pointer.
std::string *sp = static_cast<std::string*>(vp);
// You could use 'sp' directly, or this, which does a copy.
std::string s = *sp;
// Don't forget to destroy the memory that you've allocated.
delete sp;
//https://stackoverflow.com/questions/3076968/converting-a-void-to-a-stdstring
模仿string ,vector也可以。
void *vp = static_cast<void*>( new vector<string> vectorstr );
vector<string>* sp = static_cast<vector<string>*>( vp );
vector<string> s = *sp;
delete sp;