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


C++ unordered_set::find方法代码示例

本文整理汇总了C++中boost::unordered_set::find方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_set::find方法的具体用法?C++ unordered_set::find怎么用?C++ unordered_set::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::unordered_set的用法示例。


在下文中一共展示了unordered_set::find方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TRACE

PNS_NODE::~PNS_NODE()
{
    TRACE( 0, "PNS_NODE::delete %p", this );

    if( !m_children.empty() )
    {
        TRACEn( 0, "attempting to free a node that has kids.\n" );
        assert( false );
    }

#ifdef DEBUG
    if( allocNodes.find( this ) == allocNodes.end() )
    {
        TRACEn( 0, "attempting to free an already-free'd node.\n" );
        assert( false );
    }

    allocNodes.erase( this );
#endif

    for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
    {
        if( (*i)->BelongsTo( this ) )
            delete *i;
    }


    releaseGarbage();
    unlinkParent();

    delete m_index;
}
开发者ID:abwilliams,项目名称:kicad-source-mirror,代码行数:32,代码来源:pns_node.cpp

示例2: collect_vnodes

void VNode::collect_vnodes(boost::unordered_set<Node*>& nodes,uint& total)
{
	total++;
	boost::unordered_set<Node*>::iterator it = nodes.find(this);
	if(it==nodes.end())
		nodes.insert(this);
}
开发者ID:fqiang,项目名称:psmg,代码行数:7,代码来源:VNode.cpp

示例3: dfs

void cluster_machine::dfs(const size_t curr, boost::unordered_set<size_t> &vis)
{
    vis.insert(curr);
    for (size_t e = first_[curr]; e != -1; e = next_[e]) {
        if ( vis.find(v_[e]) == vis.end() )
            dfs(v_[e], vis);
    }
}
开发者ID:wegatron,项目名称:embedded_thin_shell,代码行数:8,代码来源:cluster.cpp

示例4: update

		void update(const key_type& inKey, const boost::unordered_set<value_type>& inValues)
			{
				{
				boost::unordered_set<value_type> curValues(getValues(inKey));
				for (auto it = curValues.begin(); it != curValues.end(); ++it)
					if (inValues.find(*it) == inValues.end())
						drop(inKey, *it);
				}

			insert(inKey, inValues);
			}
开发者ID:WantonSoup,项目名称:ufora,代码行数:11,代码来源:UnorderedTwoWaySetMap.hpp

示例5: collectShortcuts

static bool collectShortcuts(const std::string & str, StringVector & vs) 
{
	static boost::unordered_set<std::string> commonFilters;
	if(commonFilters.empty()) {
#if RULE_KEY_HASH_LENGTH==7 // 7
		commonFilters.insert("http://");
		commonFilters.insert("ttp://w");
		commonFilters.insert("tp://ww");
		commonFilters.insert("p://www");
		commonFilters.insert("://www.");
#elif RULE_KEY_HASH_LENGTH==8 // 8
		commonFilters.insert("http://w");
		commonFilters.insert("ttp://ww");
		commonFilters.insert("tp://www");
		commonFilters.insert("p://www.");
#elif RULE_KEY_HASH_LENGTH==9 // 9
		commonFilters.insert("http://ww");
		commonFilters.insert("ttp://www");
		commonFilters.insert("tp://www.");
#endif
	}

	int i = 0;
	bool isFindShoutcut = false;
	while (i < abpmin(str.length() - RULE_KEY_HASH_LENGTH,80)) 
	{
		unsigned int j = i;
		for (; j < str.length(); j++) {
			if ((str[j] == '*' || str[j] == '^'))
			{
				break;
			}
		}
		for (unsigned int k = i; j - k >= RULE_KEY_HASH_LENGTH; k++) 
		{
			std::string key = str.substr(k, RULE_KEY_HASH_LENGTH);
			if(commonFilters.find(key)!=commonFilters.end())
				continue;
			isFindShoutcut = true;
			vs.push_back(key); //append(key);
		}
		i = j + 1;
	}
	return isFindShoutcut;
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:45,代码来源:FilterManager.cpp

示例6: QueryColliding

int PNS_NODE::QueryColliding( const PNS_ITEM* aItem,
        PNS_NODE::Obstacles& aObstacles, int aKindMask, int aLimitCount )
{
    obstacleVisitor visitor( aObstacles, aItem, aKindMask );

    assert( allocNodes.find( this ) != allocNodes.end() );

    visitor.SetCountLimit( aLimitCount );
    visitor.SetWorld( this, NULL );

    // first, look for colliding items ourselves
    m_index->Query( aItem, m_maxClearance, visitor );

    // if we haven't found enough items, look in the root branch as well.
    if( !isRoot() && ( visitor.m_matchCount < aLimitCount || aLimitCount < 0) )
    {
        visitor.SetWorld( m_root, this );
        m_root->m_index->Query( aItem, m_maxClearance, visitor );
    }

    return aObstacles.size();
}
开发者ID:jerkey,项目名称:kicad,代码行数:22,代码来源:pns_node.cpp

示例7: isLocalSipUri

    bool isLocalSipUri( const string& requestUri ) {

        static bool initialized = false ;
        static boost::unordered_set<string> setLocalUris ;

        if( !initialized ) {
            initialized = true ;

            nta_agent_t* agent = theOneAndOnlyController->getAgent() ;
            tport_t *t = nta_agent_tports( agent ) ;
            for (tport_t* tport = t; tport; tport = tport_next(tport) ) {
                const tp_name_t* tpn = tport_name( tport );
                if( 0 == strcmp( tpn->tpn_host, "*") ) 
                    continue ;

                string localUri = tpn->tpn_host ;
                localUri += ":" ;
                localUri += (tpn->tpn_port ? tpn->tpn_port : "5060");

                setLocalUris.insert( localUri ) ;

                if( 0 == strcmp(tpn->tpn_host,"127.0.0.1") ) {
                    localUri = "localhost:" ;
                    localUri += (tpn->tpn_port ? tpn->tpn_port : "5060");
                    setLocalUris.insert( localUri ) ;
                }
            }
       }

        url_t *url = url_make(theOneAndOnlyController->getHome(), requestUri.c_str() ) ;
        string uri = url->url_host ;
        uri += ":" ;
        uri += ( url->url_port ? url->url_port : "5060") ;

        return setLocalUris.end() != setLocalUris.find( uri ) ;
    }
开发者ID:oddsix,项目名称:drachtio-server,代码行数:36,代码来源:drachtio.cpp

示例8: TRACEn

PNS_NODE::~PNS_NODE()
{
    if( !m_children.empty() )
    {
        TRACEn( 0, "attempting to free a node that has kids.\n" );
        assert( false );
    }

    if( allocNodes.find( this ) == allocNodes.end() )
    {
        TRACEn( 0, "attempting to free an already-free'd node.\n" );
        assert( false );
    }

    allocNodes.erase( this );

    for( PNS_INDEX::ItemSet::iterator i = m_index->begin();
         i != m_index->end(); ++i )
        if( (*i)->BelongsTo( this ) )
            delete *i;

    unlinkParent();
    delete m_index;
}
开发者ID:jerkey,项目名称:kicad,代码行数:24,代码来源:pns_node.cpp

示例9: processDiscoveredCells

void Grid::processDiscoveredCells(Player &player, std::vector<SharedCell> &playerCells, const boost::unordered_set<CellID> &discoveredCells)
{
    playerCells.push_back(SharedCell(new Cell()));;
    if (player.enabledItems[STREAMER_TYPE_OBJECT])
    {
        boost::unordered_map<int, Item::SharedObject>::iterator o = player.visibleCell->objects.begin();
        while (o != player.visibleCell->objects.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(o->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                o = player.visibleCell->objects.erase(o);
            }
            else
            {
                ++o;
            }
        }
        playerCells.back()->objects.swap(player.visibleCell->objects);
    }
    if (player.enabledItems[STREAMER_TYPE_CP])
    {
        boost::unordered_map<int, Item::SharedCheckpoint>::iterator c = player.visibleCell->checkpoints.begin();
        while (c != player.visibleCell->checkpoints.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(c->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                c = player.visibleCell->checkpoints.erase(c);
            }
            else
            {
                ++c;
            }
        }
        playerCells.back()->checkpoints.swap(player.visibleCell->checkpoints);
    }
    if (player.enabledItems[STREAMER_TYPE_RACE_CP])
    {
        boost::unordered_map<int, Item::SharedRaceCheckpoint>::iterator t = player.visibleCell->raceCheckpoints.begin();
        while (t != player.visibleCell->raceCheckpoints.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(t->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                t = player.visibleCell->raceCheckpoints.erase(t);
            }
            else
            {
                ++t;
            }
        }
        playerCells.back()->raceCheckpoints.swap(player.visibleCell->raceCheckpoints);
    }
    if (player.enabledItems[STREAMER_TYPE_MAP_ICON])
    {
        boost::unordered_map<int, Item::SharedMapIcon>::iterator m = player.visibleCell->mapIcons.begin();
        while (m != player.visibleCell->mapIcons.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(m->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                m = player.visibleCell->mapIcons.erase(m);
            }
            else
            {
                ++m;
            }
        }
        playerCells.back()->mapIcons.swap(player.visibleCell->mapIcons);
    }
    if (player.enabledItems[STREAMER_TYPE_3D_TEXT_LABEL])
    {
        boost::unordered_map<int, Item::SharedTextLabel>::iterator t = player.visibleCell->textLabels.begin();
        while (t != player.visibleCell->textLabels.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(t->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                t = player.visibleCell->textLabels.erase(t);
            }
            else
            {
                ++t;
            }
        }
        playerCells.back()->textLabels.swap(player.visibleCell->textLabels);
    }
    if (player.enabledItems[STREAMER_TYPE_AREA])
    {
        boost::unordered_map<int, Item::SharedArea>::iterator a = player.visibleCell->areas.begin();
        while (a != player.visibleCell->areas.end())
        {
            boost::unordered_set<CellID>::iterator d = discoveredCells.find(a->second->cell->cellID);
            if (d != discoveredCells.end())
            {
                a = player.visibleCell->areas.erase(a);
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:BigETI,项目名称:samp-streamer-plugin,代码行数:101,代码来源:grid.cpp

示例10: remove_live_object

void Object::remove_live_object(Object* o) {
  IMP_INTERNAL_CHECK(live_.find(o) != live_.end(),
                     "Object " << o->get_name() << " not found in live list.");
  live_.erase(o);
}
开发者ID:AljGaber,项目名称:imp,代码行数:5,代码来源:base_static.cpp

示例11: bValidOffer

// Make sure an offer is still valid. If not, mark it unfunded.
bool OfferCreateTransactor::bValidOffer (
    SLE::ref            sleOfferDir,
    uint256 const&      uOfferIndex,
    const uint160&      uOfferOwnerID,
    const STAmount&     saOfferPays,
    const STAmount&     saOfferGets,
    const uint160&      uTakerAccountID,
    boost::unordered_set<uint256>&  usOfferUnfundedFound,
    boost::unordered_set<uint256>&  usOfferUnfundedBecame,
    boost::unordered_set<uint160>&  usAccountTouched,
    STAmount&           saOfferFunds)                       // <--
{
    bool    bValid;

    if (sleOfferDir->isFieldPresent (sfExpiration) && sleOfferDir->getFieldU32 (sfExpiration) <= mEngine->getLedger ()->getParentCloseTimeNC ())
    {
        // Offer is expired. Expired offers are considered unfunded. Delete it.
        WriteLog (lsINFO, OfferCreateTransactor) << "bValidOffer: encountered expired offer";

        usOfferUnfundedFound.insert (uOfferIndex);

        bValid  = false;
    }
    else if (uOfferOwnerID == uTakerAccountID)
    {
        // Would take own offer. Consider old offer expired. Delete it.
        WriteLog (lsINFO, OfferCreateTransactor) << "bValidOffer: encountered taker's own old offer";

        usOfferUnfundedFound.insert (uOfferIndex);

        bValid  = false;
    }
    else if (!saOfferGets.isPositive () || !saOfferPays.isPositive ())
    {
        // Offer has bad amounts. Consider offer expired. Delete it.
        WriteLog (lsWARNING, OfferCreateTransactor) << boost::str (boost::format ("bValidOffer: BAD OFFER: saOfferPays=%s saOfferGets=%s")
                % saOfferPays % saOfferGets);

        usOfferUnfundedFound.insert (uOfferIndex);
    }
    else
    {
        WriteLog (lsTRACE, OfferCreateTransactor) << "bValidOffer: saOfferPays=" << saOfferPays.getFullText ();

        saOfferFunds    = mEngine->getNodes ().accountFunds (uOfferOwnerID, saOfferPays);

        if (!saOfferFunds.isPositive ())
        {
            // Offer is unfunded, possibly due to previous balance action.
            WriteLog (lsDEBUG, OfferCreateTransactor) << "bValidOffer: offer unfunded: delete";

            boost::unordered_set<uint160>::iterator account = usAccountTouched.find (uOfferOwnerID);

            if (account != usAccountTouched.end ())
            {
                // Previously touched account.
                usOfferUnfundedBecame.insert (uOfferIndex); // Delete unfunded offer on success.
            }
            else
            {
                // Never touched source account.
                usOfferUnfundedFound.insert (uOfferIndex);  // Delete found unfunded offer when possible.
            }

            bValid  = false;
        }
        else
        {
            bValid  = true;
        }
    }

    return bValid;
}
开发者ID:justmoon,项目名称:rippled,代码行数:75,代码来源:OfferCreateTransactor.cpp

示例12: set_contains

bool set_contains(const boost::unordered_set<K,H,C,A>& s, const T& x) {
    return s.find(x) != s.end();
}
开发者ID:Caraul,项目名称:airgit,代码行数:3,代码来源:set_adaptor.hpp


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