Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-11-17 14:02:20


Robert Ramey wrote:

> Would it be possible to add something like
>
> friend template<class Archive>
> boost::serialization::serialize(Archive &ar, T &t);
>
> to boost::shared_ptr
>
> ?
>
> This would let me remove a problematic hack in
> boost/serialization/shared_ptr which is creating a headache when
> shared_ptr serialization is used with some other headers.
>
> The same may be necessary for some other headers - e.g. weak ptr.
>
> Another alternative would be to change the private members to protected or
> maybe even public.
>
> I realize that this creates a dependency between boost::serialization and
> boost:: shared_ptr that you have hoped to avoid. But until this is
> resolved at another level, its would be better than the current situation.
>
> Alternatively, you might want to consider expanding the shared_ptr
> interface with enough information to permit serialization to be
> implemented via the
> public interface. This has worked well for the stl collections. I don't
> know if this was an intentional design decision or just an accident.
>
> We really need a real solution now for boost::shared_ptr /
> boost::serialization .
>

This is true of some other boost libs, such as mersenne_twister. We really
should have one coherent policy IMO.

I propose:

1) We accepted serialization. Let's show that we really support it by using
it.

2) Any place serialization is supported, let's do it in an obvious direct
way. Saying you can find some workaround via various public interfaces is
not acceptable. It should be simple and obvious. If a class is supposed
to support boost::serialization, add the standard serialization interface.

3) Add BOOST_NO_SERIALIZATION of some such to bypass the code when not
wanted.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk