Subject: Re: [boost] [Smart Ptr] make_shared slower than shared_ptr(new) on VC++9 (and 10) with fix
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-04-28 06:22:29


On 27/04/12 01:59, Peter Dimov wrote:
> Mathias Gaunard wrote:
>
>> I suppose you probably want to say that the type you're accessing the
>> object with is actually the dynamic type of the object, but that idea
>> is not supported anywhere in the standard.
>
> 3.8, object lifetime.

In lack of a proper explanation, I will assume that your argument is
that the array member lifetime has ended and you're re-using its storage
to store an object of a different type.

Is that what you meant?

Assuming this is true (which I'm not entirely sure of, the fact that it
is a subobject might be a problem), there still is 3.8/7 to consider,
which does not allow you to re-use the storage for any other type if
there is any reference to the original object.

I don't see how the copy constructor of the class could avoid referring
to the original object.