I wanted to use 'typeid' like I would use 'instanceof' in java. What's the easiest and best way to facilitate this in C++? Also, does typeid( parameter ).name() return a mangled string of some sort, or the actual clear name of the class to use for a means of comparison? Should I just declare an arbitrary object of a certain type, and use it as a means of comparison of my current object? Any help would be great.
Code:
In this example, value can be any class in a hiearchy I am working with
Arbitrary x;
if( typeid( value ) == typeid( x ) ) //check if value is of type x (Arbitrary). Or would I have to use .name() for both of them?
if( typeid( value ).name() == "Arbitrary" ) or if( typeid( value ).name() == Arbitrary ) //Check for string comparison, for whichever one is the proper way of coding it