Let's say I have a function that takes two different templated arguments:
template<typename T, typename U>
void fun(T t, U u);
Types T and U are part of the same inheritance tree. I'd like to get the most specific class that they both inherit from.
typedef /*something*/ shared_parent;
For example, if type T
and type U
are the same type, I want that type. If type T
inherits from type U
, I want type U
. If Type T
and type U
both inherit from the same parent, I want that parent.
If types T
and U
are not part of the same inheritance tree, I don't care what happens.