OwnedArray class may be considered a manager of smart pointers, in the sense that it manages the lifetime of the object to which it points. JUCE includes a range of other smart pointer types to help solve a number of common issues when writing code using pointers. In particular, these help avoid mismanagement of memory and other resources.
Perhaps the simplest smart pointer is implemented by the
ScopedPointer class. This manages a single pointer and deletes the object to which it points when no longer needed. This may happen in two ways:
ScopedPointerobject itself is destroyed
One use of the
ScopedPointer class is as an alternative means of storing ...