www.digitalmars.com         C & C++   DMDScript  

c++ - Template use not valid ?

reply Jean-Pierre H. Dumas <jeanpierre.dumas freesbee.fr> writes:
I use DMC++ (8.32) to compile some C & C++ files.
Their author use OpenWatcom, gcc & vc6 to compile these files.
The function definition line gives an error.
How can I get this compiled ?

sc SRC\PROCESS\combine.cpp -p -J -mn -C -WA -f -S -5 -a1 -c -gf
-DFFTW_ENABLE_FLOAT -Ic:\temp\grafix\cd_iup_img\imlab_sc\include -Ic:\temp
\grafix\cd_iup_img\imlab_sc\src -Ic:\temp\grafix\cd_iup_img\imlab_sc\src\mm
-Ic:\temp\grafix\cd_iup_img\imlab_sc\src\i
Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(27):  storage
class is illegal in this context
Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(38):  storage
class is illegal in this context
Lines Processed: 1060551  Errors: 2  Warnings: 14
Build failed

template <class T>
static inline T blend_op(const T& v1, const T& v2, const imReal& alpha)
{
  return (T)(alpha*v1 + (1.0f - alpha)*v2);
}

static inline imComplex blend_op_cpx(const imComplex& v1, const imReal& v2,
const imReal& alpha)
{
  return alpha*v1 + (1.0f - alpha)*v2;
}

template <class T>
static inline T backsub_op(const T& v1, const T& v2, const T& tol, int use_diff)
{
  T diff = diff_op(v1, v2);

  if(diff <= tol)
    return (T)0;
  else
  {
    if(use_diff)
      return (T)diff;
    else
      return (T)v1;
  }
}
Mar 12 2003
parent "Walter" <walter digitalmars.com> writes:
That should work with the latest DMC++ beta.

"Jean-Pierre H. Dumas" <jeanpierre.dumas freesbee.fr> wrote in message
news:1103_1047497797 news.digitalmars.com...
 I use DMC++ (8.32) to compile some C & C++ files.
 Their author use OpenWatcom, gcc & vc6 to compile these files.
 The function definition line gives an error.
 How can I get this compiled ?

 sc
SRC\PROCESS\combine.cpp -p -J -mn -C -WA -f -S -5 -a1 -c -gf -DFFTW_ENABLE_F LOAT -Ic:\temp\grafix\cd_iup_img\imlab_sc\include -Ic:\temp

\grafix\cd_iup_img\imlab_sc\src -Ic:\temp\grafix\cd_iup_img\imlab_sc\src\mm 
-Ic:\temp\grafix\cd_iup_img\imlab_sc\src\i
 Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(27):
storage class is illegal in this context
 Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(38):
storage class is illegal in this context
 Lines Processed: 1060551  Errors: 2  Warnings: 14
 Build failed

 template <class T>
 static inline T blend_op(const T& v1, const T& v2, const imReal& alpha)
 {
   return (T)(alpha*v1 + (1.0f - alpha)*v2);
 }

 static inline imComplex blend_op_cpx(const imComplex& v1, const imReal&
v2, const imReal& alpha)
 {
   return alpha*v1 + (1.0f - alpha)*v2;
 }

 template <class T>
 static inline T backsub_op(const T& v1, const T& v2, const T& tol, int
use_diff)
 {
   T diff = diff_op(v1, v2);

   if(diff <= tol)
     return (T)0;
   else
   {
     if(use_diff)
       return (T)diff;
     else
       return (T)v1;
   }
 }
Mar 12 2003