本文整理汇总了C++中ASTNodeSet::count方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNodeSet::count方法的具体用法?C++ ASTNodeSet::count怎么用?C++ ASTNodeSet::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNodeSet
的用法示例。
在下文中一共展示了ASTNodeSet::count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VarSeenInTerm
bool VariablesInExpression::VarSeenInTerm(const ASTNode& var,
const ASTNode& term) {
// This only returns true if we are searching for variables that aren't arrays.
assert(var.GetKind() == SYMBOL && var.GetIndexWidth() == 0);
if (term.isConstant())
return false;
getSymbol(term);
SymbolPtrSet visited;
ASTNodeSet *symbols = new ASTNodeSet();
vector<Symbols*> av;
VarSeenInTerm(symbol_graph[term.GetNodeNum()], visited, *symbols, av);
bool result = (symbols->count(var) != 0);
//cerr << "visited:" << visited.size() << endl;
//cerr << "av:" << av.size() << endl;
//cerr << "Term is const" << term.isConstant() << endl;
if (visited.size() > 250) // No use caching it, unless we've done some work.
{
sort(av.begin(), av.end());
//cout << "===" << endl;
for (size_t i = 0; i < av.size(); i++) {
if (i!=0 && av[i] == av[i-1])
continue;
const ASTNodeSet& sym = *TermsAlreadySeenMap.find(av[i])->second;
//cout << "set: " << i << " " << sym.size() << endl;
symbols->insert(sym.begin(), sym.end());
}
TermsAlreadySeenMap.insert(make_pair(symbol_graph[term.GetNodeNum()], symbols));
//cout << "finish" << symbols->size() << endl;
//cout << "===" << endl;
result = (symbols->count(var) != 0);
} else {
const int size = av.size();
for (int i = 0; i < size; i++) {
if (result)
break;
const ASTNodeSet& sym = *TermsAlreadySeenMap.find(av[i])->second;
result |= (sym.find(var) != sym.end());
}
delete symbols;
}
return result;
}