c++ - Why can I not call templated method of templated class from a templated function -
possible duplicate:
confusing template error
i have templated class templated method. have function, 2 template arguments creating class first template argument , calling function second. consider example:
template<class s> class { 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 line }
gcc gived me:
error: expected primary-expression before ‘>’ toke
in line marked above. why not work , how can fix it? thanks! nathan
a<t>
dependent type (i.e. depends on template parameter t
), have specify you're referring template member:
a.template f1<ct>();
Comments
Post a Comment