Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization]Can not export polymorphic types
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-12-29 20:00:58


What happens if you try the following:

TestBase * pT1 = new TestType1;

TestBase* pT2 = new TestType2;

testOutXML << boost::serialization::make_nvp("pT1", pT1);

testOutXML << boost::serialization::make_nvp("pT2", pT2);

testTypeOFS.close();

delete pT1;

delete pT2;

...

testInXML >> boost::serialization::make_nvp("pT1", pTB);

testInXML >> boost::serialization::make_nvp("pT2", pTB);

Robert Ramey

  "Daniel Roberts" <impulsionaudio_at_[hidden]> wrote in message news:14125aaf0812291340m10f590e7j4d43eecaeefe2a22_at_mail.gmail.com...
  Yes, I understand that. I am sorry I should have been more clear; the base class is abstract. I am able to get the "unregistered class" exception in test_no_rtti.cpp, in load_derived, by removing the serializations using derived class pointers (which register the classes). When execution tries to serialize using the base class pointer, the "unregistered class" exception is thrown. I expect this to not happen because all the classes are registered using BOOST_CLASS_EXPORT. Could BOOST_CLASS_EXPORT not be working? Do you see this when commenting out the derived class serializations in load_derived?

  Thanks,

  Daniel Roberts

  Only polymophic types can be serialized through a base class pointer.

  Robert Ramey

------------------------------------------------------------------------------

  _______________________________________________
  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