You have an plain array of pointers. Each pointer is made to point to an individual dynamically allocated Geometry
. So you need to call delete
in each of those pointers. delete []
is for dynamically allocated arrays.
In real life you would use a types that manage the resources automatically, to avoid having to manually delete the pointers. Options include arrays of std::unique_ptr<Geometry>
, or containers designed to manage dynamically allocated objects, such as those available in the boost::pointer_container
library.