COMMON: Add a reset method to DisposablePtr

This commit is contained in:
Bastien Bouclet 2017-12-28 19:47:45 +01:00
parent 26c096d39d
commit 2c8afb2bd2

View File

@ -301,6 +301,22 @@ public:
*/
bool operator_bool() const { return _pointer != nullptr; }
/**
* Resets the pointer with the new value. Old object will be destroyed
*/
void reset(PointerType o, DisposeAfterUse::Flag dispose) {
if (_dispose) D()(_pointer);
_pointer = o;
_dispose = dispose;
}
/**
* Clears the pointer. Old object will be destroyed
*/
void reset() {
reset(nullptr, DisposeAfterUse::NO);
}
/**
* Returns the plain pointer value.
*