问题
I'm really not sure how do i serialize a list variable of type boost::shared_ptr <void *>
inside a class or struct. Generally, i would go with same method that we generally use like
struct A
{
std::list<boost::shared_ptr<void *>> mdb;
}
template<class Archive>
void serialize(Archive &d,const unsigned int version)
{
d & mdb; // not sure that this would work
}
while compiling it does not give error but does not serialize at my end.
回答1:
You don't. In all likelihood, the void*
is
- a HANDLE (for some native API); you can serialize this only if the API has enough identifying information to reconstruct the handle on load
- a type pun for something else (this would be silly, just have the real type there, then)
来源:https://stackoverflow.com/questions/23457722/how-do-i-serialize-list-variable-of-type-boostshared-ptrvoid