[vtkusers] Forward declaring vtkSmartPointer
Marcus D. Hanwell
marcus.hanwell at kitware.com
Mon Nov 16 14:37:08 EST 2009
On Monday 16 November 2009 14:29:02 David Doria wrote:
> > declaration to work. You have declared a local instance of
> > vtkSmartPointer<vtkTransform> and so the full definition is required.
> > Forward
> > declarations can only be used when you are using pointers or references.
> >
> > The smart pointer becomes fairly useless when you need to use a pointer
> > to it
> > though, as you then have to destroy it yourself and so you may as well
> > use a
> > pointer to the object.
> >
> > Marcus
>
> So the solution is not to use smart pointers for member variables?
>
Or to include the vtkSmartPointer header in your header, see for example
Views/vtkTreeMapViewer.h, Infovis/vtkFast2DLayoutStrategy.h and others which
does exactly that.
Hope that helps.
Marcus
--
Marcus D. Hanwell, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4937
More information about the vtkusers
mailing list