本文整理汇总了C++中std::multimap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::end方法的具体用法?C++ multimap::end怎么用?C++ multimap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::multimap
的用法示例。
在下文中一共展示了multimap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBarIndexes
void setBarIndexes(
std::multimap<ReducedFraction, MidiChord> &chords,
const ReducedFraction &basicQuant,
const ReducedFraction &lastTick,
const TimeSigMap *sigmap)
{
if (chords.empty())
return;
auto it = chords.begin();
for (int barIndex = 0;; ++barIndex) { // iterate over all measures by indexes
const auto endBarTick = ReducedFraction::fromTicks(sigmap->bar2tick(barIndex + 1, 0));
if (endBarTick <= it->first)
continue;
for (; it != chords.end(); ++it) {
const auto onTime = Quantize::findQuantizedChordOnTime(*it, basicQuant);
#ifdef QT_DEBUG
const auto barStart = ReducedFraction::fromTicks(sigmap->bar2tick(barIndex, 0));
Q_ASSERT_X(!(it->first >= barStart && onTime < barStart),
"MChord::setBarIndexes", "quantized on time cannot be in previous bar");
#endif
if (onTime < endBarTick) {
it->second.barIndex = barIndex;
continue;
}
break;
}
if (it == chords.end() || endBarTick > lastTick)
break;
}
Q_ASSERT_X(areBarIndexesSet(chords),
"MChord::setBarIndexes", "Not all bar indexes were set");
Q_ASSERT_X(areBarIndexesSuccessive(chords),
"MChord::setBarIndexes", "Bar indexes are not successive");
}
示例2: GenerateConnections
void PatternLink::GenerateConnections( const std::multimap<lem::UCString,const Word_Form*> & points, SynPatternResult * cur_result ) const
{
typedef std::multimap<lem::UCString,const Word_Form*>::const_iterator IT;
IT it_from = points.find( from_marker );
if( it_from==points.end() )
{
lem::MemFormatter mem;
mem.printf( "Can not find node %us.%us to create link head", from_marker.c_str(), from_node.c_str() );
throw lem::E_BaseException( mem.string() );
}
const Word_Form * node0 = it_from->second;
std::pair<IT,IT> pit = points.equal_range( to_marker );
if( pit.first==points.end() && !optional_to_node )
{
lem::MemFormatter mem;
mem.printf( "Can not find node %us to create link tail", to_marker.c_str() );
throw lem::E_BaseException( mem.string() );
}
for( IT it=pit.first; it!=pit.second; ++it )
{
const Solarix::Word_Form * node1 = it->second;
PatternLinkEdge new_edge( node0, link_type, node1 );
cur_result->AddLinkageEdge( new_edge );
}
return;
}
示例3: DuplicateComparison
/**
\brief This function calculates the number of duplicates based from the filenames and their sizes.
\param files The file structure consisting of a map of file size and file name.
\return An unsigned int equal to the number of duplicates found.
**/
unsigned int DuplicateFinder::DuplicateComparison( const std::multimap<unsigned int, std::wstring> & files )
{
unsigned int numDupes = 0;
//check to see if a file's size has other matching files' sizes
auto mit = files.begin(); //mit is an iterator through the file list
while( mit != files.end() ) //while searching through the list
{
//checking the file immediately after the currently iterated file
if( ( std::next( mit ) != files.end() ) )
{
if( ( std::next( mit ) )->first == mit->first ) // if filesize is same as next's:
{
//open the iterated entry
boost::filesystem::ifstream original( mit->second, std::ios::binary );
if( original.is_open() ) //if we opened it...
{
//open the next file to compare
boost::filesystem::ifstream checking( ( std::next( mit ) )->second,
std::ios::binary );
if( checking.is_open() ) //if successfully opened,
{
char originalByte; //for original's same byte
char nextByte; //for next's same byte
//start by reading check's first byte
checking.read( &nextByte, sizeof( char ) );
//start by reading original's first byte
original.read( &originalByte, sizeof( char ) );
//while we're not at the end of the files
while( !checking.eof() || !original.eof() )
{
//check to make sure the bytes are not different
if( nextByte != originalByte )
{
break; //move on to the next file
}
//read in the next bytes
checking.read( &nextByte, sizeof( char ) );
original.read( &originalByte, sizeof( char ) );
}
//if we were at the end of both files, we report a duplicate into the
//duplicate list and add an extra entry to "numberOfDuplicates"
if( checking.eof() && original.eof() )
{
duplicates.push_back( next( mit )->second +
std::wstring( L" is a duplicate of ") +
mit->second);
++numDupes;
}
}
}
}
}
++mit;
}
return numDupes;
}
示例4:
std::multimap<ReducedFraction, MidiChord>::const_iterator
findFirstChordInRange(const std::multimap<ReducedFraction, MidiChord> &chords,
const ReducedFraction &startRangeTick,
const ReducedFraction &endRangeTick)
{
auto iter = chords.lower_bound(startRangeTick);
if (iter != chords.end() && iter->first >= endRangeTick)
iter = chords.end();
return iter;
}
示例5: minimizeNumberOfRests
void minimizeNumberOfRests(
std::multimap<ReducedFraction, MidiChord> &chords,
const TimeSigMap *sigmap,
const std::multimap<ReducedFraction, MidiTuplet::TupletData> &tuplets)
{
for (auto it = chords.begin(); it != chords.end(); ++it) {
for (MidiNote ¬e: it->second.notes) {
const auto barStart = MidiBar::findBarStart(note.offTime, sigmap);
const auto barFraction = ReducedFraction(
sigmap->timesig(barStart.ticks()).timesig());
auto durationStart = (it->first > barStart) ? it->first : barStart;
if (it->second.isInTuplet) {
const auto &tuplet = it->second.tuplet->second;
if (note.offTime >= tuplet.onTime + tuplet.len)
durationStart = tuplet.onTime + tuplet.len;
}
auto endTime = (barStart == note.offTime)
? barStart : barStart + barFraction;
if (note.isInTuplet) {
const auto &tuplet = note.tuplet->second;
if (note.offTime == tuplet.onTime + tuplet.len)
continue;
endTime = barStart + Quantize::quantizeToLarge(
note.offTime - barStart, tuplet.len / tuplet.tupletNumber);
}
const auto beatLen = Meter::beatLength(barFraction);
const auto beatTime = barStart + Quantize::quantizeToLarge(
note.offTime - barStart, beatLen);
if (endTime > beatTime)
endTime = beatTime;
auto next = std::next(it);
while (next != chords.end()
&& (next->second.voice != it->second.voice
|| next->first < note.offTime)) {
++next;
}
if (next != chords.end()) {
if (next->first < endTime)
endTime = next->first;
if (next->second.isInTuplet && !note.isInTuplet) {
const auto &tuplet = next->second.tuplet->second;
if (tuplet.onTime < endTime)
endTime = tuplet.onTime;
}
}
lengthenNote(note, it->second.voice, it->first, durationStart, endTime,
barStart, barFraction, tuplets);
}
}
}
示例6: dispatch_callbacks
void dispatch_callbacks() const
{
mappedinput input = current_mappedinput;
for( auto it = callbacks.begin(); it != callbacks.end(); ++it )
( *it->second )( input );
}
示例7: 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));
}
}
示例8: 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));
}
}
示例9: 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();
}
}
示例10: deactivateAll
void deactivateAll()
{
for (iter_t i = ev.begin(); i != ev.end(); ++i)
{
i->second->activate_cmd(0);
}
}
示例11: removeDeviceEventProc
void AudioOutputDeviceManager::removeDeviceEventProc(
int _card
, std::multimap< int, const AudioOutputDevice * > & _devices
)
{
auto iterators = _devices.equal_range( _card );
if( iterators.first == _devices.end() ) {
return;
}
DevicesDeleter deleter(
_devices
, iterators
);
std::for_each(
iterators.first
, iterators.second
, [
this
]
(
std::pair< const int, const AudioOutputDevice * > & _pair
)
{
const auto DEVICE = _pair.second;
this->callDisconnectEventHandler(
*DEVICE
);
}
);
}
示例12: Timer
static void PASCAL Timer(unsigned int uTimerID, unsigned int uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
{
AsyncEvent *p;
double tm;
std::multimap<double, AsyncEvent *>::iterator e;
while (1)
{
p = s_acSleep.get();
if (p == NULL)
break;
tm = s_time + s_now + p->result();
s_tms.insert(std::make_pair(tm, p));
}
atom_xchg(&s_now, (int)(v8::internal::OS::TimeCurrentMillis() - s_time));
while (1)
{
e = s_tms.begin();
if (e == s_tms.end())
break;
if (e->first > s_time + s_now)
break;
e->second->apost(0);
s_tms.erase(e);
}
}
示例13: 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);
}
}
示例14: deinitCs
void deinitCs()
{
for(std::multimap<std::string, char *>::iterator it = event_dict.begin();it != event_dict.end();++it)
{
free(it->second);
}
}
示例15: GetMatches
void PeakMatchingResults::GetMatches(std::vector<int> &vectFeatureIndices, std::vector<int> &vectMassTagIndices,
std::vector<int> &vectProteinIndices , const std::vector<MultiAlignEngine::MassTags::Protein>* &vectProteins,
const std::vector<MultiAlignEngine::MassTags::MassTag>* &vectMasstags) const
{
// The mass tag database has stored in it all the proteins and mass tags corresponding to the matches.
// So thats where we need to get all the data from.
int numMatches = (int) mvectPeakMatches.size();
std::set <int> massTagID;
stdext::hash_map <int, int > massTagSeen;
// first get all mass tags in the matches into the set of mass tags.
for (int matchNum = 0; matchNum < numMatches; matchNum++)
{
PeakMatch match = mvectPeakMatches[matchNum];
massTagSeen.insert(std::pair<int,int>(match.mintMasstagID, matchNum));
}
// copy hash to mass tag vector
std::vector<int> vectMassTagIDs;
vectMassTagIDs.reserve(massTagSeen.size());
for (stdext::hash_map <int, int >::iterator massTagIter = massTagSeen.begin();
massTagIter != massTagSeen.end(); massTagIter++)
{
vectMassTagIDs.push_back((*massTagIter).first);
}
vectMasstags = mobjMasstagDB.GetMassTagVector();
vectProteins = mobjMasstagDB.GetProteinVector();
const std::multimap<int,int> mapMassTagId2ProteinIndex = mobjMasstagDB.GetMassTagId2ProteinIndexMap();
const stdext::hash_map <int, int > hashMapMassTagId2Index = mobjMasstagDB.GetMassTagId2IndexHash();
// now the relevant mass tags are copied, their ids are copied, the protein names are copied.
// So lets create the table of matches using the three vectors vectFeatureIndices, vectMassTagIndices and
// vectProteinIndices. Basically, vectFeatureIndices will have the index of the ms feature in a peak match.
// the vectMassTagIndices will have the corresponding massTagID, and vectProteinIndices will have the corresponding
// parent protein.
for (std::multimap<int,int>::const_iterator featureIter = mmapFeatureIndex2PeakMatch.begin(); featureIter != mmapFeatureIndex2PeakMatch.end();
featureIter++)
{
int featureIndex = (*featureIter).first;
int peakMatchIndex = (*featureIter).second;
PeakMatch pkMatch = mvectPeakMatches[peakMatchIndex];
int massTagID = pkMatch.mintMasstagID;
stdext::hash_map <int, int>::const_iterator massTagIterHash = hashMapMassTagId2Index.find(massTagID);
int massTagIndex = (*massTagIterHash).second;
// now go through each of the parent proteins of this massTagID and push the triplet into their
// corresponding vectors
for (std::multimap<int,int>::const_iterator massTagIter = mapMassTagId2ProteinIndex.find(massTagID);
massTagIter != mapMassTagId2ProteinIndex.end();
massTagIter++)
{
if ((*massTagIter).first != massTagID)
break;
vectFeatureIndices.push_back(featureIndex);
vectMassTagIndices.push_back(massTagIndex);
vectProteinIndices.push_back((*massTagIter).second);
}
}
}