Boost logo

Boost :

From: gchen (chengang31_at_[hidden])
Date: 2008-06-30 14:20:40


Daniel Kunz wrote:
> *My problem:*
>
> I have to create a program to serialise and deserialse a xml-file to a
> binary-stream.
> I think to binary stream is already done but the xml-serialisation is
> not ready and I don't know whats wrong.
>
[...]
> template<class Archive>
> void serialize(Archive & ar, const unsigned int version)
> {
> ar & name;
> ar & minute;
> ar & shootout;
> ar & scored;
> ar & penality;
> }
>
[...]

To serialize to xml, you need wrap all datas in nvp (Name-Value Pairs):

void serialize(Archive & ar, const unsigned int version)
{
        ar & BOOST_SERIALIZATION_NVP(name);
        ar & BOOST_SERIALIZATION_NVP(minute);
        ar & BOOST_SERIALIZATION_NVP(shootout);
        ar & BOOST_SERIALIZATION_NVP(scored);
        ar & BOOST_SERIALIZATION_NVP(penality);
}

or you will get lots of compile errors, as you said in another post.


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