Skip to content

Add implicit raw pointer conversion to vtkNew

Requiring .GetPointer discourages use of vtkNew in favor of raw pointers or vtkSmartPointer. GetPointer does not prevent accidental return of a vtkNew object through a function whose signature returns a raw pointer because developers who don't understand reference counting would not understand it any better because they are forced to add .GetPointer() for the compilation to succeed.

Although originally the implicit conversion was intentionally not added, now overwhelming majority (11 out of 13) of developers agree that implicit conversion should be added.

Example:

vtkNew img; someFilter->SetInputData(img); // previously img.GetPointer() was required

Merge request reports