Make sure unordered map references aren't invalidated by reserving sufficient space

This commit is contained in:
Dan Paulat 2024-05-24 01:55:01 -05:00
parent 26a22d4e84
commit 8f4325f61a
7 changed files with 39 additions and 4 deletions

View file

@ -57,7 +57,10 @@ public:
config::CountyDatabase::GetCountyName(value) != value;
});
for (auto& phenomenon : types::GetAlertAudioPhenomena())
auto& alertAudioPhenomena = types::GetAlertAudioPhenomena();
alertEnabled_.reserve(alertAudioPhenomena.size() + 1);
for (auto& phenomenon : alertAudioPhenomena)
{
std::string phenomenonCode = awips::GetPhenomenonCode(phenomenon);
std::string name = fmt::format("{}_enabled", phenomenonCode);