Júlio Hoffimann wrote:
Dear all,
I'm using Boost 1.45...
I've read Boost.Serialization docs so many times and can't understand why my testcase is not working as expected. According to the following three links, we need to address serialization of derived classes with "abstract" base class by using boost macros:
http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/traits.html#expo...
http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/special.html#exp...
http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/traits.html#abst...
I did my testcase ( http://codepad.org/6ETp1Ac0 ) completely based on the demo: http://www.boost.org/doc/libs/1_47_0/libs/serialization/example/demo.cpp
Have you tried to build adn run the demo as it is? Does it work? Robert Ramey
Compiling and running shows that the derived class archive contains just the base class data members. What is happening? How can i solve this problem?
One obvious problem is that the base class is not abstract. To be abstract, a base class must have atleast one virtual function in the form virtual my_function() = 0; The ASSUME_ABSTRACT macro doesn't mark it abstract to the compiler - it marks it abstract to the boost type-traites system. I know it's quirky and unclear - but I see no way to make it bullet proof. I'm sort of surprised/disappointed that this doesn't give a compile time warning. What compiler do you use? Robert Ramey
I really appreciate any help, Júlio.