On Feb 27, 2014, at 4:21 PM, Markus Engel wrote:
Ideally we can get to the situation where we don't need dynamic_cast<> at
all, and code will just work directly with standard C++ inheritance. Be careful, Johan's gonna laugh at you ;) . I said exactly that some time ago... look for "Code style question".
:-)
A bit part of the problem is that The C approach of GTK+ adds in the "is-a" checking on things. We often end up with things upside down from a C++ perspective. That could be part of the problem with getting a nice template. Since it is 'unnatural' C++, the code to pull it off is not as simple as we would like.
Instead of having low-level thing foo poke into bar which is a subclass of baz, we might want to have foo invoke a base 'state-has-changed' method of the parent class baz which in turn gets processed in bar via an overloaded virtual, etc.