要显式实例化模板函数,请在 template 关键字后接函数的声明(不是定义),且函数标识符后接模板参数。
template float twice<float>(float original);
在编译器可以推断出模板参数时,模板参数可以省略。
template int twice(int original);