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

Brad King brad.king at kitware.com
Thu Apr 29 09:02:04 EDT 2004


REGAT-BARREL Aurélien wrote:
>     Brad King <brad.king at kitware.com <mailto:brad.king at kitware.com>> wrote:
>     > vtkSmartPointer cone =
>     > vtkSmartPointer::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.
> 
> So, that's what I missed.
>     typedef vtkSmartPointer<vtkConeSource> vtkConeSourcePtr;
> 
>     vtkConeSourcePtr cone = vtkConeSourcePtr::New();
> doesn't compile.
> I use "vtk42-LatestRelease.exe".
> I will do a CVS update.
> So this is a "fresh feature".

Yes, this feature was just added a couple weeks ago to the CVS version.

> When will it be added in an official release ?

It will be in the 4.6 release whenever it is branched.  Definately by 
the end of the year.

> Does-it mean that in the future vtkSmartPointer will be often used ?

Yes, but only in the implementation of classes.  vtkSmartPointer should 
not be used in the interface to classes.

-Brad



More information about the vtkusers mailing list