[vtkusers] Using vtkDenseArray as a member variable
Jeff Baumes
jeff.baumes at kitware.com
Fri Nov 13 08:05:54 EST 2009
vtkDenseArray<double> is a vtkObject derivative like most everything
else in VTK. That means you cannot ever store a normal, stack-based
object like this, because C++ tries to call the default constructor on
it when it is initialized, but the default constructor is protected,
hence the error. You need to declare it (or any other vtkObject
derivative member or local variable) as a pointer, and use ::New() in
the constructor of the class to initialize it.
Jeff
On Thu, Nov 12, 2009 at 6:58 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Thu, Nov 12, 2009 at 2:15 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> In a VTK class, if I try to do:
>> ...
>> private:
>> vtkDenseArray<double> Test;
>>
>> if I forward declare vtkDenseArray:
>> class vtkDenseArray;
>>
>> I get
>> error: 'vtkDenseArray' is not a template
>>
>> and if I include it, I get:
>>
>> error: 'vtkDenseArray<T>::vtkDenseArray() [with T = double]' is protected
>>
>> Is there a reason that this shouldn't work?
>>
>> Thanks,
>>
>> David
>>
>
> Here is the smallest possible example:
> http://www.rpi.edu/~doriad/VTK_List/DenseArrayMember/
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4932
jeff.baumes at kitware.com
More information about the vtkusers
mailing list