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


C++ list::erase方法代码示例

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


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

示例1: untrackRef

static void untrackRef(Ref* ref)
{
    auto iter = std::find(__refAllocationList.begin(), __refAllocationList.end(), ref);
    if (iter == __refAllocationList.end())
    {
        log("[memory] CORRUPTION: Attempting to free (%s) with invalid ref tracking record.\n", typeid(*ref).name());
        return;
    }

    __refAllocationList.erase(iter);
}
开发者ID:jun496276723,项目名称:CocosMFCEditor,代码行数:11,代码来源:CCRef.cpp

示例2: FilterTargets

 void FilterTargets(std::list<Unit*>& unitList)
 {
     for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
     {
         if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
             ++itr;
         else
             unitList.erase(itr++);
     }
     unitList.push_back(GetCaster());
 }
开发者ID:Sania001,项目名称:ALiveCoreRC2,代码行数:11,代码来源:dustwallow_marsh.cpp

示例3: AnalyseMsgWithWaitList

//_______________________________________________________________________________________
//Прокручивает очередь отправленных сообщений, начиная со самых старых. Если ReceivedMsg!=NULL,
//то сначала анализирует принятое сообщение на соответствие списку. Если соответствие
//найдено, выполняет действие, удаляет отправленное. Если не найдено, принимает
//асинхронное сообщение.
//Перед выходом проверяет список на таймаут (выдает сообщение и удаляет).  
void CComThreadBasic::AnalyseMsgWithWaitList(std::list<ComMsg>& List, ComMsg *ReceivedMsg)
{
	std::list<ComMsg>::iterator iter;
	//ComMsg SentMsg;
	bool Processed=false;
	if(ReceivedMsg!=NULL)
	{
		for (iter = List.begin(); iter != List.end();)
		{
			if(AnalyseCorrectMsg(ReceivedMsg, &(*iter)))
			{
				//Сообщение обработано. Удаление задания из очереди, выход
				List.erase(iter);
				Processed=true;
				break;
			}
			else
				++iter;
		}

		if(!Processed)
		{
			//Прием асинхронного (неинициированного этой программой) сообщения
			AnalyseCorrectMsg(ReceivedMsg, NULL);
		}
	}

	//Проверка на таймаут
	ULONG TickCount=GetTickCount();
	for (iter = List.begin(); iter != List.end();)
	{
		if(TickCount-iter->TimeStamp>m_ReplyTimeout*1000)
		{
			//Таймаут.
			ReportTimeOut(&(*iter));
			iter=List.erase(iter);
		}
		else
			++iter;
	}
}
开发者ID:Alexepus,项目名称:Kratos,代码行数:47,代码来源:ComThreadBasic.cpp

示例4: deleteShape

void deleteShape()
{
	for (std::list<Shape>::iterator it = listOfShapes.begin(); it != listOfShapes.end(); it++)
	{
		if(it->shapeId == selected)
		{
			selected = 0;
			listOfShapes.erase(it);
			break;
		}
	}
}
开发者ID:krenztr,项目名称:ModelingCG,代码行数:12,代码来源:main.cpp

示例5: connectLines

bool MeshProjection::connectLines(std::list< std::pair<Base::Vector3f, Base::Vector3f> >& cutLines,
                                  const Base::Vector3f& startPoint, const Base::Vector3f& endPoint,
                                  std::vector<Base::Vector3f>& polyline) const
{
    const float fMaxDist = float(sqrt(FLOAT_MAX)); // max. length of a gap
    const float fMinEps  = 1.0e-4f;

    polyline.clear();
    polyline.push_back(startPoint);

    Base::Vector3f curr(startPoint);
    while ((curr != endPoint) && (!cutLines.empty())) {
        std::list< std::pair<Base::Vector3f, Base::Vector3f> >::iterator it, pCurr = cutLines.end();

        // get nearest line
        float  fMin  = fMaxDist * fMaxDist;

        bool  bPos = false;
        for (it = cutLines.begin(); it != cutLines.end(); ++it) {
            float fD1 = Base::DistanceP2(curr, it->first);
            float fD2 = Base::DistanceP2(curr, it->second);
            if (std::min<float>(fD1, fD2) < fMin) {
                pCurr = it;
                bPos  = fD1 < fD2;
                fMin  = std::min<float>(fD1, fD2);
                if (fMin < fMinEps) // abort because next line already found
                    break;
            }
        }

        if (pCurr != cutLines.end()) {
            if (bPos) {
                if (fMin > fMinEps) // gap, insert point
                    polyline.push_back(pCurr->first);
                polyline.push_back(pCurr->second);
                curr = pCurr->second;
            }
            else {
                if (fMin > fMinEps) // gap, insert point
                    polyline.push_back(pCurr->second);
                polyline.push_back(pCurr->first);
                curr = pCurr->first;
            }
        }
        else {
            return false;  // abort because no line was found
        }

        cutLines.erase(pCurr); 
    }

    return true;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:53,代码来源:Projection.cpp

示例6: removeFromModified

void IPrimitiveEditor::removeFromModified ()
{
	// Already inserted ?
	if (_ModifiedIterator != ModifiedPrimitive.end ())
	{
		// Remove from the container
		ModifiedPrimitive.erase (_ModifiedIterator);

		// Clear it
		_ModifiedIterator = ModifiedPrimitive.end ();
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:12,代码来源:editor_primitive.cpp

示例7: removeFromSelection

void IPrimitiveEditor::removeFromSelection ()
{
	// Already inserted ?
	if (_SelectionIterator != Selection.end ())
	{
		// Remove from the container
		Selection.erase (_SelectionIterator);

		// Clear it
		_SelectionIterator = Selection.end ();
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:12,代码来源:editor_primitive.cpp

示例8: while

std::vector<int> ChowLiuTree::extractChildren(std::list<info> &remaining_edges, int q) {

    std::vector<int> children;
    std::list<info>::iterator edge = remaining_edges.begin();

    while(edge != remaining_edges.end()) {
        if(edge->word1 == q) {
            children.push_back(edge->word2);
            edge = remaining_edges.erase(edge);
            continue;
        }
        if(edge->word2 == q) {
            children.push_back(edge->word1);
            edge = remaining_edges.erase(edge);
            continue;
        }
        edge++;
    }

    return children;
}
开发者ID:LRMPUT,项目名称:PUTSLAM,代码行数:21,代码来源:chowliutree.cpp

示例9: do_register_drawable

	void do_register_drawable(const std::shared_ptr<drawable>& drawable)
	{
		drawables_.push_back(drawable);
		auto it = drawables_.begin();
		while(it != drawables_.end())
		{
			if(it->lock())
				++it;
			else	
				it = drawables_.erase(it);			
		}
	}
开发者ID:zhouqilin,项目名称:casparLinux,代码行数:12,代码来源:graph.cpp

示例10: RemoveFromList

void MultiQueueMigrator::RemoveFromList(std::list<uint64_t> list, uint64_t pageNo)
{
	std::list<uint64_t>::iterator iter;
	for(iter = list.begin(); iter != list.end(); iter++)
	{
		if(pageNo == *iter)
		{
			list.erase(iter);
			return;
		}
	}	
}
开发者ID:cyjseagull,项目名称:SHMA,代码行数:12,代码来源:MultiQueueMigrator.cpp

示例11: RemoveEmptyGames

void RemoveEmptyGames() {
    for (std::list<Game *>::iterator ptr(games.begin()), end(games.begin()), del; ptr != end;) {
        del = ptr;
        Game *g = *ptr;
        ++ptr;
        if (g->a == 0 && g->b == 0) {
            MakeDirty();
            games.erase(del);
            delete g;
        }
    }
}
开发者ID:jwatte,项目名称:netlight,代码行数:12,代码来源:pongservermain.cpp

示例12: wk_gateKeeper

void wk_gateKeeper(DS::SocketHandle sockp)
{
    GateKeeper_Private client;
    client.m_crypt = 0;

    s_clientMutex.lock();
    client.m_sock = sockp;
    s_clients.push_back(&client);
    s_clientMutex.unlock();

    try {
        gate_init(client);

        for ( ;; ) {
            uint16_t msgId = DS::CryptRecvValue<uint16_t>(client.m_sock, client.m_crypt);
            switch (msgId) {
            case e_CliToGateKeeper_PingRequest:
                cb_ping(client);
                break;
            case e_CliToGateKeeper_FileServIpAddressRequest:
                cb_fileServIpAddress(client);
                break;
            case e_CliToGateKeeper_AuthServIpAddressRequest:
                cb_authServIpAddress(client);
                break;
            default:
                /* Invalid message */
                fprintf(stderr, "[GateKeeper] Got invalid message ID %d from %s\n",
                        msgId, DS::SockIpAddress(client.m_sock).c_str());
                DS::CloseSock(client.m_sock);
                throw DS::SockHup();
            }
        }
    } catch (const DS::SockHup&) {
        // Socket closed...
    } catch (const std::exception& ex) {
        fprintf(stderr, "[GateKeeper] Error processing client message from %s: %s\n",
                DS::SockIpAddress(sockp).c_str(), ex.what());
    }

    s_clientMutex.lock();
    auto client_iter = s_clients.begin();
    while (client_iter != s_clients.end()) {
        if (*client_iter == &client)
            client_iter = s_clients.erase(client_iter);
        else
            ++client_iter;
    }
    s_clientMutex.unlock();

    DS::CryptStateFree(client.m_crypt);
    DS::FreeSock(client.m_sock);
}
开发者ID:GehnShard,项目名称:dirtsand,代码行数:53,代码来源:GateServ.cpp

示例13: UpdateJoystickEvents

void UpdateJoystickEvents()
{
	std::list<JoystickEvent_t*>::iterator i;
	event_t    event;

	if(!JoyEventList.size())
		return;

	i = JoyEventList.begin();
	while(i != JoyEventList.end())
	{
		if((*i)->Event.type == SDL_JOYHATMOTION)
		{
			// Hat position released
			if(!(SDL_JoystickGetHat(openedjoy, (*i)->Event.jhat.hat) & (*i)->Event.jhat.value))
				event.type = ev_keyup;
			// Hat button still held - Repeat at key repeat interval
			else if((SDL_GetTicks() - (*i)->RegTick >= SDL_DEFAULT_REPEAT_DELAY) && 
		            (SDL_GetTicks() - (*i)->LastTick >= SDL_DEFAULT_REPEAT_INTERVAL*2))
			{
				(*i)->LastTick = SDL_GetTicks();
				event.type = ev_keydown;
			}
			else
			{
				i++;
				continue;
			}

			event.data1 = event.data2 = event.data3 = 0;

			if((*i)->Event.jhat.value == SDL_HAT_UP)
				event.data1 = ((*i)->Event.jhat.hat * 4) + KEY_HAT1;
			else if((*i)->Event.jhat.value == SDL_HAT_RIGHT)
				event.data1 = ((*i)->Event.jhat.hat * 4) + KEY_HAT2;
			else if((*i)->Event.jhat.value == SDL_HAT_DOWN)
				event.data1 = ((*i)->Event.jhat.hat * 4) + KEY_HAT3;
			else if((*i)->Event.jhat.value == SDL_HAT_LEFT)
				event.data1 = ((*i)->Event.jhat.hat * 4) + KEY_HAT4;

			D_PostEvent(&event);

			if(event.type == ev_keyup)
			{
				// Delete the released event
				delete *i;
				i = JoyEventList.erase(i);
				continue;
			}
		}
		i++;
	}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:53,代码来源:i_input.cpp

示例14: RemoveZonesAt

	void RemoveZonesAt(short rzx,short rzy)
		{
		std::list<ZoneRef>::iterator zli;
		//erase all zones in list
		for(zli=zonelist.begin();zli!=zonelist.end();zli++)
			if(zli->PointInZone(rzx,rzy))
				zonelist.erase(zli);
		//erase all zones in children's lists
		for(int i=0;i<4;i++)
			if(children[i])
				children[i]->RemoveZonesAt(rzx,rzy);
		}
开发者ID:RollerSimmer,项目名称:Dreamburg,代码行数:12,代码来源:hoodhierarchy.cpp

示例15: RemoveFromPendingDelete

void CWebserverAppTraits::RemoveFromPendingDelete(wxObject *object)
{
	wxMutexLocker lock(m_lock);

	for(std::list<wxObject *>::iterator i = m_sched_delete.begin();
	    i != m_sched_delete.end(); i++) {
		if (*i == object) {
			m_sched_delete.erase(i);
			return;
		}
	}
}
开发者ID:dreamerc,项目名称:amule,代码行数:12,代码来源:WebInterface.cpp


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