mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
common/input: Pass ParamPackage by const reference in CreateDevice
This was previously being passed by value, which was unnecessary and created more allocations than necessary.
This commit is contained in:
parent
6291eec700
commit
7f42432f42
1 changed files with 3 additions and 3 deletions
|
@ -417,12 +417,12 @@ std::unique_ptr<InputDeviceType> CreateDeviceFromString(const std::string& param
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an input device from given paramters.
|
* Create an input device from given parameters.
|
||||||
* @tparam InputDeviceType the type of input devices to create
|
* @tparam InputDeviceType the type of input devices to create
|
||||||
* @param A ParamPackage that contains all parameters for creating the device
|
* @param package A ParamPackage that contains all parameters for creating the device
|
||||||
*/
|
*/
|
||||||
template <typename InputDeviceType>
|
template <typename InputDeviceType>
|
||||||
std::unique_ptr<InputDeviceType> CreateDevice(const Common::ParamPackage package) {
|
std::unique_ptr<InputDeviceType> CreateDevice(const ParamPackage& package) {
|
||||||
const std::string engine = package.Get("engine", "null");
|
const std::string engine = package.Get("engine", "null");
|
||||||
const auto& factory_list = Impl::FactoryList<InputDeviceType>::list;
|
const auto& factory_list = Impl::FactoryList<InputDeviceType>::list;
|
||||||
const auto pair = factory_list.find(engine);
|
const auto pair = factory_list.find(engine);
|
||||||
|
|
Loading…
Reference in a new issue