harr999y wrote:
Hi,:) I'm doing saving the shared_ptr<void>,but it can't as "boost::serialization::tracking_level< T >::value != boost::serialization::track_never". And I know if it's shared_ptr<int>,I can use strong_typedef.But for the void,the strong_typedef cannot work. So can you give me some hint?
hmmm - shared_ptr<T> is basically a wrapper around T *. Given X x; X * xptr = & x; shared_ptr<X> sx(x); ar << sx Is more or less equivalent to: serialize x serialize xptr; serialize sx So if X is void the whole thing makes no sense and can't work. You really need to think about what void * means in your program. Usually it's just a place holder for any kind of pointer. Maybe you want to consider using boost::any instead of void *, (I don't know if serialization has been implemented for boost::any) or perhaps boost::variant which DOES have serialization implemented. Robert Ramey
Thanks,
Harry