IOS: Make use of insert_or_assign with AddDevice()

operator[] performs a default construction if an object at the given key
doesn't exist before overwriting it with the one we provide in operator=

insert_or_assign performs optimal insertion by avoiding the default
construction if an entry doesn't exist.

Not a game changer, but it is essentially a "free" change.
This commit is contained in:
Lioncash 2020-12-29 16:37:24 -05:00
parent ba0540b9c5
commit 0e91470828
1 changed files with 1 additions and 1 deletions

View File

@ -409,7 +409,7 @@ bool Kernel::BootIOS(const u64 ios_title_id, const std::string& boot_content_pat
void Kernel::AddDevice(std::unique_ptr<Device::Device> device)
{
ASSERT(device->GetDeviceType() == Device::Device::DeviceType::Static);
m_device_map[device->GetDeviceName()] = std::move(device);
m_device_map.insert_or_assign(device->GetDeviceName(), std::move(device));
}
void Kernel::AddCoreDevices()