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


C++ set::clear方法代码示例

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


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

示例1: reset

void IOComponent::reset() {
	boost::recursive_mutex::scoped_lock lock(processing_queue_mutex);
	processing_queue.clear();
	regular_polls.clear();
	std::list<MachineInstance*>::iterator iter = MachineInstance::begin();
	while (iter != MachineInstance::end()) {
		MachineInstance *m = *iter++;
		if (m->io_interface) { delete m->io_interface; m->io_interface = 0; }
	}
	if (io_process_data) delete[] io_process_data; io_process_data = 0;
	if (io_process_mask) delete[] io_process_mask; io_process_mask = 0;
	if (update_data) delete[] update_data; update_data = 0;
	if (default_data) delete[] default_data; default_data = 0;
	if (default_mask) delete[] default_mask; default_mask = 0;
	if (last_process_data) delete[] last_process_data; last_process_data = 0;
}
开发者ID:latproc,项目名称:clockwork,代码行数:16,代码来源:IOComponent.cpp

示例2: list_

bool cached_zk::list_(const string& path, std::set<std::string>& out) {
  out.clear();
  struct String_vector s;
  int rc = zoo_wget_children(zh_, path.c_str(), cached_zk::update_cache, this,
                             &s);

  if (rc == ZOK) {
    for (int i = 0; i < s.count; ++i) {
      out.insert(s.data[i]);
    }
    return true;
  } else {
    LOG(ERROR) << "failed to get children: " << path << " - " << zerror(rc);
    return false;
  }
}
开发者ID:AutonomicSecurity,项目名称:jubatus,代码行数:16,代码来源:cached_zk.cpp

示例3: Reset

        void Reset()
        {
            uiCrystalfireBreathTimer = 10*IN_MILLISECONDS;
            uiCrystalChainsTimer = 20*IN_MILLISECONDS;
            uiCrystalizeTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
            uiTailSweepTimer = 5*IN_MILLISECONDS;
            bEnrage = false;

            lIntenseColdPlayers.clear();
            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);

            RemovePrison(CheckContainmentSpheres());

            if (pInstance)
                pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED);
        }
开发者ID:Bootz,项目名称:TrilliumEMU-1,代码行数:16,代码来源:boss_keristrasza.cpp

示例4:

void SparseMatrix<T>::NonZeroRowIndices(std::set<unsigned int>& row_index_set,
                                        const T& epsilon)
{
    row_index_set.clear();

    // save indices of rows with values > epsilon
    for (unsigned int s=0; s<size_; ++s)
    {
        T val = data_[s];
        if (std::abs(val) > epsilon)
        {
            unsigned int row = row_indices_[s];
            row_index_set.insert(row);
        }
    }
}
开发者ID:beckgom,项目名称:smallk,代码行数:16,代码来源:sparse_matrix_impl.hpp

示例5: subdomain_ids

void MeshBase::subdomain_ids (std::set<subdomain_id_type> &ids) const
{
  // This requires an inspection on every processor
  parallel_object_only();

  ids.clear();

  const_element_iterator       el  = this->active_elements_begin();
  const const_element_iterator end = this->active_elements_end();

  for (; el!=end; ++el)
    ids.insert((*el)->subdomain_id());

  // Some subdomains may only live on other processors
  this->comm().set_union(ids);
}
开发者ID:gsalaza3,项目名称:libmesh,代码行数:16,代码来源:mesh_base.C

示例6: debugPrintf

static BOOL WINAPI
MyFreeLibrary(HMODULE hModule)
{
    if (VERBOSITY >= 2) {
        debugPrintf("inject: intercepting %s(0x%p)\n", __FUNCTION__, hModule);
    }

    BOOL bRet = FreeLibrary(hModule);

    EnterCriticalSection(&Mutex);
    // TODO: Only clear the modules that have been freed
    g_hHookedModules.clear();
    LeaveCriticalSection(&Mutex);

    return bRet;
}
开发者ID:haraldF,项目名称:apitrace,代码行数:16,代码来源:injectee.cpp

示例7: scanLocalNetwork

bool ARPScanner::scanLocalNetwork(std::set<std::string>& foundMACAddresses)
{
    FILE *fp;
    int status;
    char line[128];

    std::vector<std::string> lines;

    foundMACAddresses.clear();

    // execute arp-scan
    fp = popen(m_commandString.c_str(), "r");
    if (fp == NULL)
    {
        m_lastErrorString = "cannot execute arp-scan";
        return false;
    }

    // parse arp-scan output
    // address information should start on line 3, ignore first 2
    fgets(line, 128, fp);
    fgets(line, 128, fp);

    // go through rest of the output line by line
    while (fgets(line, 128, fp) != NULL)
    {
        // line's second token should be MAC address
        std::istringstream ss(line);
        std::string MACAddress;
        ss >> MACAddress;
        ss >> MACAddress;

        // after address info there comes some other lines, time to quit
        if (MACAddress == "") break;

        foundMACAddresses.insert(MACAddress);
    }

    status = pclose(fp);
    if (status == -1 || WEXITSTATUS(status) != 0) {
        m_lastErrorString = "cannot execute arp-scan";
        return false;
    }

    m_lastErrorString = "";
    return true;
}
开发者ID:nemein,项目名称:presence-sensor-lan,代码行数:47,代码来源:arpscanner.cpp

示例8: showNode

void Node::showNode(const std::string &id)
{
    static std::set<std::string> cache;
    auto node = nodeTypeMap[id];
    if (id == "root") cache.clear();
    else {
        if (!cache.count(id))
        {
            cache.insert(id);
            std::cout << "ID: " << id << " Runname: " << node->runname << std::endl;
            std::cout << "Specs: " << std::endl;
            std::cout << "\tParallel level: " << node->paraLevel << std::endl;
            std::cout << "\tChildrens: ";
            for (auto child : node->children)
            {
                std::cout << " " << child.first <<"(";
                switch(child.second)
                {
                    case SHUFFLE:
                    {
                        std::cout << "ShuffleGrouping";
                        break;
                    }

                    case DEFAULT:
                    {
                        std::cout << "DefaultGrouping";
                        break;
                    }
                    default:
                    {
                        std::cout << "Unknown";
                        break;
                    }

                }
                std::cout << ")";
            }
            std::cout << std::endl << std::endl;
        }

    }
    for (auto child : node->children)
    {
        showNode(child.first);
    }
}
开发者ID:e-al,项目名称:cranesps,代码行数:47,代码来源:Topology.cpp

示例9: Initialize

        void Initialize()
        {
            memset(&encounter, 0, sizeof(encounter));

            PumpkinShrineGUID  = 0;
            HorsemanGUID = 0;
            HeadGUID = 0;
            HorsemanAdds.clear();

            MograineGUID = 0;
            WhitemaneGUID = 0;
            VorrelGUID = 0;
            DoorHighInquisitorGUID = 0;

            _KelDoor = 0;
            _AsmDoor = 0;
        }
开发者ID:beyourself,项目名称:Wow-4.3.4,代码行数:17,代码来源:instance_scarlet_monastery.cpp

示例10: Move

void RegEx::Move(char c, std::set<State*> input, std::set<State*>& output)
{
	output.clear();

	set<State*>::iterator it;
	for(it= input.begin();it!= input.end();it++)
	{
		State* u = *it;
		vector<State*> states;
		u->getTransition(c,states);

		for(int i = 0;i<states.size();i++)
		{
			output.insert(states[i]);
		}
	}
}
开发者ID:MoustaphaSaad,项目名称:Compiler-Tools,代码行数:17,代码来源:RegEx.cpp

示例11: read_privileges

/*
	Privileges
*/
static void read_privileges(lua_State *L, int index,
		std::set<std::string> &result)
{
	result.clear();
	lua_pushnil(L);
	if(index < 0)
		index -= 1;
	while(lua_next(L, index) != 0){
		// key at index -2 and value at index -1
		std::string key = luaL_checkstring(L, -2);
		bool value = lua_toboolean(L, -1);
		if(value)
			result.insert(key);
		// removes value, keeps key for next iteration
		lua_pop(L, 1);
	}
}
开发者ID:AngelCry,项目名称:minetest,代码行数:20,代码来源:scriptapi.cpp

示例12: split

void split (
  std::set<std::string>& results,
  const std::string& input,
  const char delimiter)
{
  results.clear ();
  std::string::size_type start = 0;
  std::string::size_type i;
  while ((i = input.find (delimiter, start)) != std::string::npos)
  {
    results.insert (input.substr (start, i - start));
    start = i + 1;
  }

  if (input.length ())
    results.insert (input.substr (start));
}
开发者ID:austinwagner,项目名称:task,代码行数:17,代码来源:text.cpp

示例13: init

    void init()
    {
      fillRace(raceData[RaceIDs::Zerg], "Zerg", UnitTypeIDs::Zerg_Drone, UnitTypeIDs::Zerg_Hatchery, UnitTypeIDs::Zerg_Extractor, UnitTypeIDs::Zerg_Overlord, UnitTypeIDs::Zerg_Overlord);
      fillRace(raceData[RaceIDs::Terran], "Terran", UnitTypeIDs::Terran_SCV, UnitTypeIDs::Terran_Command_Center, UnitTypeIDs::Terran_Refinery, UnitTypeIDs::Terran_Dropship, UnitTypeIDs::Terran_Supply_Depot);
      fillRace(raceData[RaceIDs::Protoss], "Protoss", UnitTypeIDs::Protoss_Probe, UnitTypeIDs::Protoss_Nexus, UnitTypeIDs::Protoss_Assimilator, UnitTypeIDs::Protoss_Shuttle, UnitTypeIDs::Protoss_Pylon);

      raceSet.clear();
      raceSet.insert(RaceIDs::Zerg);
      raceSet.insert(RaceIDs::Terran);
      raceSet.insert(RaceIDs::Protoss);

      raceMap.clear();
      for(std::set<RaceID>::iterator i = raceSet.begin(); i != raceSet.end(); i++)
      {
        raceMap.insert(std::make_pair(std::string(raceData[*i].name), *i));
      }
    }
开发者ID:RadicalZephyr,项目名称:bwdi,代码行数:17,代码来源:Races.cpp

示例14: Reset

    void Reset()
    {
        reseting = true;
        StartCombat = false;
        HasKilledAkamaAndReseting = false;

        GridSearcherSucceeded = false;

        Sorcerers.clear();
        summons.DespawnAll();//despawn all adds
        Channelers.clear();

        if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID))
        {
            Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//turn gossip on so players can restart the event
            if (Akama->isDead())
            {
                Akama->Respawn();//respawn akama if dead
                Akama->AI()->EnterEvadeMode();
            }
        }
        SorcererCount = 0;
        DeathCount = 0;

        SummonTimer = 10000;
        ReduceHealthTimer = 0;
        ResetTimer = 60000;
        DefenderTimer = 15000;

        IsBanished = true;
        HasKilledAkama = false;

        me->SetVisible(true);
        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
        //me->GetMotionMaster()->Clear();
        //me->GetMotionMaster()->MoveIdle();
        me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN);

        if (pInstance && me->IsAlive())
            pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED);

        reseting = false;

        me->setActive(true);
    }
开发者ID:Adeer,项目名称:OregonCore,代码行数:46,代码来源:boss_shade_of_akama.cpp

示例15: GetWorkList

YK_BOOL CForGantt::GetWorkList(YK_ID resId,YK_TM stTime, YK_TM etTime, std::set<YK_ID>& workLst)
{
	workLst.clear();
	CResCapacitySPtr resCapPtr = g_Application.Get<CResCapacityMap>()->GetResCap(resId);
	if (resCapPtr.ValidObj())
	{
		std::list<YK_ID> tempList;
		resCapPtr->GetAllWorkListInArea(stTime, etTime, tempList);
		for(std::list<YK_ID>::iterator iter = tempList.begin();
			iter != tempList.end();iter++)
		{
			workLst.insert(*iter);
		}
		return true;
	}
	return false;
}
开发者ID:backo880607,项目名称:YuKonSolution,代码行数:17,代码来源:ForGantt.cpp


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