Why reinventing the wheel? AFAIK C++ has a pretty good RTTI... Doing it by hand seems to me quite error prone and distracting (and I don't want to know what happens when subclassing). Had to do that in the old borland C++ days (no templates, Borland intrusive containers), didn't like it:D
In fact good design practices (at least in OO) would condemn the whole KICAD_T enum :P I think that instead of using such kind of expedient better (virtual) interfaces (in the java sense, pure abstracts to be implemented) should be designed with a refactoring. That is, if you want to use C++ in the OO way (in imperative style I'd simply have checked the type member, without all that template fluff). I guess it's made for performance reason; in the past I actually checked the dynamic_cast implementation and it involves a call and some traversing; probably that's inevitable for supporting correctly the mess of inheritance supported by C++. Given the templating of both dyn_cast and ClassOf, code would be pretty tight; too bad it's horrible to write and read:P My opinion, of course (and as you know I'm not exactly a fan of OOP :D). (yes, it would break the routines and split them all over the singular object and you'll take forever to follow the flow; one of the reasons for me not liking OO) -- Lorenzo Marcantonio Logos Srl _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp