C++では、テンプレート化されたオブジェクトのテンプレート化された関数を特殊化しようとしています。ここでテンプレート化されたクラスのためのテンプレート化された関数の特殊化
は、基本的な例である: TEST.H:
In file included from test.cpp:1:0:
test.h:13:25: error: too many template parameter lists in declaration of ‘void f(myC<T>)’
test.h:13:6: error: template-id ‘f<myC<T> >’ for ‘void f(myC<T>)’ does not match any template declaration
test.h:13:25: note: saw 2 ‘template<>’, need 1 for specializing a member function template
:
template <class T>
class myC {
T x;
};
template <class U>
void f(U y) {
}
template <>
template <class T>
void f<myC<T> >(myC<T> y) {
}
TEST.CPP
#include "test.h"
int main() {
myC<double> m;
f(m);
}
GCC 4.6.1は私に次のエラーメッセージが表示されますこれはすべての可能でますか?あるいは、同じ目標を達成する別の方法がありますか?
C++ 11では導入されていませんでしたか? –