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
2020-12-29 16:35:25 -05:00
parent 3b2e31230f
commit ba0540b9c5
2 changed files with 6 additions and 5 deletions

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);
}