Boost logo

Boost :

Subject: Re: [boost] [type-traits] aligned_storage in unions
From: dherring_at_[hidden]
Date: 2010-09-20 14:16:01


On Mon, 20 Sep 2010, Steven Watanabe wrote:
> On 9/20/2010 8:50 AM, dherring_at_[hidden] wrote:
>> See
>> http://www.boost.org/doc/libs/1_44_0/doc/html/variant/design.html
>>
>> In particular, "Temporary Heap Backup" and "Future Direction".
>>
>> We have some specialized requirements. We couldn't even use
>> boost::shared_ptr until it added both the custom allocator and
>> deleter. The "never-empty guarantee" conflicts with our needs and is
>> not a concern at this time.
>
> You can effectively bypass the never-empty guarantee by adding
> boost::blank to the variant types. This will cause the variant to
> set itself to boost::blank on an exception instead of using heap
> backup. (This will actually work if has_nothrow_constructor is
> true for /any/ of the variant types, but boost::blank is the preferred
> backup if it's present.).

Thanks for the info; I hadn't noticed that feature.

- Daniel


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