Browse Source

Add ScopedPointer::reset() method

Signed-off-by: falkTX <falktx@falktx.com>
pull/506/head
falkTX 6 months ago
parent
commit
a67f06f82d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      distrho/extra/ScopedPointer.hpp

+ 5
- 0
distrho/extra/ScopedPointer.hpp View File

@@ -172,6 +172,11 @@ public:
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
ObjectType* operator->() const noexcept { return object; }

//==============================================================================
/** Removes the current object from this ScopedPointer and deletes it.
*/
void reset() noexcept { ObjectType* const o = object; object = nullptr; delete o; }

//==============================================================================
/** Removes the current object from this ScopedPointer without deleting it.
This will return the current object, and set the ScopedPointer to a null pointer.


Loading…
Cancel
Save