[vtk-developers] static template functions.

Miller, James V (CRD) millerjv at crd.ge.com
Mon Feb 25 16:10:36 EST 2002


Interesting.  The only reason we have the statics in there at all is support
the HP compiler.  I think all our other compilers do not require the static
be specified.



-----Original Message-----
From: Bill Hoffman [mailto:bill.hoffman at kitware.com]
Sent: Friday, February 22, 2002 3:31 PM
To: vtk-developers at public.kitware.com
Subject: [vtk-developers] static template functions.


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

_______________________________________________
vtk-developers mailing list
vtk-developers at public.kitware.com
http://public.kitware.com/mailman/listinfo/vtk-developers



More information about the vtk-developers mailing list