Do I need to recompile qmake with the exceptions, rtti and stl flags to get dynamic_cast to work with QT? I'm using Visual C++ 2005 and the /GR flag is enabled (by default).
I'm asking because have implemented a simple Composite Pattern and I need to find out whether the Component is a Leaf or a Composite. This is what I would like to do:
However, in practice the exception is never thrown and the program dies because of memory access violations.Qt Code:
try { Leaf* leaf = dynamic_cast<Leaf*>(component); //A Leaf } catch (std::bad_cast e) { //Not a Leaf }To copy to clipboard, switch view to plain text mode
Bookmarks