[vtk-developers] Do I need to delete an object when I create a smart pointer of it?
Mingcheng Chen
linyufly at gmail.com
Sun Mar 29 12:00:14 EDT 2015
Hello,
I am always prudent when using VTK, i. e. I never mix the smart pointer and
normal pointer of VTK objects.
I have a concern. Suppose we have
vtkPolyData *mesh = some_function_which_returns_vtkPolyData_star(...);
vtkSmartPointer<vtkPolyData> mesh_ptr = vtkSmartPointer<vtkPolyData>(mesh);
we should do mesh_ptr->Delete() after, right?
However, can we do
vtkSmartPointer<vtkPolyData> mesh_ptr =
vtkSmartPointer<vtkPolyData>(some_function_which_returns_vtkPolyData_star(...));
?
If we do that, how can we delete the reference count to the object before
passing it to vtkSmartPointer?
Thanks!
-Mingcheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150329/9d7b436c/attachment.html>
More information about the vtk-developers
mailing list