From 0e91470828769bd68b1f3ee59d5616bcf3f129df Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 Dec 2020 16:37:24 -0500 Subject: [PATCH] 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. --- Source/Core/Core/IOS/IOS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index 25c7dea018..3f715215dd 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -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) { 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()