Sun Studio 12 Update 1:C++ 用户指南

6.3.2.1 模板函数的显式实例化

要显式实例化模板函数,请在 template 关键字后接函数的声明(不是定义),且函数标识符后接模板参数。


template float twice<float>(float original);

在编译器可以推断出模板参数时,模板参数可以省略。


template int twice(int original);