本文整理汇总了C++中ASTNodeSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNodeSet::size方法的具体用法?C++ ASTNodeSet::size怎么用?C++ ASTNodeSet::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNodeSet
的用法示例。
在下文中一共展示了ASTNodeSet::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loops
// If n0 is replaced by n1 in the substitution map. Will it cause a loop?
// i.e. will the dependency graph be an acyclic graph still.
// For example, if we have x = F(y,z,w), it would make the substitutionMap loop
// if there's already z = F(x).
bool SubstitutionMap::loops(const ASTNode& n0, const ASTNode& n1)
{
if (n0.GetKind() != SYMBOL)
return false; // sometimes this function is called with constants on the
// lhs.
if (n1.isConstant())
return false; // constants contain no variables. Can't loop.
// We are adding an edge FROM n0, so unless there is already an edge TO n0,
// there is no change it can loop. Unless adding this would add a TO and FROM
// edge.
if (rhs.find(n0) == rhs.end())
{
return vars.VarSeenInTerm(n0, n1);
}
if (n1.GetKind() == SYMBOL && dependsOn.find(n1) == dependsOn.end())
return false; // The rhs is a symbol and doesn't appear.
if (debug_substn)
cout << loopCount++ << endl;
bool destruct = true;
ASTNodeSet* dependN = vars.SetofVarsSeenInTerm(n1, destruct);
if (debug_substn)
{
cout << n0 << " "
<< n1.GetNodeNum(); //<< " Expression size:" << bm->NodeSize(n1,true);
cout << "Variables in expression: " << dependN->size() << endl;
}
set<ASTNode> depend(dependN->begin(), dependN->end());
if (destruct)
delete dependN;
set<ASTNode> visited;
loops_helper(depend, visited);
bool loops = visited.find(n0) != visited.end();
if (debug_substn)
cout << "Visited:" << visited.size() << "Loops:" << loops << endl;
return (loops);
}