mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
COMMON: Add a reset method to DisposablePtr
This commit is contained in:
parent
26c096d39d
commit
2c8afb2bd2
16
common/ptr.h
16
common/ptr.h
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user