[vtkusers] A template to avoid calling vtkObjectBase->Delete()

Brad King brad.king at kitware.com
Wed Apr 28 11:42:09 EDT 2004


REGAT-BARREL Aurélien wrote:
> Hello world,
> In C++, the need to keep track of created objects in order to call 
> Delete on exit is cumbersome.
> So, I plan to use a small template to avoid calling Delete.

You can do this with vtkSmartPointer in the current CVS version of VTK:

#include <vtkSmartPointer.h>
// ...
vtkSmartPointer<vtkConeSource> cone =
   vtkSmartPointer<vtkConeSource>::New();

-Brad



More information about the vtkusers mailing list