[vtkusers] Using vtkDenseArray as a member variable

Jeff Baumes jeff.baumes at kitware.com
Fri Nov 13 10:17:48 EST 2009


> If I indeed declare a pointer as the member variable
>
> class vtkDenseArray;
> class vtkMyClass : public vtkPolyDataAlgorithm
> {
> ...
> private:
>  vtkDenseArray<double>* OutputGrid;
> };
>
> and initialize the object in the constructor in the implementation file:
>
> #include "vtkDenseArray.h"
> ...
> vtkMyClass::vtkMyClass()
> {
>  this->OutputGrid = vtkDenseArray<double>::New();
> }
>
> The errors are:
> error: 'vtkDenseArray' is not a template
> and
> error: template argument required for 'class vtkDenseArray'

Here you need to correctly forward declare a template class. Some
googling found that this should work:

template <typename T> class vtkDenseArray;

Jeff



More information about the vtkusers mailing list