I am trying to partially specialize a template function member of an unoccupied class:
#include <iostream> template<class T> class Foo {}; struct Bar { template<class T> int fct(T); }; template<class FloatT> int Bar::fct(Foo<FloatT>) {} int main() { Bar bar; Foo<float> arg; std::cout << bar.fct(arg); }
I get the following error:
c.cc:14: error: prototype for 'int Bar::fct(Foo<FloatT>)' does not match any in class 'Bar' c.cc:9: error: candidate is: template<class T> int Bar::fct(T)
How to fix compiler error?
Frank source share