[vtkusers] SmartPointer reference?

Richard Frank rickfrank at me.com
Mon May 16 13:25:38 EDT 2016



Rick Frank

> 
> From: Dan Lipsa <dan.lipsa at kitware.com>
> To: Richard Frank <rickfrank at me.com>
> Cc: VTK Users <vtkusers at vtk.org>
> Subject: Re: [vtkusers] SmartPointer reference?
> Message-ID:
>    <CADwGrVq4_tna0Oph5Tqn+m=6Uk4GTn8GJuGBvdfZ8XudbjcsBA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Does this help?
> http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers
> 
> What exactly is the problem you are seeing?
> Dan
> 
> 
>> On Fri, May 13, 2016 at 7:22 PM, Richard Frank <rickfrank at me.com> wrote:
>> 
>> 
>> Hi,
>> 
>> Is it possible to return a smart pointer by reference?
>> 
>> I'd like to return an image as a parameter, rather than a return type but
>> nothing seems to be happy.
>> 
>> for instance
>> 
>> bool SomeFunction(vtkSmartPointer<vtkImageData> & outImage)
>> {
>> vtkSmartPointer<vtkImageReader> r =
>> vtkSmartPointer<vtkImageReader>::New();
>> r->SetFileName("Path");
>> r->Update();
>> // What next?
>> 
>> return true;
>> }
>> 
>> I though Take was a possible choice
>> 
>> outImage = vtkSmartPointer<vtkImageData>::Take(r->GetOutput());
>> 
>> but no happiness there.
>> 
>> Any solution?
>> 
>> Thanks
>> 
>> Rick
>> 
>> 
>> 
>> 


More information about the vtkusers mailing list