本文整理汇总了C++中std::multimap::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::clear方法的具体用法?C++ multimap::clear怎么用?C++ multimap::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::multimap
的用法示例。
在下文中一共展示了multimap::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainWork
int MainWork ()
{
int iRetVal = 0;
std::vector<SSubscriberRefresh> vectSubscriberList;
std::vector<SSubscriberRefresh>::iterator iterSubscr;
do {
/* загружаем список абонентов */
iRetVal = CreateSubscriberList (&vectSubscriberList);
if (iRetVal) {
break;
}
if (vectSubscriberList.size() > 1000) {
iRetVal = CreateSessionListFull(g_mmapSessionListFull);
if (iRetVal) {
g_mmapSessionListFull.clear();
}
}
/* обходим список абонентов */
iterSubscr = vectSubscriberList.begin();
while (iterSubscr != vectSubscriberList.end()) {
/* обрабатыаем учетную запись абонента */
iRetVal = ThreadManager (*iterSubscr);
if (iRetVal) {
break;
}
++iterSubscr;
}
} while (0);
g_mmapSessionListFull.clear();
return iRetVal;
}
示例2: ReadAliases
virtual void ReadAliases()
{
ConfigReader MyConf(ServerInstance);
AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0);
std::string fpre = MyConf.ReadValue("fantasy","prefix",0);
fprefix = fpre.empty() ? '!' : fpre[0];
Aliases.clear();
for (int i = 0; i < MyConf.Enumerate("alias"); i++)
{
Alias a;
std::string txt;
txt = MyConf.ReadValue("alias", "text", i);
a.AliasedCommand = txt.c_str();
a.ReplaceFormat = MyConf.ReadValue("alias", "replace", i, true);
a.RequiredNick = MyConf.ReadValue("alias", "requires", i);
a.ULineOnly = MyConf.ReadFlag("alias", "uline", i);
a.ChannelCommand = MyConf.ReadFlag("alias", "channelcommand", "no", i);
a.UserCommand = MyConf.ReadFlag("alias", "usercommand", "yes", i);
a.OperOnly = MyConf.ReadFlag("alias", "operonly", i);
a.format = MyConf.ReadValue("alias", "format", i);
a.CaseSensitive = MyConf.ReadFlag("alias", "matchcase", i);
Aliases.insert(std::make_pair(txt, a));
}
}
示例3: readGroupingFile
/// Reads in the file with the grouping information
bool DiffractionFocussing::readGroupingFile(
std::string groupingFileName,
std::multimap<int64_t, int64_t> &detectorGroups) {
std::ifstream grFile(groupingFileName.c_str());
if (!grFile) {
g_log.error() << "Unable to open grouping file " << groupingFileName
<< std::endl;
return false;
}
detectorGroups.clear();
std::string str;
while (getline(grFile, str)) {
if (str.empty() || str[0] == '#')
continue;
std::istringstream istr(str);
int n, udet, sel, group;
double offset;
istr >> n >> udet >> offset >> sel >> group;
// Check the line wasn't badly formatted - return a failure if it is
// if ( ! istr.good() ) return false;
// only allow groups with +ve ids
if ((sel) && (group > 0)) {
detectorGroups.insert(std::make_pair(group, udet));
}
}
return true;
}
示例4: BuildPersistentCache
static bool BuildPersistentCache()
{
if (next_persistent_id)
return true;
if (!Core::getInstance().isWorldLoaded())
return false;
stl::vector<df::historical_figure*> &hfvec = df::historical_figure::get_vector();
// Determine the next entry id as min(-100, lowest_id-1)
next_persistent_id = -100;
if (hfvec.size() > 0 && hfvec[0]->id <= -100)
next_persistent_id = hfvec[0]->id-1;
// Add the entries to the lookup table
persistent_index.clear();
for (size_t i = 0; i < hfvec.size() && hfvec[i]->id <= -100; i++)
{
if (!hfvec[i]->name.has_name || hfvec[i]->name.first_name.empty())
continue;
persistent_index.insert(T_persistent_item(hfvec[i]->name.first_name, -hfvec[i]->id));
}
return true;
}
示例5: putData
void GroupTransformer::putData(RddPartition* output,
std::multimap<PbMessagePtr, PbMessagePtr, idgs::store::less>& localCache) {
if (!localCache.empty()) {
PbMessagePtr key;
std::vector<PbMessagePtr> values;
for (auto it = localCache.begin(); it != localCache.end(); ++it) {
if (idgs::store::equals_to()(const_cast<PbMessagePtr&>(it->first), key)) {
values.push_back(it->second);
} else {
if (!values.empty()) {
output->put(key, values);
values.clear();
}
values.clear();
key = it->first;
values.push_back(it->second);
}
}
if (!values.empty()) {
output->put(key, values);
values.clear();
}
localCache.clear();
}
}
示例6: getClasses
/// @brief distribute matched phrase by names
/// @param phrases vector with matched phrases [in]
/// @param phraseByCls classID to phrase_matched multimap [out]
// this impementatin doesn't use getClasses (by ids) since huge multimap overhead
void PhraseSearcher::getClasses(const vector<phrase_matched> &phrases,
std::multimap<string, phrasecls_matched> &phraseByCls) const
{
phraseByCls.clear();
phrasecls_matched mi;
phrase_record *phrec;
phrase_classes_list *pclassList;
for (vector<phrase_matched>::const_iterator it = phrases.begin();
it != phrases.end();
it++)
{
phrec = m_pimpl->m_phrase_offsets[ it->phrase_id ];
pclassList = __phrase_header_jump_to_classes(phrec);
mi.phrase_id = it->phrase_id;
mi.match_flags = it->match_flags;
for (unsigned i = 0; i < pclassList->n; i++) {
mi.baserank = pclassList->clse[i].phrase_rank;
phraseByCls.insert(pair<string, phrasecls_matched>(m_pQCIndex->getName(pclassList->clse[i].clsid), mi));
}
}
}
示例7: defaultPriority
CServerDefinitions::CServerDefinitions() : defaultPriority( 0 )
{
Console.PrintSectionBegin();
Console << "Loading server scripts..." << myendl;
Console << " o Clearing AddMenuMap entries(" << g_mmapAddMenuMap.size() << ")" << myendl;
g_mmapAddMenuMap.clear();
ScriptListings.resize( NUM_DEFS );
ReloadScriptObjects();
Console.PrintSectionBegin();
}
示例8: sortedColumns
void IOracle::sortedColumns(
std::multimap<Double, Column const *, std::greater<Double>> & result) const {
result.clear();
// MY_PRINT(_columns.size());
for (auto const & column : _columns) {
// column.print();
ASSERT_CHECK(column.check(*_dual));
result.insert(std::make_pair(column.reducedCost(), &column));
}
}
示例9: MDFN_SaveSettings
bool MDFN_SaveSettings(void)
{
std::multimap <uint32, MDFNCS>::iterator sit;
std::list<MDFNCS *> SortedList;
std::list<MDFNCS *>::iterator lit;
FILE *fp;
if(!(fp = fopen(fname.c_str(), "wb")))
return(0);
trio_fprintf(fp, ";VERSION %s\n", MEDNAFEN_VERSION);
trio_fprintf(fp, _(";Edit this file at your own risk!\n"));
trio_fprintf(fp, _(";File format: <key><single space><value><LF or CR+LF>\n\n"));
for(sit = CurrentSettings.begin(); sit != CurrentSettings.end(); sit++)
{
SortedList.push_back(&sit->second);
//trio_fprintf(fp, ";%s\n%s %s\n\n", _(sit->second.desc->description), sit->second.name, sit->second.value);
//free(sit->second.name);
//free(sit->second.value);
}
SortedList.sort(compare_sname);
for(lit = SortedList.begin(); lit != SortedList.end(); lit++)
{
if((*lit)->desc->type == MDFNST_ALIAS)
continue;
trio_fprintf(fp, ";%s\n%s %s\n\n", _((*lit)->desc->description), (*lit)->name, (*lit)->value);
free((*lit)->name);
free((*lit)->value);
}
if(UnknownSettings.size())
{
trio_fprintf(fp, "\n;\n;Unrecognized settings follow:\n;\n\n");
for(unsigned int i = 0; i < UnknownSettings.size(); i++)
{
trio_fprintf(fp, "%s %s\n\n", UnknownSettings[i].name, UnknownSettings[i].value);
free(UnknownSettings[i].name);
free(UnknownSettings[i].value);
}
}
CurrentSettings.clear(); // Call after the list is all handled
UnknownSettings.clear();
fclose(fp);
return(1);
}
示例10: cmp_scores
void node_t::cmp_scores(std::multimap<double,int> &scores, descriptor_t *data)
{
scores.clear();
for (unsigned i=0; i<nb_branches; i++) {
if (clusters[i]) {
double d = clusters[i]->mean.distance(data);
//if (!finite(d)) std::cout << "dist= " << d << std::endl;
scores.insert(std::pair<double,int>(d,i));
}
}
}
示例11: Reload
//o--------------------------------------------------------------------------o
//| Function/Class - bool CServerDefinitions::Reload( void )
//| Date - 04/17/2002
//| Developer(s) - EviLDeD
//| Company/Team - UOX3 DevTeam
//| Status -
//o--------------------------------------------------------------------------o
//| Description - Reload the dfn files.
//| Modification - 04042004 - EviLDeD - Added the code to clear out the
//| Auto-AddMenu items so there isn't any duplication in the
//| multimap
//o--------------------------------------------------------------------------o
//| Returns - [TRUE] if succesfull
//o--------------------------------------------------------------------------o
bool CServerDefinitions::Reload( void )
{
// We need to clear out the AddMenuItem Map
g_mmapAddMenuMap.clear();
//
Cleanup();
ScriptListings.clear();
ScriptListings.resize( NUM_DEFS );
ReloadScriptObjects();
return true;
}
示例12: UpdateHashToFunctionMap
void UpdateHashToFunctionMap() {
lock_guard guard(functions_lock);
hashToFunction.clear();
// Really need to detect C++11 features with better defines.
#if !defined(__SYMBIAN32__) && !defined(IOS)
hashToFunction.reserve(functions.size());
#endif
for (auto iter = functions.begin(); iter != functions.end(); iter++) {
AnalyzedFunction &f = *iter;
if (f.hasHash && f.size > 16) {
hashToFunction.insert(std::make_pair(f.hash, &f));
}
}
}
示例13: cancel_timers
static void cancel_timers(std::multimap<int,int> &timers)
{
using Lua::Core::State;
Lua::StackUnwinder frame(State);
lua_rawgetp(State, LUA_REGISTRYINDEX, &DFHACK_TIMEOUTS_TOKEN);
for (auto it = timers.begin(); it != timers.end(); ++it)
{
lua_pushnil(State);
lua_rawseti(State, frame[1], it->second);
}
timers.clear();
}
示例14:
template <typename PointT> void
pcl::SupervoxelClustering<PointT>::getSupervoxelAdjacency (std::multimap<uint32_t, uint32_t> &label_adjacency) const
{
label_adjacency.clear ();
for (typename HelperListT::const_iterator sv_itr = supervoxel_helpers_.cbegin (); sv_itr != supervoxel_helpers_.cend (); ++sv_itr)
{
uint32_t label = sv_itr->getLabel ();
std::set<uint32_t> neighbor_labels;
sv_itr->getNeighborLabels (neighbor_labels);
for (std::set<uint32_t>::iterator label_itr = neighbor_labels.begin (); label_itr != neighbor_labels.end (); ++label_itr)
label_adjacency.insert (std::pair<uint32_t,uint32_t> (label, *label_itr) );
//if (neighbor_labels.size () == 0)
// std::cout << label<<"(size="<<sv_itr->size () << ") has "<<neighbor_labels.size () << "\n";
}
}
示例15: ForgetFunctions
void ForgetFunctions(u32 startAddr, u32 endAddr) {
lock_guard guard(functions_lock);
// It makes sense to forget functions as modules are unloaded but it breaks
// the easy way of saving a hashmap by unloading and loading a game. I added
// an alternative way.
// Most of the time, functions from the same module will be contiguous in functions.
FunctionsVector::iterator prevMatch = functions.end();
size_t originalSize = functions.size();
for (auto iter = functions.begin(); iter != functions.end(); ++iter) {
const bool hadPrevMatch = prevMatch != functions.end();
const bool match = iter->start >= startAddr && iter->start <= endAddr;
if (!hadPrevMatch && match) {
// Entering a range.
prevMatch = iter;
} else if (hadPrevMatch && !match) {
// Left a range.
iter = functions.erase(prevMatch, iter);
prevMatch = functions.end();
}
}
if (prevMatch != functions.end()) {
// Cool, this is the fastest way.
functions.erase(prevMatch, functions.end());
}
RestoreReplacedInstructions(startAddr, endAddr);
if (functions.empty()) {
hashToFunction.clear();
} else if (originalSize != functions.size()) {
UpdateHashToFunctionMap();
}
}