
18 Jul
2006
18 Jul
'06
6:56 p.m.
Personally I would prefer it if handlers automatically got the same order as would be provided by overload resolution. It's almost always a mistake to write
catch(Base&) { ... } catch(Derived&) { ... }
Surely it would be possible to reorder the type list that catcher uses (which it gets from the exception handling class, such as my_exception_handler) so that the order is always from most derived (such as Derived&) to least derived (such as Base&). Is there an MPL algorithm somewhere that will do that? I feel certain that I saw some code by Andrei Alexandrescu that did something along those lines. Jeremy