How to remove a specific pair from a C++ multimap?
问题 #include <map> ... multimap<char,int> first; first.insert(pair<char,int>('a',10)); first.insert(pair<char,int>('b',15)); first.insert(pair<char,int>('b',20)); first.insert(pair<char,int>('c',25)); Say I now want to remove one of the pairs I have just added to the map. I have examples to remove an entire key entry, which for key 'b' would remove both 'b',15 and 'b',20. But what is the code to remove just, say, the pair 'b',20? 回答1: You can use std::multimap<char, int>::equal_range , which will