
Jari wrote:
//Why do these need to be wrappers?? namespace boost { namespace serialization { template<> struct is_wrapper : mpl::true_ {}; template<> struct is_wrapper<A> : mpl::true_ {}; template<> struct is_wrapper<const A> : mpl::true_ {}; } }
I don't know why the above is there. It should be taken out
BOOST_SERIALIZATION_ASSUME_ABSTRACT(A); BOOST_CLASS_EXPORT(B) BOOST_CLASS_EXPORT(C)
int main(int argc, char** argv) { //A* a = new A(); A* b = new B(); A* c = new C(); //A* a1 = nullptr; A* a2 = nullptr; A* a3 = nullptr;
ostringstream ostream; xml_oarchive oarchive(ostream);
oarchive /*<< BOOST_SERIALIZATION_NVP(a)*/ << BOOST_SERIALIZATION_NVP(b) << BOOST_SERIALIZATION_NVP(c);
istringstream istream(ostream.str()); xml_iarchive iarchive(istream);
iarchive /*>> BOOST_SERIALIZATION_NVP(a1)*/ >> BOOST_SERIALIZATION_NVP(a2) >> BOOST_SERIALIZATION_NVP(a3);
//delete a; delete b; delete c; //delete a1; delete a2; delete a3; }
The problem is:
oarchive << BOOST_SERIALIZATION_NVP(a) creates an item data </a>
iarchive >> BOOST_SERIALIZATION_NVP(a1) expects an item