Question about RAII.

Peter C. Chapin pchapin at sover.net
Tue Jul 4 10:35:55 PDT 2006


Oskar Linde <oskar.lindeREM at OVEgmail.com> wrote in
news:e8dqj5$29ns$1 at digitaldaemon.com: 

> It looks like you want some kind of transfer semantics. You can do
> that manually:
> 
>   if (f()) {
>      object3 = object1;
>      object1 = null;
>    }
>    else {
>      object3 = object2;
>      object2 = null;
>    }

That's a neat trick. Thanks. I can see that in many cases specifying which 
of the autos I don't want destroyed (in effect) would be easier than 
explicitly destroying everything else.

Peter



More information about the Digitalmars-d mailing list