Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 20:25:09


"Philippe A. Bouchard" <philippeb_at_[hidden]> writes:

> David Abrahams wrote:
>
> [...]
>
>> look:
>>
>> {
>> aligned_storage<T>::type storage;
>>
>> new ((void*)&storage) T(x, y, z); // throws
>>
>> // ~aligned_storage<T>() destroys non-existent T
>> }
>
> What will happen to a normal type then?

What is a "normal type"?

> {
> T storage = T(x, y, z); // throws
>
> // storage.~T() destroys non-existent T

Storage never gets constructed if T(x,y,z) throws, so it is also
never destroyed.

> }

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