当前位置: 首页>>代码示例>>C++>>正文


C++ Nodes::insert方法代码示例

本文整理汇总了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);
}
开发者ID:juliawong,项目名称:souffle,代码行数:32,代码来源:matching_test.cpp

示例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;
}
开发者ID:grammarhoard,项目名称:2014-rosu-inference-cpp,代码行数:26,代码来源:Apta.cpp

示例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;
    }
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp

示例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];
};
开发者ID:mdrichar,项目名称:POGDDL,代码行数:26,代码来源:typecheck.cpp

示例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;
};
开发者ID:mdrichar,项目名称:POGDDL,代码行数:28,代码来源:typecheck.cpp

示例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;
}
开发者ID:artacc,项目名称:DataCenters,代码行数:32,代码来源:networkManager.cpp

示例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));
   }
}
开发者ID:linuxsoftware,项目名称:tools,代码行数:16,代码来源:treeify.C


注:本文中的Nodes::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。