Regarding this question: When to use reinterpret_cast?
I found sth. like this:
template<typename T> bool addModuleFactoryToViewingFactory(ViewingPackage::ViewingFactory* pViewingFactory)
{
static_cast<ModuleFactory*>(reinterpret_cast<T*>(0)); // Inheritance compile time check
...
}
Is this a good way to check whether T
can be casted to ModuleFactory
at compile time?
I mean, to check if the programmer put valid stuff into the <>
of addModuleFactoryToViewingFactory<T>(...)
Is this okay, good or maybe the only way?
Greetings