Upcasting vtkSmartPointer


The (legacy) code below that used to compile:

 vtkSmartPointer<vtkLookupTable> lut = Util::getColorTable( ColorTable::RAINBOW, min, max);

Now I get no known conversion for argument 1 from 'vtkSmartPointer<vtkLookupTable>' to 'vtkScalarsToColors*' what gives? As far as I know vtkLookupTable inherits from vtkScalarsToColors. How do I upcast the smart pointer? I can’t change the type of pointer returned by the getColorTable() function.

any help will be much appreciated.


There is no such thing as upcasting (it is implicit). Make sure to #include all related header files.

True… there was missing an include that was being included indirectly in the legacy code. Thanks for the heads up.