[vtk-developers] vtkNew<>

Brad King brad.king at kitware.com
Thu Jan 28 17:05:14 EST 2010


Bill Lorensen wrote:
> I admit I don't understand the "how", but the "what" looks great.
> 
> So,
> instead of:
> 
> vtkSmartPointer<vtkImageRectilinearWipe> wipe =
>   vtkSmartPointer<vtkImageRectilinearWipe>::New();
> 
> it would be what?
> vtkNew<vtkImageRectilinearWipe> wipe;

Correct:

  vtkNew<vtkImageRectilinearWipe> wipe;

It resembles the Tcl wrapper syntax:

  vtkImageRectilinearWipe wipe

The "base = new derived" case is not quite as nice but it doesn't
have any repetition:

  vtkSmartPointer<vtkObject> base = vtkNew<vtkImageRectilinearWipe>();

-Brad



More information about the vtk-developers mailing list