In-Reply-To: <[EMAIL PROTECTED]> Are reference-counted objects supported? If I am using my own reference-counted class, what do I have to do to get serialisation to work for it?
To clarify: obviously the archive needs some kind of table of loaded objects, so that it can ensure two references to the same object still refer to the same object when loaded. If the objects are reference-counted, this table needs to understand the kind of reference-counting used. It needs an appropriate kind of smart pointer. Is this supported? If so, how? I have looked at the posted code but I've not been able to figure it all out. I see lots of use of (T *), which is wrong. I ask because in the past I have been bitten by Microsoft's MFC system, which makes no provision for reference counting. The problem code was something like: MyItem heres_one_I_prepared_earlier; smart_ptr<MyItem> p1, p2; ar >> p1; if (*p1 == heres_one_I_prepared_earlier) p1 = &heres_one_I_prepared_earlier; ar >> p2; // Bang. if (*p2 == heres_one_I_prepared_earlier) p2 = &heres_one_I_prepared_earlier; The assignment to p1 decrements the loaded object's ref-count. If p1 and p2 refered to the same object when they were stored, and the archive hasn't incremented the ref-count, then the object will have been deleted before p2 gets it. -- Dave Harris _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost