gast128 wrote:
Robert Ramey
writes: I don't see any problem with the code snippet. Maybe you want to make small test which we run here.
ok here it comes. It looks artificial, but it is just a simplification of a case. It gives an access violation after thhe load, when it tries to destroy the object.
OK - here are the changes I made in order for your example to work:
the main one is to enclose the output in {} to be sure that the xml
archive dtor is called. The ensures that the xml file contains the
trailer tags. This was what calling the load exception. I discovered
this by visually inspecting the xml file to and it was obvious to see
that it wasn't terminated correctly.
I just commented out some stuff that made no sense to me.
Robert Ramey
int main()
{
BoostExample obj;
std::stringstream sstr;
//save make sure dtor is called on the oa
// by enclosing it in {}
{
boost::archive::xml_oarchive oa(sstr);
oa << BOOST_SERIALIZATION_NVP(obj);
}
//triggers a load exception
// what is this for?
#if 0
std::string str = sstr.str();
boost::replace_all(str, "