Boost logo

Boost Users :

From: gast128 (gast128_at_[hidden])
Date: 2007-03-06 11:36:24


Robert Ramey <ramey <at> rrsd.com> writes:

> 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.
Yes I forget that when I ported the example to std formats instead of my own
private functions.

> I just commented out some stuff that made no sense to me.
>
> Robert Ramey
>
> //triggers a load exception
> // what is this for?
> #if 0
> std::string str = sstr.str();
> boost::replace_all(str, "<m_ptr1>", "<m_ptr1");
> sstr.str(str);
> //load
> obj.m_ptr.reset();
> obj.m_ptr1.reset();
> sstr.seekg(0);
> #endif

- the reset's are for clearing the object (not necessary)
- with seekg(0) I hope that the loading starts reading at the begin of the
stream (where the XML starts)
- the replace stuff was a simulation of an actual case: the second shared
pointer entry in the XML became corrupt, which triggered an excpetion. However
the first shared pointer seems to be loaded complete already.
Calling 'delete_created_pointers' on the archive freed this piece of memory
also, so that an access violation is triggered when the object (and thus the
shared pointer) went out of scope.

Wkr,
me


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