Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] How do Imake boost::serializationwork with std::shared_ptr?
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-09-29 17:51:29


JOAQUIN M. LOPEZ MUÑOZ wrote:
> El 29/09/2013, a las 21:44, "Robert Ramey" <ramey_at_[hidden]> escribió:
>
>
>
>
>
> shared_pointers (boost and std) are not serializable as things stand.
>
> [...]
>
> This was OK .... until now when we have a new shared_ptr to deal with.
> The real solution is to enhance the serialization API so that the code
> used for implementing boost::shared_ptr can be applied to other
> data types which are otherwise unserializable. Unfortunately, this
> is a non-trivial task which I have yet to get to.
>
>
>
>
>
> Maybe it's time to recover archive helpers as we discussed some years
> ago:
>
>
> http://lists.boost.org/Archives/boost/2007/09/127065.php
>
>
> I won't repeat my arguments, but I think helpers were a nice general
> solution to implement non-trivial serialization for types with shared
> semantics and other, hard to crack cases.

I agree that this is the required solution. I was unhappy with your
solution as it intertwined the solution into the the basic serialization
code which is aready almost too complex to understand. What I
would like to see is (and plan to do if I get around to it) is to generalize
the current approach used to implement the serialization for
boost::shared_ptr. The current code implements the "helper" idea
in a way that is orthogonal to the rest of the code and doesn't
require adding any new template parameters. As I said, I would
like to see this generalized. This would entail adding a new facet
to the API under the heading "Handling otherwise unserializable
type" This would add the facilty of attaching/detaching a "helper"
with the appropriate interface. Not all that hard to do and wouldn't
complicate other code - but work non the less.

Robert Ramey

> Joaquín M López Muñoz
> Telefónica Digital
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net