Header Reference: <typeinfo>
Header Reference: <typeinfo>
Runtime type information objects and related exception types provided by <typeinfo>.
Header Reference: <typeinfo>
Runtime type information objects and related exception types provided by <typeinfo>.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
Header reference pages are meant to answer a practical question quickly: what this header provides, when to reach for it, and which usage rules are easiest to get wrong.
<typeinfo>std::type_infostd::bad_caststd::bad_typeidUse <typeinfo> when working with runtime type identification through typeid and RTTI-related failure types.
typeiddynamic_cast and typeid(*ptr) on null polymorphic pointerstypeid on a polymorphic glvalue may evaluate dynamic type; on non-polymorphic expressions it reflects static type.#include <typeinfo>
int main() {
// Start with the primary facility from <typeinfo>.
// Then verify lifetime, invalidation, ordering, or error-handling rules.
return 0;
}