I would like to determine at compile time if a pointer to Derived can be cast from a pointer to Base without dynamic_cast<>. Is this possible using templates and metaprogramm
If you want to know at compile time you can take the derived class as an parameter but, if the only thing you have is the Base then you cannot know whether it refers to any of the foo,bar,etc.. class. This check can only be done where the pointer is converted to a Base. I think that's the whole purpose of dynamic_cast<>