本文整理汇总了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;
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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]);
}
}
}
示例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);
}
}
示例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));
}
示例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));
}
}
示例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);
}
示例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;
}