07.04.2011 16:47, Alex Peshkoff wrote:

> But with smart pointers we must do the following:
>
> Smart<IAttachment>  at = ...
> att->release();        // refCounter == 1
> att->blaBlaBla();
>
> We want to detach - and here problems come. We can't simply call:
>
> att->detach();
>
> because ~Smart() will try to release an already destroyed object,
> causing AV.

True for dumb universal smart pointers. But a smarter one could overload 
not only operator-> but also the detach() method and mark itself as not 
requiring release inside the dtor.


Dmitry

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to