Add ScopedPointer::reset

This commit is contained in:
Vinnie Falco
2013-12-20 16:32:48 -08:00
parent 49bd8ac880
commit 0c0fa877cf

View File

@@ -185,6 +185,15 @@ public:
*/
ObjectType* release() { ObjectType* const o = object; object = nullptr; return o; }
void reset (ObjectType* object_)
{
if (object != object_)
{
ContainerDeletePolicy <ObjectType>::destroy (object);
object = object_;
}
}
//==============================================================================
/** Swaps this object with that of another ScopedPointer.
The two objects simply exchange their pointers.