Possible Duplicate:
Confusing Template error
I have a templated class with a templated method.
Now I have another function, with 2 template arguments creating the class with the first template argument and calling the function with the second.
Consider this example:
template<class S>
class A {
public:
template<class T>
T f1() {
return (T)0.0;
}
};
template<class T,class CT>
void function() {
A<T> a;
a.f1<CT>(); // gcc error in this line
}
gcc gived me:
error: expected primary-expression before ‘>’ toke
in the line marked above. Why does this not work and how can I fix it?
Thanks!
Nathan
A<T>is a dependent type (i.e. it depends on the template parameterT), so you have to specify that you’re referring to a template member: