
I put the archive helper in as an ad hoc solution to a particular problem. I was always unsatisfied with it as I didn't like the idea of decorating the main serialization library code with special cases. Its my belief that this is what makes libraries die of old age. However, at the time it seemed expedient so I included it for this one case (shared pointer) and left it undocumented on purpose. Eventually I found what to me is a much better solution and this is implemented in the next release. This is to use multiple inheritance to add the helper in as a mix-in. This is the way I plan to support this kind of thing in the future. It doesn't change the published API of the serialization library itself. However I will add a section in the documentation - if its not already there describing this technique. I believe that using mix-in to ad helpers will be equivalent to adding them in at runtime as they are now. I included the shared_ptr helper mix-in in the in the library in order to not change the current api and in recognition of shared_ptrs priviledged status as a boost component. I didn't expect anyone to notice this change, as no one had posted a problem which required helpers and it was undocumented. Robert Ramey Joaquín Mª López Muñoz wrote:
Hello,
Boost.Serialization 1.33-1.34 introduces the notion or "helpers" to the Archive interface by means of the member functions:
void lookup_helper( const extended_type_info* const eti, shared_ptr<void>& sph); void insert_helper( const extended_type_info* const eti, shared_ptr<void>& sph);
which allow the user to make an archive instance store arbitrary helper objects associated to any given type. This helper interface is used to implement
serialization of boost::shared_ptr in a non-intrusive way, which was impossible for former versions of Boost.Serialization. This is a wonderful addition
to the library because not only solves the old problem with serializating shared_ptr but also serves as a general utility for implementing complicated serialization schemes, notably those in which internal resources are serialized which cannot be directly manipulated from the class public interface.
I have used archive helpers to good effect in implementing an otherwise unfeasible serialization algorithm for a library I'm writing, but when I moved from Boost 1.34 to the SVN trunk I discovered to my dismay that this (admittedly undocumented) feature has been removed in favor of an ad-hoc
extension of the Archive interface (internally based on something resembling the former helper code) to specifically allow serialization of boost::shared_ptr. IMHO this is a step back because it singles out shared_ptr as a type receiving special attention (vg. what will happen with std::tr1::shared_ptr, will the interface be augmented again to cope with this?) and primarily because it deprives us developers from a very very powerful tool.
Could the helper interface please please be brought back to Boost.Serialization? Thank you,
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost