Skip to content
Browse files

utils: Fix deletion from a multimap [CORRECTIVE]

  • Loading branch information...
1 parent 446d1fa commit 00c9b594d68c1e073b69b492be3e814d08ae14e1 @japeq committed Apr 15, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 utils.h
View
4 utils.h
@@ -252,8 +252,8 @@ void ins(std::multimap<Key, Value> &map, const Key &key, const Value &value)
template<class Key, class Value>
void del(std::multimap<Key, Value> &map, const Key &key, const Value &value)
{
- typename std::multimap<Key, Value>::iterator i = map.find(key);
- while (i != map.end()) {
+ typename std::multimap<Key, Value>::iterator i = map.lower_bound(key);
+ while (i != map.end() && i->first == key) {
if (i->second == value) {
map.erase(i);
return;

0 comments on commit 00c9b59

Please sign in to comment.
Something went wrong with that request. Please try again.