为什么第一个返回引用?
int x = 1; int y = 2; (x > y ? x : y) = 100;
而第二个不?
int x = 1; long y = 2; (x > y ? x : y) = 100;
实际上,第二个根本没有编译 - "没有左边的赋值".
c++ types reference conditional-operator lvalue
c++ ×1
conditional-operator ×1
lvalue ×1
reference ×1
types ×1