Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-05-28 11:02:36


Sebastian Ramacher wrote:
> As of version 1.34, Boost.PtrContainer supports serialization as defined
> by Boost.Serialization. Now I'd like to propose a switch to disable this
> feature. The attached patch adds checks if
> BOOST_PTR_CONTAINER_NO_SERIALZATION is defined around the serialization
> related code blocks and enables/disables serialization support.
>
> It's not that I don't like serialization support but on a Debian system
> you have to install libboost-serialization-dev and
> libboost-serialization1.34.0 just to use Boost.PtrContainer.
>
> The patch was created against CVS HEAD but I'd gladly provide a patch
> against 1.34 if it finds any interest.

In my view, a cleaner solution would be to move the serialization code to be
external to the container and then optionally included. So, for example,

   #include <boost/ptr_container/ptr_list_serialize.hpp>

would get you the serialization stuff. I didn't look exhaustively, but it
looks the the serialization code uses only public interfaces on the containers
so this approach should be easy and it avoids all the #ifdef hackery. It
would also mean that the serialization dependency is 'off' by default and only
gets included at the request of the user.

I've been advocating that we move to this approach as much as possible within
boost so that there's as much consistency as possible across boost libs w.r.t.
this issue.

Jeff


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