intervalmap: use updated upper_bound when checking removal of next node

pull/1/head
EmaMaker 2023-04-10 00:28:42 +02:00
parent 1a4412c5b1
commit 47543c9101
1 changed files with 2 additions and 1 deletions

View File

@ -38,8 +38,9 @@ public:
if(end_next_entry->first != end)
treemap[end] = end_prev_entry->second;
auto e = treemap.upper_bound(end);
// A little optimization: delete next key if it is of the same value of the end key
//if(end_next_entry->second == treemap[end]) treemap.erase(end_next_entry);
if(e != treemap.end() && e->second == treemap[end]) treemap.erase(end_next_entry);
}
// insert the start key. Replaces whatever value is already there. Do not place if the element before is of the same value