mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:40:05 +00:00
Make sure unordered map references aren't invalidated by reserving sufficient space
This commit is contained in:
parent
26a22d4e84
commit
8f4325f61a
7 changed files with 39 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ class HotkeySettings::Impl
|
|||
public:
|
||||
explicit Impl()
|
||||
{
|
||||
hotkey_.reserve(types::HotkeyIterator().count() + 1);
|
||||
|
||||
for (const auto& hotkey : types::HotkeyIterator())
|
||||
{
|
||||
const std::string& name = types::GetHotkeyShortName(hotkey);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ class PaletteSettings::Impl
|
|||
public:
|
||||
explicit Impl()
|
||||
{
|
||||
palette_.reserve(kPaletteKeys_.size());
|
||||
|
||||
for (const auto& name : kPaletteKeys_)
|
||||
{
|
||||
const std::string& defaultValue = kDefaultPalettes_.at(name);
|
||||
|
|
@ -92,6 +94,9 @@ public:
|
|||
variables_.push_back(&settingsVariable);
|
||||
};
|
||||
|
||||
activeAlertColor_.reserve(kAlertColors_.size());
|
||||
inactiveAlertColor_.reserve(kAlertColors_.size());
|
||||
|
||||
for (auto& alert : kAlertColors_)
|
||||
{
|
||||
std::string phenomenonCode = awips::GetPhenomenonCode(alert.first);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ TextSettings& TextSettings::operator=(TextSettings&&) noexcept = default;
|
|||
|
||||
void TextSettings::Impl::InitializeFontVariables()
|
||||
{
|
||||
fontData_.reserve(types::FontCategoryIterator().count());
|
||||
|
||||
for (auto fontCategory : types::FontCategoryIterator())
|
||||
{
|
||||
auto result = fontData_.emplace(fontCategory, FontData {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue