2013/11/15 Mathieu Champlon
Hi,
Quickly skimming the documentation and code I'm just wondering what exactly would be the problem if I were to do :
template <class T> const type_info& my_type_id( const T& ) { return type_info::construct<T>(); }
my_type_id( variable ) // instead of boost::type_id_rtti_only(variable)
?
type_info::construct<T>() works with the type T, while boost::type_id_rtti_only(variable) attempts to determinate the real type of variable. Here's an example: class Base { virtual *~*Base(){} }; class Derived: public Base {}; ... Derived d; Base& variable = d; my_type_id( variable ).name_demangled(); // returns `Base` boost::type_id_rtti_only(variable).name_demangled(); // returns `Derived ` -- Best regards, Antony Polukhin