小编use*_*452的帖子

使用C++中的模板函数确定常量

我想使用模板函数确定类型是否为const,例如:

template <typename TTYPE> bool IsConst(TTYPE) {return false;}

template <typename TTYPE> bool IsConst(const TTYPE) {return true;}
Run Code Online (Sandbox Code Playgroud)

但这不起作用,任何替代建议?

c++ templates const

5
推荐指数
1
解决办法
212
查看次数

标签 统计

c++ ×1

const ×1

templates ×1