Standard library header <typeinfo>

From cppreference.com
< cpp‎ | header

This header is part of the type support library.

Contents

[edit] Classes

contains some type's information, generated by the implementation.
This is the class, returned by the typeid operator
(class)
exception that is thrown if an argument in a typeid expression is null
(class)
exception that is thrown by an invalid dynamic_cast expression, i.e. a cast of reference type fails
(class)

[edit] Synopsis

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

[edit] Class std::type_info

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
};


[edit] Class std::bad_cast

class bad_cast : public exception {
public:
    bad_cast() noexcept;
    bad_cast(const bad_cast&) noexcept;
    bad_cast& operator=(const bad_cast&) noexcept;
    virtual const char* what() const noexcept;
};

[edit] Class std::bad_typeid

class bad_typeid : public exception {
public:
    bad_typeid() noexcept;
    bad_typeid(const bad_typeid&) noexcept;
    bad_typeid& operator=(const bad_typeid&) noexcept;
    virtual const char* what() const noexcept;
};