Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-27 06:21:17


Hi Christoph,

> For some reason I am considering switching to the xml archive
> implementation. However, this triggers a BOOST_STATIC_ASSERT in
> basic_xml_oarchive<Archive>::save_override<T>(const T&, BOOST_PFTO int).
> The implementation insists that all serialized types be wrapped in a
> nvp<T>.
...
> Do I need to write
>
> ar & nvp<MyMemberType>("my_member_tag", this->my_member);
>
> in my serialization functions for every variable I want to
> (de-)serialize?

You can also use

   ar & BOOST_SERIALIZATION_NVP("my_member")

> Can I choose an arbitrary tag for each variable or is
> it supposed to be consistent for all variables of a specific type?

I believe each variable of each class can have arbitrary name.

> Am
> I correct to assume that the code will still work if I serialize into
> a "normal" text archive and the nvp will essentially be ignored?

That's right.

HTH,
Volodya


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