Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Serialization: Restoring object state(preventcreation of a new object)?
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-30 17:46:42


ray_at_[hidden] wrote:
>>> Just avoid serialization through a pointer, serialize either the
>>> object or a reference to the object.
>
> Thanks, Robert. Serializing through a reference seems to be the only
> viable solution in my case.

Its the correct one as it does what you want to do.

> However, I'm not able to make it work (I
> didn't find any specific information about references in the library
> documentation - except for member variables) .

There's nothing special about references - since the archive operators
pass by reference, serializing through a reference is indistinguishable
from serializing a variable.

> For example:
>
> A a;
> ...
> A& aRef = a;
> ia & BOOST_SERIALIZATION_NVP(aRef);; // Throws an exception in
> load_override

That's likely something else entirely. We'd have to see more code.

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