Chris Shearer Cooper wrote:
I am pretty sure that doesn't work ... it won't dynamic cast from something that isn't an object 'cuz if it doesn't optimize it away, it does it using a virtual function at run-time ...
How about: A* ap = ...; void* vp = reinterpret_cast<void*>(ap); D* dp = dynamic_cast<A*>(reinterpret_cast<A*>(vp));
If the compiler optimises that away, I'm not only impressed, I'm confused as to why it would. Consider whether there is a simpler way to do what you /really/ want to do. (If you are doing stuff like this, there almost always is.)
_______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
