查看 C++ RTTI 和 type_info 类时,我有时会发现一个被调用的方法的描述,该方法raw_name()
用于返回类的解组名称。我在 g++ 中找不到任何实现,只有方法name()
。您知道这是否是仅针对 Visual Studio/MS 的实现,以及是否是 C++ 标准的一部分?
问问题
643 次
2 回答
3
一个快速的谷歌将向您展示raw_name()
仅由 Microsoft 记录的内容。它不是 C++ 的一部分。
于 2013-02-11T12:05:18.103 回答
3
它是特定于实现的,type_info
在标准中定义:
C++03 标准:18.7.1 类 type_info:
namespace std {
class type_info {
public:
virtual ~type_info();
bool operator==(const type_info& rhs) const noexcept;
bool operator!=(const type_info& rhs) const noexcept;
bool before(const type_info& rhs) const noexcept;
size_t hash_code() const noexcept;
const char* name() const noexcept;
type_info(const type_info& rhs) = delete; // cannot be copied
type_info& operator=(const type_info& rhs) = delete; // cannot be copied
};
}
如您所见raw_data
,它不是标准定义的类成员。
于 2013-02-11T12:05:34.147 回答