Boost logo

Boost :

Subject: Re: [boost] boost::variant and "Current Approach: Temporary HeapBackup" vs "An Initial Solution: Double Storage"
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-09-30 17:52:39


AMDG

Peter Foelsche wrote:
>
> "Peter Foelsche" <peter_foelsche_at_[hidden]> wrote in message
> news:ha0hv5$7sj$1_at_ger.gmane.org...
>> 1)
>> boost::variant and "Current Approach: Temporary Heap Backup" vs "An
>> Initial Solution: Double Storage"
>> Please provide both solutions. A potential heap allocation may
>> prevent certain application areas.
>
>
> from the documentation:
>
> 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.
>
> step 4 may throw too in which case the variant is corrupted.

It can't throw because it is only copying a pointer.

In Christ,
Steven Watanabe


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