I have declared this STL multiset
:
multiset playingNotes;
and my comparator is:
Solution with Boost.MultiIndex:
Live Coliru Demo
#include
#include
#include
#include
using namespace boost::multi_index;
struct IMidiMsgExt
{
int mTick;
int mTone;
};
using MidiSet=multi_index_container<
IMidiMsgExt,
indexed_by<
ordered_unique>,
hashed_non_unique>
>
>;
#include
int main()
{
MidiSet m={{0,100},{2,60},{3,150},{5,60},{1,200},{4,90}};
std::cout<<"before erasing:\n";
for(const auto& msg:m)std::cout<<"["<().erase(60);
std::cout<<"after erasing:\n";
for(const auto& msg:m)std::cout<<"["<
Output
before erasing: [0,100][1,200][2,60][3,150][4,90][5,60] after erasing: [0,100][1,200][3,150][4,90]