refactor(Core/Misc): Use emplace_back instead of push_back to avoid extra copy/m… (#20114)

refactor: Use emplace_back instead of push_back to avoid extra copy/move operations
This commit is contained in:
Angelo Venturini
2024-10-10 16:55:58 -03:00
committed by GitHub
parent cfb3229bf1
commit 9487b30ad7
10 changed files with 32 additions and 35 deletions

View File

@@ -109,7 +109,7 @@ void LoadSkillDiscoveryTable()
continue;
}
SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
SkillDiscoveryStore[reqSkillOrSpell].emplace_back(spellId, reqSkillValue, chance);
}
else if (reqSkillOrSpell == 0) // skill case
{
@@ -122,7 +122,7 @@ void LoadSkillDiscoveryTable()
}
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
SkillDiscoveryStore[-int32(_spell_idx->second->SkillLine)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
SkillDiscoveryStore[-int32(_spell_idx->second->SkillLine)].emplace_back(spellId, reqSkillValue, chance);
}
else
{