【发布时间】:2009-10-27 08:25:11
【问题描述】:
我有以下代码可以编译并且运行良好:
template<typename T>
T GetGlobal(const char *name);
template<>
int GetGlobal<int>(const char *name);
template<>
double GetGlobal<double>(const char *name);
但是我想删除“默认”功能。也就是说,我想对 GetGlobal
例如 GetGlobal
我试图只删除默认函数,但正如我想象的那样,我收到了很多错误。那么有没有办法“禁用”它并只允许调用该函数的专用版本?
谢谢!
【问题讨论】:
标签: c++ templates specialization