Skip to content
Commit 00bf5f3d authored by Andras Lasso's avatar Andras Lasso
Browse files

Add implicit raw pointer conversion to vtkNew

Added implicit conversion of vtkNew object to the raw pointer that it holds:
1. to make smart pointers more convenient to use, and
2. be consistent with vtkSmartPointer.

In practice, it means that there is no more need for calling GetPointer() to get a raw pointer from a vtkNew<> object. For example:

  vtkNew<vtkImageData> img;
  someFilter->SetInputData(img); // previously img.GetPointer() was required instead of just img

Rationale: VTK's intrusive reference count allows raw pointers to hold references. This is the main distinction from std::shared_ptr that makes implicit conversion to a raw pointer safer.

For reference, this conversion was added to vtkSmartPointer by commit 69a91050, aka commit v5.0.0~3861 (Added implicit conversion to contained pointer, 2004-04-19).
parent 38a93a95
Loading
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment