将是赋值运算符(=
)返回左(或右)部分的值?
QVector<function>::Iterator it;
binOp *bpl = nullptr;
bool b1 = (bpl = dynamic_cast<binOp *>(&*(it-2))) != nullptr;
所以,我有我自己的类(binOp: function),我尝试使用dynamic_cast into expression。如果我对bpl
进行赋值,它是否等于bpl
,就像这样?:
bpl = dynamic_cast<binOp *>(&*(it-2)));
bool b2 = bpl != nullptr;
那么b1等于b2吗?
=
赋值操作符返回对左操作数的引用。所以,你的第一个例子将工作得很好,结果将等同于你的第二个例子。