Namespaces
Variants

Standard library header <typeinfo>

From cppreference.net
Standard library headers

このヘッダは type support ライブラリの一部です。

目次

翻訳内容: - "Contents" → "目次" - "Synopsis" → "概要" - "Class" → "クラス" - C++標準ライブラリのクラス名(std::type_info、std::bad_cast、std::bad_typeid)は翻訳せず保持 - HTMLタグ、属性、数値、リンクは完全に保持 - フォーマットと構造は元のまま維持

クラス

いくつかの型の情報を含む、typeid演算子によって返されるクラス
(クラス)
typeid式 の引数がnullの場合にスローされる例外
(クラス)
無効な dynamic_cast 式によってスローされる例外、すなわち参照型のキャストが失敗した場合
(クラス)

概要

// all freestanding
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;
    type_info& operator=(const type_info&) = delete;
  };
}

クラス std::bad_cast

namespace std {
  class bad_cast : public exception
  {
  public:
    // 特殊メンバ関数の仕様については説明を参照
    constexpr const char* what() const noexcept override;
  };
}

クラス std::bad_typeid

namespace std {
  class bad_typeid : public exception
  {
  public:
    // 特殊メンバ関数の仕様については説明を参照
    constexpr const char* what() const noexcept override;
  };
}