[vtk-developers] RFC: vtkScopedPointer - a new hope?

Marcus D. Hanwell marcus.hanwell at kitware.com
Mon Jan 24 10:56:31 EST 2011


Hi,

Some of you may remember my dreams of a concise way of initializing
VTK objects, that would go out of scope and be destroyed at the
appropriate time. Inspired by the Qt scoped pointer, I am having
another stab at this. It is a very simple scoped pointer class, but I
think it will allow us to write clearer, more concise code. Please
take a look,

http://review.source.kitware.com/759

It avoids one of the issues Brad hit, in that if you want to use it
with a smart pointer you just use the GetPointer method, assign the
pointer to the smart pointer object, its reference count is
incremented to 2, and will go back down to 1 once vtkScopedPointer
goes out of scope.

It would be great to get this addition into our next VTK release, and
so I would appreciate feedback from other developers in our community.

Marcus
--
Marcus D. Hanwell, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4937



More information about the vtk-developers mailing list