本文整理汇总了C++中ChildList::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ChildList::clear方法的具体用法?C++ ChildList::clear怎么用?C++ ChildList::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChildList
的用法示例。
在下文中一共展示了ChildList::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noDuplicateNodes
// Compares all pairs of children, finding and removing duplicate BTERMs
void noDuplicateNodes( ChildList &l )
{
//This is shallow!
//ONLY SAFE WHEN DELETING BTERMS for now (note is prev to Aug 2009)
// BK Aug 21, 2009: seems to be deep compare and deep delete
ChildList dups;
CLIter n1 = l.begin();
CLIter n2 = ++(l.begin());
CLIter end = l.end();
while( n1 != end ){
//assert((*n1)->t == BTERM);
while( n2 != end ){
//Comparison
if( (*n1)->equals(*n2) ){
dups.push_back(*n2);
}
n2++;
}
n1++;
n2 = n1;
n2++;
}
dups.sort();
dups.unique();
for(n2 = dups.begin(); n2 != dups.end(); n2++){
for(n1 = l.begin(); n1 != l.end(); n1++){
if(*n1 == *n2){
(*n1)->destroyTree();
l.erase(n1);
break;
}
}
}
dups.clear();
}
示例2: rebuildChildrenList
void Window::rebuildChildrenList()
{
mChildren.clear();
EnumChildWindows(mHWND, sCollectChildrenCallback, reinterpret_cast<LPARAM>(this));
}
示例3: toDNF
///////////////////////
// Post-condition (memory management):
// Always return a pointer to this node.
//
SymNode* SymNode::toDNF(){
debout("toDNF");
CLIter iter,end,dup;
if( t == BTERM || t == FTYPE || t == ETYPE || t == TTYPE){
debout("p:isLiteral");
return this;
}
//Ensure all of the clauses are in DNF
iter = children.begin();
end = children.end();
ChildList *newList = new ChildList();
while( iter != end ){
debout("loop:p1");
SymNode *returned;
returned = (*iter)->toDNF();
if( returned != NULL ){
newList->push_back(*iter);
}
iter++;
}
debout("p2");
this->children.swap( *newList );
newList->clear();
delete newList;
deboutnn( "toDNF: children.size(): ");
debout(children.size() );
//All chilren are false if they have been pruned by DNF
if( children.empty() ){
debout("p:shouldn\'t be happening");
assert(0);
this->destroyTree();
return new SymNode(FTYPE,-1);
}
debout("p3");
if( t == SOR ){
debout("p3.1");
//Then we are fine because all of the clauses are in DNF
this->removeParens();
//noDuplicateNodes(this->children);
return this;
} else if( t == SAND ){
debout("p4");
//We need to distribute "and" over the clauses that are in DNF already
//It's exponential time!!!!!!!!!
//TEMP MARK
// BK: this never happens, because distribute has not line: return 0;
if( this->distribute() == 0 ){
assert(0); //Shouldn't be happening
debout("p6 this->distribute() == 0");
//The children are false according to our restrictions and so this is false and therefor useless
this->destroyTree(); // BK fixed possible leak
delete this;
return new SymNode(FTYPE,-1);
}
debout("p5");
//noDuplicateNodes(this->children);
return this;
}else{
//raise exception "not" is not implemented
assert(0);
}
return NULL;
}