Fix map override

This commit is contained in:
Vasilii Rogin 2023-05-15 18:34:54 +03:00
parent 22aeafd585
commit fdbf69deee
1 changed files with 4 additions and 2 deletions

View File

@ -421,8 +421,10 @@ public:
keys.push_back(std::move(keyEl));
// Not very good that we copy string into map key and into keys array
auto keyElForMap = ArrayElement { key, program };
map.emplace(std::move(keyElForMap), ArrayElement { val, program });
map.emplace(ArrayElement { key, program }, ArrayElement { val, program });
} else {
auto newValue = ArrayElement { val, program };
std::swap(map.at(keyEl), newValue);
}
}
}