mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 05:09:20 +02:00
refactor(sonar): use try_emplace for map insertion (cpp:S6030)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,7 @@ void network::tcp::client::handle_accept(const asio::error_code &err) const
|
||||
}
|
||||
|
||||
network::tcp::asio_manager::asio_manager() {
|
||||
backend_list().emplace("tcp", this);
|
||||
backend_list().try_emplace("tcp", this);
|
||||
}
|
||||
|
||||
std::shared_ptr<network::server> network::tcp::asio_manager::create_server(std::shared_ptr<std::fstream> backbuffer, const std::string &conf) {
|
||||
|
||||
@@ -79,7 +79,7 @@ void network::request_command::deserialize(std::istream &stream)
|
||||
sequence.emplace_back(data);
|
||||
}
|
||||
|
||||
commands.emplace(recipient, sequence);
|
||||
commands.try_emplace(recipient, sequence);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ void network::server::handle_message(std::shared_ptr<connection> conn, const mes
|
||||
const auto& cmd = dynamic_cast<const request_command&>(msg);
|
||||
|
||||
for (auto const &kv : cmd.commands)
|
||||
client_commands_queue.emplace(kv);
|
||||
client_commands_queue.try_emplace(kv.first, kv.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user