[vtkusers] Understanding vtkSmartPointers

David Thompson david.thompson at kitware.com
Mon May 28 10:30:06 EDT 2018


> ...
> I think I wrote something similar back then. Whenever I see code like
> 
> vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
> 
> I want to replace it with
> 
> vtkNew<vtkRenderer> renderer;

With c++11, you can also say

  auto renderer = vtkSmartPointer<vtkRenderer>::New();

which cleans up the smart-pointer case a little bit.

	David


More information about the vtkusers mailing list