[vtkusers] vtkSmartPointer

Artem Babayan artem.paraview at googlemail.com
Tue May 11 08:56:25 EDT 2010


Thank you for reply,  actually, found the error myself -- defined
class name vtkDataSet (to avoid including the header with the full
class definition) in the header within the local namespace, so
compiler confused it with the actual vtkDataSet class.



On 11 May 2010 12:21, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Tue, May 11, 2010 at 6:11 AM, Artem Babayan
> <artem.paraview at googlemail.com> wrote:
>> Hello,
>>
>> Why does simple statement:
>>
>> vtkSmartPointer<vtkDataSet> test(vtkSmartPointer<vtkStructuredPoints>::New());
>>
>> does not compile with the following error:
>>
>> <..>/vtkSmartPointer.h: In constructor
>> `vtkSmartPointer<T>::vtkSmartPointer(const vtkSmartPointer<U>&) [with
>> U = vtkStructuredPoints, T = vtkview::vtkDataSet]':
>> ../VSSet3dScalarVolumeViewer.cpp:59:   instantiated from here
>> <..>/vtkSmartPointer.h:43: no matching function for call to
>> `vtkSmartPointer<vtkview::vtkDataSet>::CheckType(vtkStructuredPoints*)'
>> <..>/vtkSmartPointer.h:28: candidates are: static T*
>> vtkSmartPointer<T>::CheckType(T*) [with T = vtkview::vtkDataSet]
>>
>> vtkStructurePoints are inherited (ultimately) from vtkDataSet isn't it?
>>
>> I included vtkStructurePoints.h, vtkDataSet.h, vtkStructuredPoints.h
>> and (just in case) vtkImageData.h to the test program, so inheritance
>> tree should be known at this point.
>>
>> Best wishes
>> Artem
>
>
> I've never seen that syntax (although that doesn't mean it doesn't exist.
>
> Try this:
>
> vtkSmartPointer<vtkDataSet> test = vtkSmartPointer<vtkStructuredPoints>::New();
>
> Thanks,
>
> David
>



More information about the vtkusers mailing list