ore*_*uro 3 c++ templates template-specialization
我尝试了像bellow一样的模板专业化.
#include<iostream>
using namespace std;
template<class T1, class T2>
T1 something(T2 a);
template<class T2>
double something(T2 a){
double b;
return b;
}
int main(){
something<double, double>(0.0);
}
Run Code Online (Sandbox Code Playgroud)
但是,这给了我一个compilatoin错误:
In function `main':
test.cpp:(.text+0x9): undefined reference to `double something<double, double>(double)'
Run Code Online (Sandbox Code Playgroud)
你能告诉我怎么解决吗?