|
Boost Users : |
From: Hughes, James (jhughes_at_[hidden])
Date: 2007-07-06 12:39:19
I'm wondering whether it may be something to do with the NVP
serilisation of *this - does the serialisation lib know how to name
*this to correctly form a NVP? What did the original XML say?
void save(std::ostream & os)
{
assert(os.good());
boost::archive::xml_oarchive oa(os);
oa << BOOST_SERIALIZATION_NVP(*this);
}
James
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Fei Liu
> Sent: 06 July 2007 17:16
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] question about boost serialization library
>
> Ok I found out how to make it to work but I don't understand the
> rationale, basically, the serialization and deserialization functions
> cannot be member
> functions, they have to be free functions like these:
>
> void save_map(const demo &s, std::ostringstream & os){
> // make an archive
> assert(os.good());
> boost::archive::xml_oarchive oa(os);
> oa << BOOST_SERIALIZATION_NVP(s);
> }
>
> void
> restore_map(demo &s, std::istringstream & is)
> {
> // open the archive
> assert(is.good());
> boost::archive::xml_iarchive ia(is);
>
> // restore the schedule from the archive
> ia >> BOOST_SERIALIZATION_NVP(s);
> }
This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.
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