本文整理汇总了C++中Symbols::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbols::empty方法的具体用法?C++ Symbols::empty怎么用?C++ Symbols::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbols
的用法示例。
在下文中一共展示了Symbols::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSymbol
// This builds a reduced version of a graph, where there
// is only a new node if the number of non-array SYMBOLS
// in the descendents changes. For example (EXTRACT 0 1 n)
// will have the same "Symbols" node as n, because
// no new symbols are introduced.
Symbols* VariablesInExpression::getSymbol(const ASTNode& n) {
if (symbol_graph.find(n.GetNodeNum()) != symbol_graph.end()) {
return symbol_graph[n.GetNodeNum()];
}
Symbols* node;
// Note we skip array variables. We never solve for them so
// can ignore them.
if (n.GetKind() == SYMBOL && n.GetIndexWidth() == 0) {
node = new Symbols(n);
insert(n, node);
return node;
}
vector<Symbols*> children;
for (size_t i = 0; i < n.Degree(); i++) {
Symbols* v = getSymbol(n[i]);
if (!v->empty())
children.push_back(v);
}
if (children.size() == 1) {
// If there is only a single child with a symbol. Then jump to it.
node = children.back();
} else
node = new Symbols(children);
insert(n, node);
return node;
}