[vtkusers] Non-virtual version of vtkDataArrayTemplate
Matthieu Heitz
heitz.matthieu at gmail.com
Thu Apr 7 07:08:35 EDT 2016
Hi all !
I have a template class myClass<T>, where T can be a scalar (float, int,
double, etc.)
I would like to create a vtkFloatArray, vtkIntArray, or vtkDoubleArray,
depending on the type T.
I thought that vtkDataArrayTemplate<T> would be a good solution.
Unfortunately, it is a virtual class, so I can't write this :
vtkSmartPointer< vtkDataArrayTemplate<T> > array =
vtkSmartPointer<vtkDataArrayTemplate<T> >::New();
because when I try to instantiate a myClass<float>, I get the error :
error: invalid conversion from ‘vtkObject*’ to
‘vtkDataArrayTemplate<float>*’ [-fpermissive]
So my question is: Is there an non-virtual version of vtkDataArrayTemplate
that would allow me to create a vtkFloatArray when T is float,
vtkDoubleArray when T is double, etc.
P.S: I use VTK 6.0.0
Thank you !
Matthieu Heitz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160407/ee8f5a89/attachment.html>
More information about the vtkusers
mailing list