intervalmap: use updated upper_bound when checking removal of next node
parent
1a4412c5b1
commit
47543c9101
|
@ -38,8 +38,9 @@ public:
|
||||||
if(end_next_entry->first != end)
|
if(end_next_entry->first != end)
|
||||||
treemap[end] = end_prev_entry->second;
|
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
|
// 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
|
// insert the start key. Replaces whatever value is already there. Do not place if the element before is of the same value
|
||||||
|
|
Loading…
Reference in New Issue