
Hi, Robert Ramey wrote:
For what its worth, my thoughts along these lines are something like:
calss helper_base { virtual ~helper_base() = 0; }
class text_iarchive ... std::list<helpbase *> helper_list; text_iarchive(){ for(it = help_list.begin();it != helper_list.end();++it) delete *it; } };
This is a good idea, although it shouldn't be part of text_iarchive, but some base class of it instead, so that all archive types can use these 'helpers' as you call them. Some time ago, this was one of our feature requests for boost::serialization and we've implemented this in our version of the library. We currently call these 'helpers' 'archive state', for the lack of a better word. Basically, this mechanism allows applications to associate arbitrary objects with archives that can be accessed from serialization code. These objects are basically per-instance variables of an archive. This is not only useful for shared_ptr serialization, but for other things as well, such as integrating boost::serialization with a serialization system of a 3rd party library. Another thing we use this mechanism for is when de-serialized objects need to register themselves with some kind of global registry or other type of manager object. So we strongly encourage adding such a feature to boost::serialization. Best Regards, Martin TAB Austria Haiderstraße 40 4052 Ansfelden Austria Phone: +43 7229 78040-218 Fax: +43 7229 78040-209 E-mail: martin.ecker@tab.at http://www.tab.at