6
を「プロトタイプが一致しない」:テンプレートの部分特殊化:私は部分的にuntemplatedクラスのテンプレートメンバ関数を特化しようとしている
#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);
}
私は次のエラー取得しています:
を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)
コンパイラエラーを修正するにはどうすればよいですか?