refactor: use std::map::try_emplace()
over std::map::insert()
(#46761)
refactor: prefer std::map::try_emplace() over std::map::insert()
This commit is contained in:
parent
8fa7d324d1
commit
b40b4dc015
10 changed files with 15 additions and 21 deletions
|
@ -307,7 +307,7 @@ void HidChooserContext::SetUpHidManagerConnection(
|
|||
void HidChooserContext::InitDeviceList(
|
||||
std::vector<device::mojom::HidDeviceInfoPtr> devices) {
|
||||
for (auto& device : devices)
|
||||
devices_.insert({device->guid, std::move(device)});
|
||||
devices_.try_emplace(device->guid, std::move(device));
|
||||
|
||||
is_initialized_ = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue