【发布时间】:2011-05-27 23:10:16
【问题描述】:
在使用 c++ 中的模板时,我遇到了将类型名 T 转换为字符串的问题。例如:
template <typename T>
class Matrix {
public:
Matrix() {
//my_type = string type of T. i.e. if T is char. I want my_type to be "char".
}
string my_type;
}
如何将 T 转换为表示 T 是什么的字符串。
注意:我只是在玩,所以请不要担心什么时候可能需要这样的东西。
【问题讨论】: