"Function template" problem
From: Lionel B (google_at_lionelb.com)
Date: 09/30/04
- Next message: Gernot Frisch: "Re: "Function template" problem"
- Previous message: Uwe Schnitker: "Re: vector::push_back performance"
- Next in thread: Gernot Frisch: "Re: "Function template" problem"
- Reply: Gernot Frisch: "Re: "Function template" problem"
- Reply: Markus Moll: "Re: "Function template" problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Sep 2004 00:55:04 -0700
Greetings,
I cannot figure out why the following code does not compile:
--- BEGIN CODE ---
typedef double ftype(double);
struct A
{
double x;
template<ftype F>
double eval()
{
return F(x);
}
};
template<ftype F>
struct B
{
A a;
double foo()
{
return a.eval<F>();
}
};
--- END CODE ---
It generates the error message:
scratch.cpp: In member function `double B<F>::foo()':
scratch.cpp:23: error: parse error before `;' token
[ line 23 being return a.eval<F>(); ]
Compiler gcc (GCC) 3.3.3 (cygwin special) on Win2K
Any help appreciated,
-- Lionel B
- Next message: Gernot Frisch: "Re: "Function template" problem"
- Previous message: Uwe Schnitker: "Re: vector::push_back performance"
- Next in thread: Gernot Frisch: "Re: "Function template" problem"
- Reply: Gernot Frisch: "Re: "Function template" problem"
- Reply: Markus Moll: "Re: "Function template" problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|