Boost.Serialization: Restoring object state (prevent creation of a new object)?
If an object is serialized (saved) from a pointer, the loading part automatically
creates (instantiates) a new object. However, there are situations when
the object is already created and all we need is to restore its state.
The following code demonstrates one possible - although not elegant - solution using a temporary object:#include <fstream>
#include <iostream>
#include
ray@maya-studio.com wrote:
If an object is serialized (saved) from a pointer, the loading part automatically creates (instantiates) a new object. However, there are situations when the object is already created and all we need is to restore its state.
The following code demonstrates one possible - although not elegant - solution using a temporary object:
#include <fstream>#include <iostream>#include
participants (2)
-
ray@maya-studio.com
-
Robert Ramey