Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] serializing int*
From: jens weller (jensweller_at_[hidden])
Date: 2008-09-22 07:29:50


Johan Råde wrote:
> jens weller wrote:
>
>> Hello,
>>
>> Simple example:
>>
>> class A
>> { int x; };
>> class B
>> { int *px; };
>>
>> There exists a list of B for each A, which points to x.
>> When now serializing B:
>>
>> ar & px;
>>
>> I get an compiletime error, that t is of non classtype 'int'.
>
>
> ...
>
>> This error does not refer to the class it self, but it only occurs,
>> when serializing int* in my application.
>>
>> Is this a bug? Or is this a thing serialization can't do right now?
>> I've got a workaround, so I don't need to save the px variable, but
>> I'd like to know if this is an error or not.
>
>
> From the docs:
>
> "By default, data types designated primitive by Implementation Level
> class serialization trait are never tracked. If it is desired to track a
> shared primitive object through a pointer (e.g. a long used as a
> reference count), It should be wrapped in a class/struct so that it is
> an identifiable type. The alternative of changing the implementation
> level of a long would affect all longs serialized in the whole program -
> probably not what one would intend. "
>
> See
> http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/special.html#objecttracking
>
> for more details.
>
> --Johan Råde

Oh, I see. I just read all the Docs to pointers, and missed Objecttracking.

thanks,

Jens Weller

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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