Hi, I just found out how the common_type traits is being implemented and I don't really understand one part of it. This is the magic line that picks the common type from 2 types
If the 1st part of expression is always true? how can this actually be working. I tested it out and the true can also be changed to false and it would still work.
decltype doesn't evaluate the expression so it doesn't matter what values are being used. What matters are the types.
In C++ the return type of an expression is always known at compile time. It is not possible for the expression to sometimes return one type and in other situation return some other type. This is true also for the ternary operator. The type that the ternary operator returns is the common type of two types.