本文整理汇总了C++中Nodes::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Nodes::insert方法的具体用法?C++ Nodes::insert怎么用?C++ Nodes::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nodes
的用法示例。
在下文中一共展示了Nodes::insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(Matching, StaticTest_2) {
TestAutoIndex order;
Nodes nodes;
order.addSearch(121);
nodes.insert(121);
order.addSearch(104);
nodes.insert(104);
order.addSearch(53);
nodes.insert(53);
order.addSearch(49);
nodes.insert(49);
order.addSearch(39);
nodes.insert(39);
order.addSearch(33);
nodes.insert(33);
order.addSearch(32);
nodes.insert(32);
order.addSearch(23);
nodes.insert(23);
order.addSearch(11);
nodes.insert(11);
order.addSearch(7);
nodes.insert(7);
order.solve();
int num = order.getNumMatchings();
EXPECT_EQ(num, 5);
}
示例2: generateData
void Apta::generateData()
{
Q nodeIds;
Fp acceptedNodes;
Fm rejectedNodes;
Nodes allNodes;
allNodes.insert(this->_redNodes.begin(), this->_redNodes.end());
allNodes.insert(this->_blueNodes.begin(), this->_blueNodes.end());
allNodes.insert(this->_whiteNodes.begin(), this->_whiteNodes.end());
for (pair<string, string> node : allNodes) {
if (node.second == Apta::ACCEPTED) {
acceptedNodes.insert(node.first);
} else if (node.second == Apta::REJECTED) {
rejectedNodes.insert(node.first);
}
nodeIds.insert(node.first);
}
this->_data.Q = nodeIds;
this->_data.Z = this->_alphabet;
this->_data.s = this->_rootId;
this->_data.Fp = acceptedNodes;
this->_data.Fm = rejectedNodes;
}
示例3: main
int main()
{
boost::archive::text_oarchive oa(std::cout);
using namespace Input::EMMA;
Nodes nodes;
nodes.address = "Mr.";
nodes.country = "Puerto Mazarique";
nodes.insert(nodes.end(), Node{"John", "Doe"});
nodes.insert(nodes.end(), Node{"Jane", "Greenwalt"});
nodes.insert(nodes.end(), Node{"Morgan", "Cheese"});
nodes.insert(nodes.end(), Node{"Walton", "Whiz"});
oa << nodes;
}
示例4: pt
const set<const TypeRef *> & TypeHierarchy::leaves(PTypeRef & t)
{
static Nodes empty;
GI gi = leafNodes.find(&t);
if(gi != leafNodes.end())
{
return (gi->second);
};
gi = downGraph.find(&t);
if(gi == downGraph.end()) return empty;
Nodes ns;
PTypeRef pt(0);
closure(downGraph,gi,ns,gi,&pt);
Nodes ms;
for(Nodes::const_iterator i = ns.begin();i != ns.end();++i)
{
Nodes xs;
gi = downGraph.find(*i);
closure(downGraph,gi,xs,gi,&pt);
if(xs.empty()) ms.insert(*i);
};
leafNodes[downGraph.find(&t)->first] = ms;
return leafNodes[downGraph.find(&t)->first];
};
示例5: closure
bool TypeHierarchy::closure(Graph & gr,GI & gi,Nodes & vs,GI & gs,const TypeRef * t)
{
if(gi == gr.end())
{
return false;
};
if(*(gi->first) == *t)
{
for(Nodes::const_iterator i = vs.begin();i != vs.end();++i)
{
gs->second.insert(*i);
//insert(vs.begin(),vs.end());
};
//gs->second.insert(vs.begin(),vs.end());
return true;
};
for(Nodes::iterator n = gi->second.begin();n != gi->second.end();++n)
{
if(vs.find(*n) == vs.end())
{
vs.insert(*n);
GI tmp = gr.find(*n);
if(closure(gr,tmp,vs,gs,t)) return true;
};
};
return false;
};
示例6: getNodeCandidates
Nodes NetworkManager::getNodeCandidates()
{
Nodes result;
while ( !depthSearcher->isExhausted() )
{
Elements elements = depthSearcher->getElementCandidates();
cerr << "[NM]\tDepth search returned " << elements.size() << endl;
for ( Elements::iterator i = elements.begin(); i != elements.end(); i++ )
{
Element * element = *i;
if ( ! element->isNode() )
continue;
Node * node = (Node *) element;
if ( rejectedNodes.find(node) != rejectedNodes.end() )
continue;
result.insert(node);
}
depthSearcher->increaseSearchSpace();
if ( !result.empty() )
break;
}
rejectedNodes.insert(result.begin(), result.end());
cerr << "[NM]\tPrepared " << result.size() << " candidates" << endl;
return result;
}
示例7: add
void Node::add(const string& str)
{
string::size_type pos = str.find(c_separator);
string name = str.substr(0, pos);
Node target(name);
CNodeIter iter = m_nodes.find(&target);
if (iter == m_nodes.end()) {
iter = m_nodes.insert(new Node(name)).first;
}
if (pos != string::npos) {
Node* pNode = *iter;
pNode->add(str.substr(pos + 1));
}
}