|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2003-09-14 10:13:05
Jeff Garland wrote:
>Of course there are many great new features that I had to try out and that ran
>me into a couple issues with the xml output. The first is that I can't seem
>to output a std::string name value pair:
[snip]
As described in the "Release Notes" of the documentation, XML archives don't work with
gcc 3.2 due to a bug in that version of gcc. I'm now working on draft # 12 and its
possible that this problem may be worked around. It doesn't appear in gcc 3.3
>The other thing I noticed by accident is that it is possible to write an
>archive that requires name value pairs without creating one. That is,
> const int anInt = 100;
> std::ofstream ofx("test_string.xml");
> boost::archive::xml_oarchive oax(ofx);
> oax << anInt;
> oax << boost::serialization::make_nvp("int_again", anInt);
>compile and executes resulting in:
> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
> <!DOCTYPE boost_serialization>
> <boost_serialization signature="serialization::archive" version="2">
> 100<int_again>100</int_again>
> </boost_serialization>
> I notice that trying this with strings results in a compilation error. I
> assume the intent is to make all types fail to compile with archives that take
> name value pairs?
You assumption is correct. It is my intention that the xml archive trap at compile
time any attempt to serialize anything not wrapped as a name-value pair. I'll
look into this.
Thanks for helping with this.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk