Subject: Re: [boost] [interprocess] default constructors
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-05 19:45:30
on Fri Dec 05 2008, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:
> David Abrahams wrote:
>> on Wed Dec 03 2008, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:
>>> David Abrahams wrote:
>>>> I don't think it's unfortunate. Destructive move semantics is nearly
>>>> impossible to use correctly in many conditions.
>>> Would you mind giving examples?
>> void f()
>> X a;
>> if (something)
>> // ... // a.~X() ?
> Indeed, in the general case, the compiler (this certainly shouldn't be
> the job of the programmer) would have to transform the code to
> something like that:
> void f()
> X a;
> bool destruct_a = true;
> if (something)
> destruct_a = false;
> // ...
> if (destruct_a)
In general the compiler can't know.
void f(X& a)
Separate translation units if you must. Challenge your own idea a
little bit; you'll see where this leads. Destruction without static
knowledge thereof is the ultimate violation of invariants.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk