On Thu, Nov 14, 2013 at 4:08 PM, Antony Polukhin
2013/11/14 Andrey Semashev
I think that these problems can be tackled by just having boost::type_index and boost::type_id. boost::type_index can implement the name functions we discussed and offer interfacing with std::type_info and implement workarounds for its bugs. boost::type_id (or preferably its variations) can solve problems with cv-qualification, references and visibility by wrapping the type before constructing boost::type_index.
The only reason for boost::type_info I see is to emulate RTTI when it's disabled. But as I see in the code, it is just an alias for template_info in this case. So perhaps we should just make it that - an alias to std::type_info or boost::template_info, depending on the configuration. This way it will just allow to use the type_info type portably, without preprocessor checks everywhere.
We are arguing about
class type_info: public std::type_info { ...};
vs
class type_info{ const std::type_info* ptr_; public: const std::type_info& get(); ... }; typedef ... std_type_info_if_exist_t;
Can you explain me once more, what are the advantages of the second solution?
No, I was thinking about something like this:
// type_index/type_info.hpp
namespace boost {
#if HAS_RTTI
typedef std::type_info type_info;
#else
typedef boost::template_info type_info;
#endif
}
// type_index/type_index.hpp
#include