I made a type_traits working example that selects the print function from two alternatives depending on the compile-time type specification:
Coliru Viewer
I want to extend this to choosing between three (or more) types at compile time where either
(a) two of the types are in turn inherited from a common base class:
Coliru Viewer
error: ambiguous call of overloaded function, or ...
(b) two separate types without inheritance:
Coliru Viewer
error: invalid initialization of reference of type 'a' from expression of type 'b' and vice-versa
Sure, I could explicitly specialize the templates for the two separate types but my question is whether type_traits only handles either-or cases or else how can it be extended to handle multiple types with/out inheritance?
Many thanks