Hello,
I'm trying to find a solution to the following problem. Given types A, B
and C such that C is derived from B and B is derived from A, and a
sequence S1 which stores A, B and C (in arbitrary order):
1) transform S1 so resulting sequence S2 would have elements sorted
according to their relative position within their inheritance hierarchy
(say, most derived first).
2) when one introduces another type, D, which doesn't inherit from any
of A, B or C, after sorting S1, it would end up at the end of S2.
3) the solution needs to be unintrusive for the "input" types, that is,
it ought to work for existing types.
Example
-------
Input:
S1 = { A, C, D, B };
Expected result, after sorting:
S2 = { C, B, A, D };
Purpose
-------
By finding a way to sort S1 according to predicates listed above, I hope
to come up with a generic exception-handling mechanism (used in RPC-like
library), example:
typedef vector