本文整理汇总了C++中std::unordered_set::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_set::clear方法的具体用法?C++ unordered_set::clear怎么用?C++ unordered_set::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::unordered_set
的用法示例。
在下文中一共展示了unordered_set::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeAllWindows
void closeAllWindows()
{
if(disableAllDisplay) return;
boost::unique_lock<boost::mutex> lock(openCVdisplayMutex);
cv::destroyAllWindows();
openWindows.clear();
}
示例2: displayThreadLoop
void displayThreadLoop()
{
printf("started image display thread!\n");
boost::unique_lock<boost::mutex> lock(openCVdisplayMutex);
while(imageThreadKeepRunning)
{
openCVdisplaySignal.wait(lock);
if(!imageThreadKeepRunning)
break;
while(displayQueue.size() > 0)
{
if(!displayQueue.back().autoSize)
{
if(openWindows.find(displayQueue.back().name) == openWindows.end())
{
cv::namedWindow(displayQueue.back().name, cv::WINDOW_NORMAL);
cv::resizeWindow(displayQueue.back().name, displayQueue.back().img.cols, displayQueue.back().img.rows);
openWindows.insert(displayQueue.back().name);
}
}
cv::imshow(displayQueue.back().name, displayQueue.back().img);
cv::waitKey(1);
displayQueue.pop_back();
}
}
cv::destroyAllWindows();
openWindows.clear();
printf("ended image display thread!\n");
}
示例3: if
bool S4Prover::isSatisfiableRefined(SddNode* alpha, SddManager* m, std::unordered_set<SddLiteral> permVars, SddNode* permSdd,
std::unordered_set<SddNode*,SddHasher>& assumedSatSdds, std::unordered_set<SddLiteral>& responsibleVars) {
assumedSatSdds.clear();
std::unordered_set<SddLiteral> postResponsibleVars;
bool isSat;
if (sdd_node_is_false(alpha)) {
isSat = false;
}
else if (dependentSdds.count(alpha) == 1) {
//Loop detected
assumedSatSdds.insert(alpha);
isSat = true;
}
else {
isSat = isSatisfiable(alpha,m,permVars,permSdd,assumedSatSdds, postResponsibleVars);
}
if (assumedSatSdds.count(alpha) == 1) {
assumedSatSdds.erase(alpha);
}
if (!isSat) {
responsibleVars.insert(postResponsibleVars.begin(), postResponsibleVars.end());
}
dependentSdds.erase(alpha);
return isSat;
}
示例4: get_indices
void data_store_csv::get_indices(std::unordered_set<int> &indices, int p) {
indices.clear();
std::vector<int> &v = m_all_minibatch_indices[p];
for (auto t : v) {
indices.insert((*m_shuffled_indices)[t]);
}
}
示例5: solve
box random_icp::solve(box b, double const precision ) {
thread_local static std::unordered_set<std::shared_ptr<constraint>> used_constraints;
used_constraints.clear();
thread_local static vector<box> solns;
thread_local static vector<box> box_stack;
solns.clear();
box_stack.clear();
box_stack.push_back(b);
do {
DREAL_LOG_INFO << "random_icp::solve - loop"
<< "\t" << "box stack Size = " << box_stack.size();
b = box_stack.back();
box_stack.pop_back();
try {
m_ctc.prune(b, m_config);
auto this_used_constraints = m_ctc.used_constraints();
used_constraints.insert(this_used_constraints.begin(), this_used_constraints.end());
} catch (contractor_exception & e) {
// Do nothing
}
if (!b.is_empty()) {
tuple<int, box, box> splits = b.bisect(precision);
int const i = get<0>(splits);
if (i >= 0) {
box const & first = get<1>(splits);
box const & second = get<2>(splits);
if (random_bool()) {
box_stack.push_back(second);
box_stack.push_back(first);
} else {
box_stack.push_back(first);
box_stack.push_back(second);
}
if (m_config.nra_proof) {
m_config.nra_proof_out << "[branched on "
<< b.get_name(i)
<< "]" << endl;
}
} else {
m_config.nra_found_soln++;
if (m_config.nra_found_soln >= m_config.nra_multiple_soln) {
break;
}
if (m_config.nra_multiple_soln > 1) {
// If --multiple_soln is used
output_solution(b, m_config, m_config.nra_found_soln);
}
solns.push_back(b);
}
}
} while (box_stack.size() > 0);
m_ctc.set_used_constraints(used_constraints);
if (m_config.nra_multiple_soln > 1 && solns.size() > 0) {
return solns.back();
} else {
assert(!b.is_empty() || box_stack.size() == 0);
return b;
}
}
示例6:
void CLKernelParameterParser::KernelParameters::getParameterNames(std::unordered_set<std::string>& dest) const
{
dest.clear();
for(auto it = parametersByName.begin(); it != parametersByName.end(); ++it)
{
dest.insert(it->first);
}
}
示例7: add_timers
// Add a collection of timers to the data store. The collection is emptied by
// this operation, since the timers are now owned by the store.
void TimerStore::add_timers(std::unordered_set<Timer*>& set)
{
for (auto it = set.begin(); it != set.end(); ++it)
{
add_timer(*it);
}
set.clear();
}
示例8: url_module_cleanup
static bool url_module_cleanup(KviModule *)
{
KviConfigurationFile cfg(szConfigPath, KviConfigurationFile::Read);
cfg.setGroup("ConfigDialog");
if(cfg.readBoolEntry("SaveUrlListOnUnload", false) == true)
saveUrlList();
for(auto tmpitem : g_UrlDlgList)
{
if(tmpitem->dlg)
tmpitem->dlg->close();
}
g_List.clear();
g_BanList.clear();
g_UrlDlgList.clear();
return true;
}
示例9: clear
void UrlDialog::clear()
{
g_List.clear();
for(auto & tmpitem : g_UrlDlgList)
{
if(tmpitem->dlg)
tmpitem->dlg->m_pUrlList->clear();
}
}
示例10: reset
void reset() {
//dailySessionInterval = SimTimeInterval(0,0);
content = nullptr;
currentChunk = 0;
highestChunkFetched = 0;
chunksToBeWatched = 0;
buffer.clear();
waiting = false;
}
示例11: get_my_indices
void data_store_csv::get_my_indices(std::unordered_set<int> &indices, int p) {
indices.clear();
std::vector<int> &v = m_all_minibatch_indices[p];
for (auto t : v) {
int index = (*m_shuffled_indices)[t];
if (m_data.find(index) != m_data.end()) {
indices.insert(index);
}
}
}
示例12: getNumberOfLoops
size_t Statistics::getNumberOfLoops(DFA_Automata * dfa) {
std::cout << "start loop counting" << std::endl;
InStack.insert(std::make_pair(dfa->m_startState, 1));
LoopDFS(dfa->m_startState);
size_t cnt = LoopCnt;
LoopCnt = 0;
LoopVisited.clear();
InStack.clear();
return cnt;
}
示例13: getOtherTraitNames
void TraitPrecStatement::getOtherTraitNames(
std::unordered_set<std::string>& namesSet) const {
std::vector<std::string> namesVec;
m_otherTraitNames->getStrings(namesVec);
for (unsigned int i = 0; i < namesVec.size(); i++) {
namesVec[i] = toLower(namesVec[i]);
}
namesSet.clear();
namesSet.insert(namesVec.begin(), namesVec.end());
}
示例14: pop
// Pop a set of timers, this function takes ownership of the timers and
// thus empties the passed in set.
void TimerHandler::pop(std::unordered_set<TimerPair>& timers)
{
for (std::unordered_set<TimerPair>::iterator it = timers.begin();
it != timers.end();
++it)
{
delete it->information_timer;
pop(it->active_timer);
}
timers.clear();
}
示例15: fig0_5_is_complete
bool fig0_5_is_complete(int components_id)
{
bool complete = components_seen.count(components_id);
if (complete) {
components_seen.clear();
}
else {
components_seen.insert(components_id);
}
return complete;
}