A type object contains automatically a lot of useful meta information, which exceeds the information of the standard type_info object.
The returned name of the function get_name() returns a compiler depended string. So don't use it directly when comparing with a string literal, but it is very useful for debugging purposes.
This functionality gets more useful when working with other components like properties or variants. For example: when you iterate over all properties of class you might not want to store the values of pointer types. Or you might want to group stuff together, like: give me all primitive properties of a class and so on.
It is also possible to retrieve information about the inheritance graph of a class.
Or use a shorthand method to check if a type is derived from another:
The meta information presented in the first code snipped (e.g. is_class(), is_pointer()) will work without registering anything manually to the type system. In order to retrieve class hierarchy informations, like get_base_classes() or is_derived_from(), you will have to add manually some information to the type system. How this will be done, is discussed in the next chapter.
- with a type object you can retrieve additional meta information at runtime