Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-17 09:59:23

> A smart shared_ptr can do the right thing on b.reset(), but on b.release()
> the user will be left with a Base* and the undefined behavior is not far
> away.

I agree that release() is dangerous. It is also required if you want to use
smart pointers with any COM (and, I suspect, CORBA) projects. The typical
scenario (shown by Rob), is when you need to return a pointer in an out
parameter. In that case you need to tell your smart pointer you want to take
ownership of the pointee away from the smart pointer.


Boost list run by bdawes at, gregod at, cpdaniel at, john at