2013/11/16 Mathieu Champlon
Do you think getting the type info of the "current" type of a variable (as opposed to it's real type) could sometimes prove useful ? Could it be worth adding a function in TypeIndex ?
This is a very very common use case in Boost and widely used technique in libraries that use type erasure. Examples are Boost.Function, Boost.Any, Boost,Graph, Boost.Math and others... Such function is already in TypeIndex library, see boost::type_info<T>(). Also using a local type as a template argument is illegal in C++03 (not in
C++11 any more). For instance :
void f() { struct s {}; boost::type_id< s >(); // illegal in C++03 typeid( s ); // legal }
Maybe it should be stated in the documentation as this is an area where boost::type_id is not a drop-in replacement for typeid (in C++03) ?
Neat example, but I don't think that this must be mentioned in TypeIndex docs. This is a C++03 related restriction and a rare use case, so it will just complicate the docs. -- Best regards, Antony Polukhin