std::type_info(3cxx)

πŸ’… std::type_info β€” a 3cxx moment

ok so bestie, welcome to std::type_info, straight out of the 3cxx manual section. This is the little class that's part of RTTI β€” yes, runtime type info, the thing that knows who's who when your objects are being shady at runtime. ✨


🌸 NAME 🌸

std::type_info β€” literally part of RTTI, that's the whole vibe.


πŸŽ€ SYNOPSIS πŸŽ€

#include <typeinfo>

πŸ’– Inherited by

This icon is the parent of a whole friend group, no cap:

  • __cxxabiv1::__array_type_info
  • __cxxabiv1::__class_type_info
  • __cxxabiv1::__enum_type_info
  • __cxxabiv1::__function_type_info
  • __cxxabiv1::__fundamental_type_info
  • __cxxabiv1::__pbase_type_info

🌈 Public Member Functions

  • virtual ~type_info ()
  • virtual bool __do_catch (const type_info *__thr_type, void **__thr_obj, unsigned __outer) const
  • virtual bool __do_upcast (const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const
  • virtual bool __is_function_p () const
  • virtual bool __is_pointer_p () const
  • bool before (const type_info &__arg) const noexcept
  • size_t hash_code () const noexcept
  • const char * name () const noexcept
  • constexpr bool operator== (const type_info &__arg) const noexcept

πŸ¦‹ Protected Member Functions

  • type_info (const char *__n)

πŸ“ Protected Attributes

  • const char * __name

✨ DETAILED DESCRIPTION ✨

Part of RTTI. Periodt. πŸ’…

The type_info class describes type information generated by an implementation β€” so like, the compiler made this info, and type_info is the one holding it down and describing it. πŸ‘‘


🧚 CONSTRUCTOR & DESTRUCTOR DOCUMENTATION 🧚

πŸ’œ virtual std::type_info::~type_info () [virtual]

Okay so the destructor comes first β€” which sounds random but it's giving main character energy for a reason. Being the first non-inline virtual function, this controls in which translation unit the vtable gets emitted. The compiler uses that info to know where to emit the runtime-mandated type_info structures in the new-abi. So yeah, the destructor is lowkey running the whole operation. 😭πŸ”₯


⭐ MEMBER FUNCTION DOCUMENTATION ⭐

🌸 bool std::type_info::before (const type_info & __arg) const [noexcept]

Returns true if *this precedes __arg in the implementation's collation order. That's it, that's the function β€” a little ordering vibe check. 🫢

🌈 const char * std::type_info::name () const [inline], [noexcept]

Returns an implementation-defined byte string β€” and bestie, hear me: this is not portable between compilers! 🚨 Don't be out here assuming name() gives you the same thing everywhere, because it will not. πŸ™ˆ

Lowkey important: implementation-defined means the implementation defines it. Not you. Not your friend's compiler. Respect the boundary fr fr. πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. So nobody hand-wrote this, the robots did it, and honestly? Slay. πŸ€–βœ¨


okay that's the whole page, mwah πŸ’‹ β€” this little icon came to you from libstdc++, filed under std::type_info(3cxx), and it's a whole vibe. go forth and RTTI responsibly πŸ¦‹πŸ’–

πŸ“¦ where this page comes from