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

Brad King brad.king at kitware.com
Tue Jan 25 13:24:06 EST 2011


On 01/25/2011 01:08 PM, Bill Lorensen wrote:
> I think I understand your argument.
> 
> However, I was looking for a simple drop-in similar to what Brad
> experimented with last March.
> 
> I can't recall the details of his implementation nor why we abandoned it.

It was abandoned due to a problem achieving the syntax

  vtkSmartPointer<vtkBase> b = vtkNew<vtkDerived>();

Later I actually did find a way to achieve it but it comes at the cost
of allowing some dangerous copies of vtkNew<> instances without any
compile-time diagnosis.  Other than providing

  T* GetPointer() const

instead of

  operator T*() const

Marcus's vtkNew is a strict subset of my latest version that does not
allow the above syntax but also avoids the dangerous cases.  His vtkNew
can be converted to mine with the addition of a few lines so we can
change our mind later.

-Brad



More information about the vtk-developers mailing list