On 16/11/2013 16:58, Antony Polukhin wrote:
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>().
Yes, but I meant given : #define SOME_MACRO_IN_MY_LIBRARY( variable ) do_something_complicated_requiring_type_info_of_type_of_variable I cannot use boost::type_info<T>() easily can I ? Granted I could do boost::type_info< BOOST_TYPEOF( variable ) >() but that's a bit cumbersome compared to for instance a simple boost::type_info( variable ). Thanks, MAT.