65,198
社区成员




template<typename T> //template
void foo(T t)
{
cout << t << endl;
return;
}
template void foo<double>(double); //Instantiation
template <> void foo<double>(double d) //Specialization
{
cout << "this is " << d << endl;
}
int main(int argv, char **argc)
{
foo(1.0);
return 0;
}
template<typename T> //template
void foo(T t)
{
cout << t << endl;
return;
}
template <> void foo<double>(double d) //Specialization
{
cout << "this is " << d << endl;
}
template void foo<double>(double); //Instantiation
int main(int argv, char **argc)
{
foo(1.0);
return 0;
}