
Double check that a is polymorphic - that is, that it has at least one virtual function. Then get back to us. Robert Ramey Jared McIntyre wrote:
I've gone through the documentation, and I'm still unable to get this particular aspect of serialization working. I have two objects 'a' and 'b', and 'b' inherits from 'a'. I have a vector of 'a' pointers that may just be 'a' or may be 'b'. I've preregistered 'b', right before the vector serialization occurs, so that the serialization system should properly recognize that 'b' inherits from 'a'. However, only the 'a' pieces of each 'b' in the vector serializes. If I place all the 'b' items in a second 'b' containing vector, and serialize that afterwards, it properly discovers that the 'a' part has been serialized already and simply points to that reference. I don't really want to store this second 'b' vector. Is there a way to get a vector of a items to also serialize the 'b' part of the element if the item is a 'b'?
I apologize if this is already in the documentation, but if it is, I missed it.
Also, there is an issue in the documentation. In the "Pointers to Objects of Derived Classes" section, it has example registration code:
main(){ ... ar.template register_type<derived_one>(); ar.template register_type<derived_two>(); base *b; ar & b; }
I'm guessing that is supposed to be:
main(){ ... ar.register_type<derived_one>(); ar.register_type<derived_two>(); base *b; ar & b; }
nope, its correct. This is a little known quirk of C++ syntax. Your second version won't compile on the most conforming compilers. Robert Ramey
Thanks,
Jared _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost