本文整理汇总了C++中ChildList::pop_front方法的典型用法代码示例。如果您正苦于以下问题:C++ ChildList::pop_front方法的具体用法?C++ ChildList::pop_front怎么用?C++ ChildList::pop_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChildList
的用法示例。
在下文中一共展示了ChildList::pop_front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: distribute
///////////////////
// Post-conditions (memory management):
// Every node listed in bterms is either affixed to this node or deleted.
//
// Distributes a conjunction of clauses.
//
int SymNode::distribute(){
if(t != SAND){
cerr << "distribute called on a non \"and\" node"<<endl;
assert(t != SAND);
}
debout("d1");
//Ensure that there are no ANDs as children
removeParens();
debout("d1.1");
CLIter current;
ChildList * bterms = new ChildList();
current = children.begin();
// Separate the complex terms from the BTerms;
// children will contain only complex terms (i.e. ORs)
while( current != children.end() ){
if((*current)->t == BTERM){
bterms->push_back(*current);
current = children.erase(current);
}else{
current++;
}
}
debout("d2");
// Continue to call distr(Node,Node) until all of my children are
// distributed. Recall that children contain ONLY complex nodes.
while(children.size() > 1 ){
debout( "d3.1");
SymNode *result = distr( *(children.begin()), *(++children.begin()) );
// BK 8/21/2009 cull to save run-time
if (result->t != SAND){
for(CLIter rc = result->children.begin(); rc != result->children.end(); ){
if( (*rc)->cullNode2() ){
rc++;
}else{
rc = result->children.erase(rc);
}
}
}
// END BK 8/21/2009
children.pop_front();
children.pop_front();
debout("d3.2\nresult tree");
deb(result->printTree(0));
debout("d3.2.1");
//MARK added this
assert(result!=0);
if(result->t == SAND){
// Result is an AND node, so add its children to the bterms list
debout("result->t == SAND)");
bterms->splice(bterms->begin(),result->children);
noDuplicateNodes(*bterms);
delete result;
debout("leave result->t == SAND");
debout("bterms size: ");
deboutnn(bterms->size());
}else if( result->t == SOR ){
// Result being an OR, means we added to the children list
noDuplicateNodes(result->children);
addChild(result);
}else if(result->t == BTERM){
bterms->push_back(result);
}else if(result->t == FTYPE){
delete result;
}else{
cerr << "a returned result was not an \"and\" or an \"or\" or a BTERM" <<endl;
assert(0);
}
}
debout("d4");
if( children.size() == 0 && bterms->size() == 1 ){
cerr << "not possible yet.1" <<endl;
assert(0);
this->t = BTERM;
this->bt = (*(bterms->begin()))->bt;
delete bterms; // BK fixed unreachable leak
return 1;
}else if( children.size() == 0 && bterms->size() > 1){
//I stay an AND, but if we culled the ORs then I should be culled as well
//That scenario isn't implemented yet
children.swap(*bterms);
delete bterms;
return 1;
}else if( children.size() == 0 && bterms->size() == 0){
cerr << "not possible yet." <<endl;
assert(0);
}
// Distribute the leaf bterms into the remaining complex term.
debout("d5");
if( children.size() == 1 ){
//.........这里部分代码省略.........