
I still believe We dont need any modification in shared_ptr to make it serializable (even more I believe it's evil od request one). I don't remember ever your answer on my last post.
evil to REQUEST a modification - wow. Don't even look at the hack I had to do - I might get the death penalty!
I thought about a little more. If I rememeber correctly the essense of
Byevil I meant that I do not see any need for shared_ptr counters direct acces neither for serialization nor for deserialization and the fact that you request it seems suspicious. the
problem during de-serialization was:
template<class Archive, class T> void serialize(Archive &ar, shared_ptr<T> & t){ T * raw_ptr; ar >> raw_ptr; t = shared_ptr(raw_ptr); // problem is here - not matched with other shared pointers that might point to raw_ptr
Here we do very simple (or complex,depends on point of view) trick instead of above Let say we have somewhere map<T*,shared_ptr<T>*> registry; if( registry[raw_ptr] == 0 ) { t = shared_ptr<T>( raw_ptr ) registry.add( raw_ptr, &t ); } else t = *registry[raw_ptr];
// current shared_ptr implementation depends upon an internal pointer
to
a shared count. }
Do I miss something important? Gennadiy