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'.
:: === consoletests, Release ===
..\..\code\boost_1_35_0\boost\serialization\serialization.hpp:74:
instantiated from `void boost::serialization::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_iarchive, T = int]'
..\..\code\boost_1_35_0\boost\serialization\serialization.hpp:133:
instantiated from `void boost::serialization::serialize_adl(Archive&,
T&, unsigned int) [with Archive = boost::archive::text_iarchive, T = int]'
..\..\code\boost_1_35_0\boost\archive\detail\iserializer.hpp:152:
instantiated from `void boost::archive::detail::iserializer
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#obj... for more details. --Johan Råde
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#obj...
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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
jens weller
-
Johan Råde