我最近意识到你可以在 GCC 和 clang 中使用三元运算符而无需中间(
?:
? :
// outputs 2 cout << (2 ?: 4); // outputs 3 cout << (0 ? : 3);
这在标准中的什么地方?我看了一下,没有看到任何东西。
它根本不符合标准。
https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html
bool
之前的第一个操作数获取。