Re: [Boost-users] Boost.Serialization: Restoring object state (preventcreation of a new object)?
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. 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) . For example: A a; ... A& aRef = a; ia & BOOST_SERIALIZATION_NVP(aRef);; // Throws an exception in load_override
ray@maya-studio.com 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
participants (2)
-
ray@maya-studio.com
-
Robert Ramey