17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-06 20:58:35 +01:00

refactor(sonar): use try_emplace for map insertion (cpp:S6030)

This commit is contained in:
jerrrrycho
2026-10-10 15:51:29 +02:00
parent 8d93367de7
commit f8c6e358bd
17 changed files with 64 additions and 64 deletions

View File

@@ -278,7 +278,7 @@ TGauge::Load_mapping( cParser &Input, TGauge::scratch_data &Scratchpad ) {
auto const indexstart { key.find_first_of( "-1234567890" ) };
auto const indexend { key.find_first_not_of( "-1234567890", indexstart ) };
if( indexstart != std::string::npos ) {
m_soundfxvalues.emplace(
m_soundfxvalues.try_emplace(
std::stoi( key.substr( indexstart, indexend - indexstart ) ),
sound_source( m_soundtemplate ).deserialize( Input, sound_type::single ) );
}

View File

@@ -52,11 +52,11 @@ void control_mapper::insert(TGauge const &Gauge, std::string const &Label)
if (Gauge.SubModel != nullptr)
{
m_controlnames.emplace(Gauge.SubModel, Label);
m_controlnames.try_emplace(Gauge.SubModel, Label);
}
if (Gauge.SubModelOn != nullptr)
{
m_controlnames.emplace(Gauge.SubModelOn, Label);
m_controlnames.try_emplace(Gauge.SubModelOn, Label);
}
m_names.emplace(Label);