libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
Getting Type Information Of Types And Symbols

Introspecting types and symbols, and demangling their names, at run time. More...

Topics

 demangle_type() and demangle_symbol()
 Generated API reference for demangling C++ type and symbol names.

Classes

class  libcwd::TypeInfo
 Class that holds type information for debugging purposes. Returned by type_info_of(). More...

Functions

template<typename T>
TypeInfo const & libcwd::type_info_of ()
 Get type information of a given class or type.
template<typename T>
TypeInfo const & libcwd::type_info_of (T const &)
 Get type information of a given class instance.

Variables

TypeInfo const libcwd::unknown_type_info_c (0)
 Returned by type_info_of() for unknown types.

Detailed Description

The generated API reference documents type introspection, symbol lookup, and demangling helpers.

Function Documentation

◆ type_info_of() [1/2]

template<typename T>
TypeInfo const & libcwd::type_info_of ( )
inline

This specialization allows to specify a type without an object (for example by calling: type_info_of<int const>()).

As it doesn't ignore top-level qualifiers it is best suited to print for example template parameters. For example,

template<typename T>
void Foo::func(T const&)
{
Dout(dc::notice, "Calling Foo::func(" << type_info_of<T const&>().demangled_name() << ')');
}
#define Dout(cntrl,...)
Macro for writing debug output.
Definition debug.h:97
TypeInfo const & type_info_of()
Get type information of a given class or type.
Definition type_info.h:290

◆ type_info_of() [2/2]

template<typename T>
TypeInfo const & libcwd::type_info_of ( T const & )
inline

This template is used by passing an object to it, top level CV-qualifiers (and a possible reference) are ignored in the same way as does typeid() (see 5.2.8 Type identification of the ISO C++ standard).