我最近在代码库中看到了以下内容:
bool bRes = (a < b) ? a=b, true : false;
如果a < b,则a=b执行并且bRes为真.到底发生了什么?条件运算符的文档没有提及关于链接表达式的任何内容.
a < b
a=b
bRes
编辑:要清楚我得到条件运算符部分,它a=b, true是一个让我困惑的单个表达式.
a=b, true
c++ conditional-operator
c++ ×1
conditional-operator ×1