1 Apr 2007 02:37
Re: [serialization] free load/save
Robert Ramey <ramey <at> rrsd.com>
2007-04-01 00:37:41 GMT
2007-04-01 00:37:41 GMT
Ruediger Berlich wrote:
> Dear all,
>
> I'd like to serialize a number of classes using the free-standing
> version of the serialize function. As I do not want to access
> internals of the classes directly, I have to work with set/get
> functions, which in turn implies having to write load/save functions.
>
> This seems to work for simple types, like in the following example.
> But will it circumvent any internal mechanisms of Boost.Serialization
> , if I do not give the library direct access to class data ? Will
> this work for complex types, e.g. vectors of shared_ptr objects ?
yes
The only problem will be with "secret" objects which are pointed to.
When you de-serialize them to the stack, the internal address is wrong
so after moving them using "get" you'll have to use "reset_object_address"
if they are trackable.
Robert Ramey
>
> /*************************************************************************/
>
> class base{
> public:
> base(void){
> setSecret(1);
(Continue reading)
RSS Feed