www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Template use not valid ?

↑ ↓ ← 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
↑ ↓ → "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

LOAT -Ic:\temp\grafix\cd_iup_img\imlab_sc\include -Ic:\temp

-Ic:\temp\grafix\cd_iup_img\imlab_sc\src\i
 Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(27):

 Error: C:\TEMP\Grafix\CD_IUP_IMG\imlab_sc\SRC\PROCESS\combine.cpp(38):

 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&

 {
   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

 {
   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