RTTR uses an own, in C++ implemented, alternative to the build in RTTI mechanism of C++. The reason for that are problems when using
typeid across shared boundaries, execution speed and sometimes not correct implemented. That means it is possible to disable RTTI completly in your target application and use RTTR instead.
The entry point for all type related operation is the class type. It is the central class for retrieving type objects or also querying all kind information about types.
This function just expects one template argument. Use it to check against a known type.
Remark that when comparing types, internally always a simple integer comparison is done, instead how often with typeid, a string comparison.
This function takes a universal reference and returns from every given object the corresponding type object.
top level cv-qualifier of the given type
T will be removed.
This function just expects the name of the type. This is useful when you know only the name of the type and cannot include the type itself into the source code.
- Before using the function type::get_by_name(), you have to use one time the function via type::get<T>(), otherwise the type is not registered in the type system.
- type objects cannot be created, only retrieved via static member functions in the type class itself
- type objects are lightweight, they contain only a single integer ID
- every unique C++ type maps to the same unique ID, which will be used for comparing types
- type objects can be easily placed inside containers or maps
- retrieving a type object results always in the cv-unqualified type (
type::get(T)==type::get(const T)); same like
- retrieving a type object of a gvalue expression whose type is a polymorphic class, will refer to a type object representing the type of the most derived class