leapfrog
leapfrog copied to clipboard
Fix - Value is not inserted with try_insert after removing it with remove
Value is not inserted with try_insert after removing it with remove.
The problem:
map.insert(1, 1);
map.remove(&1);
map.try_insert(1, 2);
let value = map.get(&1);
In this example, value returns None, when it should return 2
How to fix:
Replace:
if must_update
To:
if must_update || old_value.is_null()
Filename: leapmap.rs
Thanks.