Sorry, still don't understand. As said, i have defined void serialize(Archive & ar, MemberClass & m, const unsigned int version); so template<class Archive> void serialize(Archive & ar, ContainerClass & c, const unsigned int version) { ar & c.other_members; // easy - built-in type serialize(ar, c.special_member, version); //use same version??? } compiles. My question is what *version* number do i need to provide in the call to serialize for c.special_member? - The same as with what serialize(Archive & ar, ContainerClass & c, const unsigned int version) got called? (Like i did in example) This doesn't make sense to me. - Or I need to handle it myself, say i need to call serialize(ar, c.special_member, 3); because i *know* the current version of MemberClass is version 3. - Or there is some archive magic i don't see. On Mon, Mar 5, 2018 at 5:52 PM, Robert Ramey via Boost-users < boost-users@lists.boost.org> wrote:
On 3/5/18 8:36 AM, Lars Ruoff via Boost-users wrote:
Maybe i didn't express it clearly enough. I want non-intrusive serialization. I want to modify neither ContqinerClass, nor MemberClass. (Both are just custom classes, no link with STL containers. I just wanted to express that Container contains an instance of Member)
So how can i write ar & c.special_member; since there is no serialize member function for this class?
That's the problem. the type of c.special_member must be serializable. If it's not already, you have to make it serializable by writing your own serialize function for it. It can be either intrusive or non-intrusive - doesn't matter. But it has to be there. The versioning of type type of special_member is handled in the serialization of that type.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users