I am using VTK for Visualization and my code is full of their smartpointers, like:
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
what I was wondering about if this New()
should not be followed later by Delete()
. Or does
VTK destroy everything "automatically". Many times by using Delete()
my code crashes. So, I was wondering if I should use it in first place and what is behind New()
, a shared pointer or something like this?