Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-01-03 09:42:20


"Reece Dunn" <msclrhd_at_[hidden]> writes:

> Li Lirong wroite:
>
>> I'm trying to use the serialization library to implement the
>> undo/redo functionality. Basically, the idea is like this:
>>
>>[snip]
>>
>> The problem is that after the undo, pObject will point to a newly
>> created object instead of the originally. (The same applies some
>> pointer fields of the object.)
>
> The problem is that with serialization, you cannot garantee that the
> pointer values will be the same on the read operation. This is because
> the read may occur at any point in the future, long after the original
> object has been destroyed. In this way, serialization is good at
> saving/restoring data between application runs.

Also, as long as you're going to save the unmodified data before
beginning an operation, you might as well use the undo data for
exception recovery. In that case, you probably want a system for
restoring the data which can't throw an exception. Deserialization is
unlikely to fit the bill.

-- 
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