I am looking at Boost.Serialization for the first time, and I cannot find a clear assessment (or instructions) regarding the serialization of a virtual diamond inheritance structure.
Consider the following class hierarchy:
class A { int a; }
class B1 : public virtual A { int b1; }
class B2 : public virtual A { int b2; }
class B3 : public virtual A { int b3; }
class C12 : public virtual B1, public virtual B2 { int c12; }
class C13 : public virtual B1, public virtual B3 { int c13; }
class C23 : public virtual B2, public virtual B3 { int c23; }
class D123 : public virtual C12, public virtual C13, public virtual C23 { int d123; }
What is the proper (hopefully, simple) way to implement serialization within all of these classes using Boost.Serialization?
Note: There are no pointer or reference class members that need to be serialized. Also note: I am happy to use dynamic_cast<>
to assure that any pointers or references to any classes in this hierarchy are of the desired, derived-most type: I am simply concerned about how to properly, and cleanly, guarantee that all BASE-class data members are properly serialized, and deserialized, along with the current class being serialized.