IOS: Allow for heterogenous name lookup

Allows lookups to be done with std::string_view or any other string
type. This allows for non-allocating strings to be used with the name
lookup without needing to construct a std::string.
This commit is contained in:
Lioncash committed 2020-12-29 19:32:14 -05:00
1 parent 3b2e31230f
commit ba0540b9c5
2 files changed
+6 -5

No files matched your search

+2 -2
View File
@@ -505,14 +505,14 @@ s32 Kernel::GetFreeDeviceID()
return -1;
}
std::shared_ptr<Device::Device> Kernel::GetDeviceByName(const std::string& device_name)
std::shared_ptr<Device::Device> Kernel::GetDeviceByName(std::string_view device_name)
{
std::lock_guard lock(m_device_map_mutex);
const auto iterator = m_device_map.find(device_name);
return iterator != m_device_map.end() ? iterator->second : nullptr;
}
std::shared_ptr<Device::Device> EmulationKernel::GetDeviceByName(const std::string& device_name)
std::shared_ptr<Device::Device> EmulationKernel::GetDeviceByName(std::string_view device_name)
{
return Kernel::GetDeviceByName(device_name);
}