Boost logo

Boost :

From: Jared McIntyre (jmcintyre_at_[hidden])
Date: 2005-10-10 12:42:36


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;
}

Thanks,

Jared


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk