I have an array of pointers to other objects called Comparable* array (inside a template for a class).
I understand that delete deletes memory referenced by a pointer, and that delete [] deallocates the memory assigned to each pointer in an array.
My question is if I have an array that contains pointers to other objects, how do I deallocate the memory referenced by each pointer in the array and the array itself?
The way you just described 🙂 Loop through the array to delete every object and then delete the array: