The ternary conditional expression type is a generic type 2, which both operands are con & shy; ver & shy; tible. You can definitely not run the “dynamic overload resolution” as you seem to suggest.
Since there is no common type for int and char const * , the code will not even compile (as you are sure, and shyly noticed when you tested it).
(You may be delighted that the terminological condition is used precisely because of semantics when implementing the class std::common_type , together with decltype .)
(If the condition is known statically, for example sizeof(int) != 7 , then you can use the spe & shy; cia & shy; lization pattern to write similar code that does conditional overload resolution, but, of course, statically.)
Kerrek SB
source share