命名空间
变体
操作

标准库头文件 <typeinfo>

来自 cppreference.cn
< cpp‎ | header
 
 
标准库头文件
算法
<algorithm>
<numeric>
字符串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文本处理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
时间
<chrono> (C++11)
<ctime>
C 兼容性
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此头文件是类型支持库的一部分。

目录

[编辑]

包含一些类型的信息,是由 typeid 运算符返回的类
(类) [编辑]
当 typeid 表达式中的参数为空时抛出的异常
(类) [编辑]
当无效的 dynamic_cast 表达式抛出的异常,即引用类型的转换失败时
(类) [编辑]

[编辑] 概要

namespace std {
  class type_info;
  class bad_cast;
  class bad_typeid;
}

[编辑] std::type_info

namespace std {
  class type_info {
  public:
    virtual ~type_info();
    constexpr 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&) = delete;                   // cannot be copied
    type_info& operator=(const type_info&) = delete;        // cannot be copied
  };
}

[编辑] std::bad_cast

namespace std {
  class bad_cast : public exception {
  public:
    // see [exception] for the specification of the special member functions
    const char* what() const noexcept override;
  };
}

[编辑] std::bad_typeid

namespace std {
  class bad_typeid : public exception {
  public:
    // see [exception] for the specification of the special member functions
    const char* what() const noexcept override;
  };
}