I have declared this STL multiset
:
multiset playingNotes;
and my comparator is:
I'd agree with Mohamad Elghawi's answer. But it is incomplete.
Your actual code will use a find_if, just like this:
const auto it = find_if(cbegin(playingNotes), cend(playingNotes), [value = int{60}](const auto& i){return i.mNote == value;});
if(it != cend(playingNotes)) {
playingNotes.erase(it);
}
This will remove the IMidiMsgExt
with the lowest mTick
value which has an mNote
of 60 (or whatever value
was initialized to.) If there are multiple IMidiMsgExt
s in playingNotes
that tie for the lowest, the IMidiMsgExt
that has been in playingNotes
the longest will be removed.
You're explanation of the problem was a little sparse, so I've created and solved a Minimal, Complete, Verifiable Example here: http://ideone.com/oFQ4rS