Boost logo

Boost :

Subject: Re: [boost] [Variant] Documentation Questions/Notes
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-27 16:49:10


on Sat Oct 27 2012, Steven Watanabe <watanabesj-AT-gmail.com> wrote:

> AMDG
>
> On 10/27/2012 10:50 AM, Dave Abrahams wrote:
>>
>> <snip>
>>
>> - The "temporary heap backup" technique seems to have a hole:
>>
>> 1. Copy-construct the content of the left-hand side to the heap;
>> call the pointer to this data backup.
>> 2. Destroy the content of the left-hand side.
>> 3. Copy-construct the content of the right-hand side in the
>> (now-empty) storage of the left-hand side.
>> 4. In the event of failure, copy backup to the left-hand side
>> storage.
>> 5. In the event of success, deallocate the data pointed to by
>> backup.
>>
>> What happens in the event of a failure in step 4?
>>
>
> backup is a pointer. Copying it can't fail.

Ah, thanks. I guess the docs could make that clearer.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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