mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-05 13:11:57 +02:00
Make limited map actually respect max size
This commit is contained in:
@ -38,7 +38,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::pair<iterator, bool> ret = map.insert(x);
|
std::pair<iterator, bool> ret = map.insert(x);
|
||||||
if (ret.second) {
|
if (ret.second) {
|
||||||
if (nMaxSize && map.size() == nMaxSize) {
|
if (nMaxSize && map.size() > nMaxSize) {
|
||||||
map.erase(rmap.begin()->second);
|
map.erase(rmap.begin()->second);
|
||||||
rmap.erase(rmap.begin());
|
rmap.erase(rmap.begin());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user