Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

utils: Fix deletion from a multimap [CORRECTIVE]

  • Loading branch information...
commit 00c9b594d68c1e073b69b492be3e814d08ae14e1 1 parent 446d1fa
@japeq authored
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;
Please sign in to comment.
Something went wrong with that request. Please try again.