本文整理汇总了C++中SNode::left方法的典型用法代码示例。如果您正苦于以下问题:C++ SNode::left方法的具体用法?C++ SNode::left怎么用?C++ SNode::left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SNode
的用法示例。
在下文中一共展示了SNode::left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DISABLEDEBUGSTRING
SNodeArray &StmtList::removeUnusedAssignments() {
DISABLEDEBUGSTRING(*this);
bool stable;
do {
stable = true;
const size_t childCount = size(), stmtCount = childCount-1;
for(size_t i = 0; i < stmtCount; i++) {
SNode assign = (*this)[i];
SNode expr = assign.right();
if(expr.isName()) {
getTree().unmarkAll();
assign.left().mark();
getTree().traverseTree(NameSubstituter(assign.left().getName(), expr.getName()));
getTree().unmarkAll();
remove(i);
stable = false;
break;
}
}
} while(!stable);
for(int i = (int)size()-1; i--;) { // Remove unused assignments
const SNode &stmt = (*this)[i];
const String &varName = stmt.left().getName();
bool isUsed = false;
for(size_t j = i+1; j < size(); j++) {
if((*this)[j].dependsOn(varName)) {
isUsed = true;
break;
}
}
if(!isUsed) {
remove(i);
}
}
ENABLEDEBUGSTRING(*this);
return *this;
}
示例2: multiplyFactorSum
SNode SNode::multiplyFactorSum(SNode factor, SNode sum) const {
ENTERMETHOD2(factor,sum);
CHECKNODETYPE(factor,NT_POWER);
CHECKNODETYPE(sum ,NT_SUM );
if((factor.base().getSymbol() == SUM) && factor.exponent().isOne()) {
RETURNNODE(multiplySumSum(factor.base(),sum));
} else {
const AddentArray &sa = sum.getAddentArray();
AddentArray tmp(sa.getTree(),sa.size());
for(size_t i = 0; i < sa.size(); i++) {
SNode e = sa[i];
tmp.add(addentExp(factor * e.left(),e.isPositive()));
}
RETURNNODE( sumExp(tmp) );
}
}