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

Brad King brad.king at kitware.com
Wed Apr 28 12:09:15 EDT 2004


REGAT-BARREL Aurélien wrote:
> Hello,
> I know vtkSmartPointer, and my template is much inspired from it.
> But, I don't understand how to use it in order to do what i want :
> 
> Let's have a look at your example :
> 
> vtkSmartPointer<vtkConeSource> cone =
>    vtkSmartPointer<vtkConeSource>::New();
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There is a special New() method in the vtkSmartPointer that returns a
smart pointer to an object with a total reference count of 1.  You
argument applies for this code:

vtkSmartPointer<vtkConeSource> cone = vtkConeSource::New();
cone->Delete();

-Brad




More information about the vtkusers mailing list