typeid

    9热度

    2回答

    Andrei Alexandrescu中写道Modern C++ Design: 通过typeid返回的对象具有 静态存储,所以你不必 担心寿命问题。 安德烈继续说: 标准不保证 的,比如每次调用,typeid(int) 返回到相同的 type_info对象的引用。 即使标准不能保证这一点,这是如何在普通的编译器中实现的,比如GCC和Visual Studio? 假设typeid不泄漏(并且每次调

    7热度

    3回答

    我们有一个子项目'commonUtils',它有许多在父项目中使用的通用代码片段。 一个这样有趣的东西我看到的是: - /********************************************************************* If T is polymorphic, the compiler is required to evaluate the typeid