Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-07-24 11:20:28


On Thu, Jul 24, 2008 at 4:58 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
<snip>
>
> T::T(T&& o) could make 'o' empty, but there could be no other way to
> make 'o' empty otherwise.

I think that the biggest problem is that, if T is movable, you cannot
statically guarantee that T is never accessed in an empty state, so
the never empty guarantee is not as useful.

>
> (I personally wonder if it wouldn't have been better to not call
> destructors on moved objects)
>

Again, in general, the type system does not let the compiler know
statically if an object has been moved, so you would need an extra
bolean flag for each movable type instance to know if that instance
has been moved or not.

This could be an unacceptable size and performance cost in some cases.

-- 
gpd

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