[vtk-developers] static template functions.

Bill Hoffman bill.hoffman at kitware.com
Fri Feb 22 15:31:08 EST 2002


The most recent HP compiler fails to build VTK.
It does not allow a static template function to call another static template function.
Strictly speaking static functions are deprecated in the c++ standard, and you are
supposed to use anonymous namespaces.  However, for VTK, we are supporting compilers
that will not support namespaces.   So, it would seem the most portable thing
to do, would be to remove the static and rename the functions to
classname_function.


Here is an example of something that does not work:

template <class IT, class OT>
 static void CopyTuples(IT* input, OT* output, int nComp, int* ptIds )
{
 ...
}

template <class IT>
 static void CopyTuples1(IT* input, vtkDataArray* output, int* ptIds)
{
  void* v = 0;
  typedef double VTK_TT; 
// this CopyTupes can not be found at compile time.
  CopyTuples(input, (VTK_TT *)v, GetNumberOfComponents(), ptIds);
}


I would suggest that the statics be removed, and the names be changed
to vtkDataObject_CopyTuples and vtkDataObject_CopyTupes1.

Any other ideas?

-Bill




More information about the vtk-developers mailing list