Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-02-17 11:28:45


Joaquín Mª López Muñoz <joaquin_at_[hidden]> writes:

> Thorsten Ottosen ha escrito:
>
>> Dear All,
>>
>> I have just added serialization to Boost.Ptr container.
>> I briefly discussed an issue with Robert, namely
>> that the current implementation calls clear() before
>> reading the new values.
>>
>> The alternative is to provide roll-back guarantee by default
>> by creating a local container and swap() in the end.
>> By default this would temporarily use more memory.
>>
>> IMO we should go for the strong guarantee.
>> Any thoughts?
>
> I would NOT go for the strong guarantee for the following
> two reasons:
>
> 1. Given the basic guarantee, all-or-nothing semantics can
> be implemented externally, and as efficiently as you'd do it
> internally.
> 2. It might be of interest to keep a partially recovered object.
> For instance, think of the situation in which a container is being
> marshalled thru a socket and you lose internet conectivity.

That brings up an interesting point: you have to make sure, when
writing deserialization for a class, that partial deserialization
won't leave its instances with broken invariants.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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