Emil Dotchevski wrote:
On Tue, Aug 5, 2008 at 5:05 PM, Robert Ramey
wrote: Emil Dotchevski wrote:
it a good idea for the shared_ptr serialization to be implemented in terms of the T * object contained in a boost::shared_ptr<T>?
The current implementation of serialization of boost::shared_ptr depends only upon the published public interface of boost::shared_ptr. (personally I have some complaints about that public interface though). Assuming that std::shared_ptr has the same published interface as boost::shared_ptr - I would expect the serialization implemenation would be the same.
Then maybe I misunderstood your earlier reply, that boost::shared_ptrstd::string can't be serialized directly because it contains a std::string pointer. That's why I brought up the pointer stored in std::string, which is an implementation detail indeed, as is the T pointer in boost::shared_ptr<T>.
So, why wouldn't shared_ptrstd::string "just work" when serialized, even if serializing std::string raw pointers doesn't?
well, I suppose it could be "made to work" by internally wrapping it in a special type so it doesn't get treated as a serialization primitive. I would never occur to me to do such a thing though. The strength of the current approach is it's "conceptual integrity". That is shared_ptr<T> is pointer is serializable if and only if T * is serializable. This is much simpler than trying to out smart the programmer by silently fixing things up for him when it can. Robert Ramey
Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode