Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] unwinding "stack" of object duringloading
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-11-13 11:57:01


Igor R wrote:
> Hello,
>
> Consider the following structure:
>
> struct outer
> {
> inner_type1 inner1_;
> inner_type2 inner2_;
>
> template<class Archive>
> void HostPort::load(Archive &ar, const unsigned int version)
> {
> ar >> BOOST_SERIALIZATION_NVP(inner1_);
> ar >> BOOST_SERIALIZATION_NVP(inner2_);
> }
> };
>
>
> Assume that loading of inner1_ throws exception. Is there a way to
> "unwind" the "stack" of objects gracefully (i.e. to skip until some
> "end" marker of inner1_), and to proceed loading the next inner object
> normally?
>

Note that the the serialization library does throw exceptions on failure.
These
exceptions are documented in the manual. You should be able to catch
these exceptions in your own save/load functions. I can't say to what
extent
one might be able to recover. Implementing this would likely require
more elaborat save/load functions.

Robert Ramey

>
> Thanks.


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