Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::serialization - Non intrusive serialization of user-defined members?
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-03-05 17:31:03


On 3/5/18 9:06 AM, Lars Ruoff via Boost-users wrote:
> 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.

where is

template<class Archive>
void serialize(Archive & ar, special_member_type & t, const unsigned int
version){
        ar & ??;
};

?

If you have this you could write:

template<class Archive>
void serialize(Archive & ar, ContainerClass & c, const unsigned int
version){
        ar & c.other_members; // easy - built-in type
        ar & c.special_member; //uses it's own version
}

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net