本文整理汇总了C++中std::multimap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::begin方法的具体用法?C++ multimap::begin怎么用?C++ multimap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::multimap
的用法示例。
在下文中一共展示了multimap::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
std::vector<std::multimap<ReducedFraction, MidiChord>::const_iterator>
findChordsForTimeRange(
int voice,
const ReducedFraction &onTime,
const ReducedFraction &offTime,
const std::multimap<ReducedFraction, MidiChord> &chords,
const ReducedFraction &maxChordLength)
{
std::vector<std::multimap<ReducedFraction, MidiChord>::const_iterator> result;
if (chords.empty())
return result;
auto it = chords.lower_bound(offTime);
if (it == chords.begin())
return result;
--it;
while (it->first + maxChordLength > onTime) {
const MidiChord &chord = it->second;
if (chord.voice == voice) {
const auto chordInterval = std::make_pair(it->first, maxNoteOffTime(chord.notes));
const auto durationInterval = std::make_pair(onTime, offTime);
if (MidiTuplet::haveIntersection(chordInterval, durationInterval))
result.push_back(it);
}
if (it == chords.begin())
break;
--it;
}
return result;
}
示例2: get_shortest_stamp
int get_shortest_stamp(std::multimap<addr_type, int> & ongoing_requests) {
int t;
std::multimap<addr_type, int>::iterator it;
for (it = ongoing_requests.begin(); it != ongoing_requests.end(); it++) {
if (it == ongoing_requests.begin())
t = it->second;
if (it->second < t)
t = it->second;
}
return t;
}
示例3: setFeatures
void ImageView::setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, const QColor & color)
{
qDeleteAll(_features);
_features.clear();
rtabmap::KeypointItem * item = 0;
for(std::multimap<int, cv::KeyPoint>::const_iterator i = refWords.begin(); i != refWords.end(); ++i )
{
const cv::KeyPoint & r = (*i).second;
int id = (*i).first;
QString info = QString( "WordRef = %1\n"
"Laplacian = %2\n"
"Dir = %3\n"
"Hessian = %4\n"
"X = %5\n"
"Y = %6\n"
"Size = %7").arg(id).arg(1).arg(r.angle).arg(r.response).arg(r.pt.x).arg(r.pt.y).arg(r.size);
float radius = r.size/2.0f;
item = new rtabmap::KeypointItem(r.pt.x-radius, r.pt.y-radius, radius*2, info, color);
scene()->addItem(item);
_features.insert(id, item);
item->setVisible(_showFeatures->isChecked());
item->setZValue(1);
}
}
示例4: merge_recommended_queries
void query_recommender::merge_recommended_queries(std::multimap<double,std::string,std::less<double> > &related_queries,
hash_map<const char*,double,hash<const char*>,eqstr> &update)
{
hash_map<const char*,double,hash<const char*>,eqstr>::iterator hit;
std::multimap<double,std::string,std::less<double> >::iterator mit
= related_queries.begin();
while(mit!=related_queries.end())
{
std::string rquery = (*mit).second;
if ((hit = update.find(rquery.c_str()))!=update.end())
{
(*hit).second = std::min((*mit).first,(*hit).second);
std::multimap<double,std::string,std::less<double> >::iterator mit2 = mit;
++mit;
related_queries.erase(mit2);
}
else ++mit;
}
hit = update.begin();
hash_map<const char*,double,hash<const char*>,eqstr>::iterator chit;
while(hit!=update.end())
{
related_queries.insert(std::pair<double,std::string>((*hit).second,std::string((*hit).first)));
chit = hit;
++hit;
free_const((*chit).first);
}
}
示例5: newMap
std::multimap<float, std::vector<int> > HuffmanCoder::Merge(std::multimap<float, std::vector<int> >& mapOne, std::multimap<float, std::vector<int> >& mapTwo) {
std::multimap<float, std::vector<int> > newMap(mapOne);
for (std::multimap<float, std::vector<int> >::iterator it = mapTwo.begin(); it != mapTwo.end(); it++) {
newMap.insert(*it);
}
return newMap;
}
示例6: GetPersistentData
void World::GetPersistentData(std::vector<PersistentDataItem> *vec, const std::string &key, bool prefix)
{
vec->clear();
if (!BuildPersistentCache())
return;
auto eqrange = persistent_index.equal_range(key);
if (prefix)
{
if (key.empty())
{
eqrange.first = persistent_index.begin();
eqrange.second = persistent_index.end();
}
else
{
std::string bound = key;
if (bound[bound.size()-1] != '/')
bound += "/";
eqrange.first = persistent_index.lower_bound(bound);
bound[bound.size()-1]++;
eqrange.second = persistent_index.lower_bound(bound);
}
}
for (auto it = eqrange.first; it != eqrange.second; ++it)
{
auto hfig = df::historical_figure::find(-it->second);
if (hfig && hfig->name.has_name)
vec->push_back(dataFromHFig(hfig));
}
}
示例7: getVariable
netCDF::NcVar NetCDFFile::getVariable(const std::string &variableName) const
{
if( variableName.empty() == true )
{
/// returns a null object
return netCDF::NcVar();
}
const std::multimap< std::string, netCDF::NcVar > vars = file.getVars();
for( std::multimap< std::string, netCDF::NcVar >::const_iterator it = vars.begin();
it != vars.end();
++it )
{
const std::string varName = (*it).first;
if( varName == variableName )
{
const netCDF::NcVar var = (*it).second;
return var;
}
}
/// returns a null object
return netCDF::NcVar();
}
示例8:
~mapper()
{
for( auto c = callbacks.begin(); c != callbacks.end(); ++c )
{
delete c->second;
}
}
示例9: Run
virtual void Run()
{
now = v8::base::OS::TimeCurrentMillis();
while (1)
{
AsyncEvent *p;
std::multimap<double, AsyncEvent *>::iterator e;
wait();
now = v8::base::OS::TimeCurrentMillis();
while (1)
{
p = s_acSleep.get();
if (p == NULL)
break;
s_tms.insert(std::make_pair(now + p->result(), p));
}
while (1)
{
e = s_tms.begin();
if (e == s_tms.end())
break;
if (e->first > now)
break;
e->second->apost(0);
s_tms.erase(e);
}
}
}
示例10: dispatch_callbacks
void dispatch_callbacks() const
{
mappedinput input = current_mappedinput;
for( auto it = callbacks.begin(); it != callbacks.end(); ++it )
( *it->second )( input );
}
示例11: ltr_int_broadcast_pose
bool ltr_int_broadcast_pose(linuxtrack_full_pose_t &pose)
{
pthread_mutex_lock(&send_mx);
std::multimap<std::string, int>::iterator i;
int res;
bool checkSlaves = false;
//Send updated pose to all clients
//printf("Master: %g %g %g\n", pose.pose.raw_pitch, pose.pose.raw_yaw, pose.pose.raw_roll);
for(i = slaves.begin(); i != slaves.end();) {
res = ltr_int_send_data(i->second, &pose);
if(res == -EPIPE) {
ltr_int_log_message("Slave @socket %d left!\n", i->second);
close(i->second);
i->second = -1;
slaves.erase(i++);
checkSlaves = true;
} else {
++i;
}
}
if(checkSlaves && (slaves.size() == 0)) {
no_slaves = true;
}
pthread_mutex_unlock(&send_mx);
return true;
}
示例12: check_authentication
bool DumbRelayConsumer::check_authentication(const std::multimap<std::string, std::string> ¶ms) {
// Construct the data for the post.
std::ostringstream data;
CURL *curl = new_curl_handle();
data << "openid.mode=check_authentication";
for(std::multimap<std::string, std::string>::const_iterator iter = params.begin();
iter != params.end();
++iter) {
if(iter->first.compare("openid.mode") == 0) continue;
char *tmp;
tmp = curl_easy_escape(curl, iter->first.c_str(), iter->first.size());
data << "&" << tmp << "=";
curl_free(tmp);
tmp = curl_easy_escape(curl, iter->second.c_str(), iter->second.size());
data << tmp;
curl_free(tmp);
}
// Clean up after curl.
curl_easy_cleanup(curl);
// Prepare the curl handle.
std::string content = contact_openid_provider(data.str());
// Check to see if we can find the is_valid:true response.
return content.find("\nis_valid:true\n") != content.npos;
}
示例13: flush_immediate_sync
void flush_immediate_sync() {
auto seq_no = processor_.max_finished_seq_no();
for (auto it = immediate_sync_promises_.begin(), end = immediate_sync_promises_.end();
it != end && it->first <= seq_no; it = immediate_sync_promises_.erase(it)) {
do_immediate_sync(std::move(it->second));
}
}
示例14: PrintAllVariables
void NetCDFFile::PrintAllVariables(std::ostream & output) const
{
/// retrieves all the variables
const std::multimap< std::string, netCDF::NcVar > vars = file.getVars();
for( std::multimap< std::string, netCDF::NcVar >::const_iterator it = vars.begin();
it != vars.end();
++it )
{
const std::string varName = (*it).first;
std::vector< std::size_t > dimensions;
GetVariableDimensions( dimensions, varName ),
output << varName << " = " << "(";
for( std::size_t k = 0; k < dimensions.size(); k++ )
{
output << dimensions[k];
if( k < dimensions.size() - 1 )
{
output << ",";
}
}
output << ")" << std::endl;
}
}
示例15: deactivateAll
void deactivateAll()
{
for (iter_t i = ev.begin(); i != ev.end(); ++i)
{
i->second->activate_cmd(0);
}
}