|
Boost Users : |
Subject: [Boost-users] [serialization] serializing int*
From: jens weller (jensweller_at_[hidden])
Date: 2008-09-22 06:14:26
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<Archive,
T>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned int) const [with Archive = boost::archive::text_iarchive, T = int]'
L:\project\consoletests\main.cpp:238: instantiated from here
..\..\code\boost_1_35_0\boost\serialization\access.hpp:109: error:
request for member `serialize' in `t', which is of non-class type `int'
..\..\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_oarchive, 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_oarchive, T = int]'
..\..\code\boost_1_35_0\boost\archive\detail\oserializer.hpp:144:
instantiated from `void boost::archive::detail::oserializer<Archive,
T>::save_object_data(boost::archive::detail::basic_oarchive&, const
void*) const [with Archive = boost::archive::text_oarchive, T = int]'
L:\project\consoletests\main.cpp:238: instantiated from here
..\..\code\boost_1_35_0\boost\serialization\access.hpp:109: error:
request for member `serialize' in `t', which is of non-class type `int'
:: === Build finished: 10 errors, 18 warnings ===
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.
regards,
Jens Weller
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