Hi,
In my application, there is a inheritance hierarchy in which only the classes that are at the end of the inheritance chain are non-abstract classes. Also there is some usage of boost::variant. I want to write a function which takes a pointer and a Type and says whether the object belongs to that type.
For example
template< typename Type, bool TypeisAbstract, typename ptrType >
bool checkType( ptrType* t)
{
return ( typeid(*t) == typeid(Type) );
}
template< typename Type, typename ptrType >
bool checkType<Type, true, ptrType>( ptrType* t)
{
return ( dynamic_cast<Type*>(t) != NULL );
}
Now if there is a boost variant, i want to find out whether the boost variant stores that particular type. Can someone help me with that?
Thanks,
Gokul.