[vtkusers] Re-using smart pointers as both input and output

zmurphy zmurphy1125 at gmail.com
Wed May 17 12:34:29 EDT 2017


I'm in a situation where I would like to do something like this:

vtkSmartPointer<vtkAlgorithmOutput> output =
SomeFunctionThatCreatesTheSmartPointer()

output = SomeFunctionThatTakesAndCreatesASmartPointer(output)

where the second function is something along the lines of this:

vtkSmartPointer<vtkAlgorithmOutput> SomeFunctionThatCreatesASmartPointer(
vtkSmartPointer<vtkAlgorithmOutput> input)
{
    vtkSmartPointer<vtkDelaunay3D> delaunay =
vtkSmartPointer<vtkDelaunay3D>::New();
    delaunay->SetInputConnection(input);

    //Do other things here...

    return delaunay->GetOutputPort();
}

Is it okay to reassign a smart pointer like that after using it as the input
to an algorithm?



--
View this message in context: http://vtk.1045678.n5.nabble.com/Re-using-smart-pointers-as-both-input-and-output-tp5743301.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list