diff --git a/src/core/task/closest_set.h b/src/core/task/closest_set.h index d10c34f..6be1fd3 100644 --- a/src/core/task/closest_set.h +++ b/src/core/task/closest_set.h @@ -52,13 +52,13 @@ class ClosestSet { closest[cn->getId()] = cn; if (closest.size() > capacity) { auto last = std::prev(closest.cend()); - closest.erase(last); - if (last->second == cn) { insertAttemptsSinceTailModification++; } else { insertAttemptsSinceTailModification = 0; } + + closest.erase(last->first); } const auto head = closest.cbegin()->second; @@ -102,7 +102,7 @@ class ClosestSet { private: const Id& target; - int capacity; + int capacity {0}; std::map> closest {};