Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-01-20 12:03:42


Joseph Turian wrote:
>> I can't see what you're trying to do here.
>
> The sample I provided is basically the simplest version of my code
> that, nonetheless, will not compile.
>
> In my code, it's much more complicated. Basically, I have class A, and
> class A has static member variables that are STL containers containing
> objects of type boost::shared_ptr<A>.
> But I tried to simplify it as much as possible to the basic piece
> which will not compile, which is what I provided in my last message.
>
> I suspect that if I could get the sample code (where A contains Aptr)
> working, then I'd be able to get my entire program serialized.

Hmmm

There are at least 3 totally orthogonal issues here.

a) Serialization of static variables. This is handled the same as any other
variables. Tracking can be used to ensure that only unique copies of
the variables are serialized.

b) Serialization of smart_ptr<int>. This would handled like seriliazation
of
another other type of smart pointer - except smart_ptr<T> can only
be serialized if T is a tracked type. I showed how to use
BOOST_STRONG_TYPE to make a type equivalent to an int
which can be tracked and therefore be used as an argument
to a serialized smart_ptr.

c) Serializiation of contained pointers. This is common case handled
by the library. The library considers and handles correctly the
case where pointers are cyclic. I modified your code to show it
compiles. (note there is also a test for cyclic pointers.

I'm not aware of any other obstacles to doing what you want to do.

Robert Ramey


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