Stefan Strasser wrote:
Am 10.03.2013 01:27, schrieb Silviu P:
Hi,
I'm trying to serialize a boost::shared_ptr to a custom archive. The compiler complains about the archive missing methods 'append' and 'reset'. Does anyone know where I should look to find out more information about these two methods?
Derive your archive class from detail::shared_ptr_helper, defined in archive/shared_ptr_helper.hpp, and it should work.
As to why this is undocumented and in namespace detail I can only speculate, but this is what the other archive classes do.
I can explain this. shared_ptr does not fullfil the type requirements for a serializable object. That is, it doesn't model the serializable concept. So I had to include special archive code to permit serialization of shared_ptr. This is the only place in the library where there is a coupling between archive classes and any object type to be serialized. The real fix is to modify the serialization library to include the facility built for shared_ptr in a generic manner. This is doable but would require some work. It would also require expansion of the documentation and "serializable" concept. And of course tests etc. It's not a huge project, but it's not trivial either. And sooner or later it's going to be necessary to accomodate std::shared_ptr. Robert Ramey