Destructor order

eles via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 22 15:59:02 PDT 2014


On Wednesday, 22 October 2014 at 18:03:59 UTC, Ali Çehreli wrote:
> On 10/22/2014 08:45 AM, eles wrote:> C++ versions:

> Extremely dangerous and very tricky! The solution? Define the 
> objects as 'auto' (or 'const', etc.), which you want anyway:
>
>     auto foo = scoped!(A)();
>     auto bar = scoped!(B)();
>
> You do not want to be left with A or B. You want Scoped!A and 
> Scoped!B.

Write it on this page http://ddili.org/ders/d.en/destroy.html 
with red big font, please.


More information about the Digitalmars-d-learn mailing list