[vtkusers] Understanding vtkSmartPointers
Marcus D. Hanwell
marcus.hanwell at kitware.com
Mon May 28 10:50:35 EDT 2018
On Mon, May 28, 2018 at 10:30 AM, David Thompson <david.thompson at kitware.com
> wrote:
> > ...
> > 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.
>
> For sure, although in the case of class member variables it doesn't help,
and I would argue vtkNew is cleaner (and vtkNew still uses far fewer
characters, you got to preserve the finite resources on disk :P ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180528/33cb2d68/attachment.html>
More information about the vtkusers
mailing list