diff options
| author | 2018-08-02 21:51:08 -0400 | |
|---|---|---|
| committer | 2018-08-02 21:51:11 -0400 | |
| commit | 684fc2c32067cf450cd1e95c036c5337aa860718 (patch) | |
| tree | 59c9f5035c879305364f591f1982634885121dc0 /src/input_common/sdl/sdl.cpp | |
| parent | input_common: Add missing override specifiers (diff) | |
| download | yuzu-684fc2c32067cf450cd1e95c036c5337aa860718.tar.gz yuzu-684fc2c32067cf450cd1e95c036c5337aa860718.tar.xz yuzu-684fc2c32067cf450cd1e95c036c5337aa860718.zip | |
input_common: Use std::move where applicable
Avoids unnecessary atomic reference count increments and decrements
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/sdl/sdl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_common/sdl/sdl.cpp b/src/input_common/sdl/sdl.cpp index 604d9a7d9..d1b960fd7 100644 --- a/src/input_common/sdl/sdl.cpp +++ b/src/input_common/sdl/sdl.cpp | |||
| @@ -82,7 +82,7 @@ private: | |||
| 82 | class SDLButton final : public Input::ButtonDevice { | 82 | class SDLButton final : public Input::ButtonDevice { |
| 83 | public: | 83 | public: |
| 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) | 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) |
| 85 | : joystick(joystick_), button(button_) {} | 85 | : joystick(std::move(joystick_)), button(button_) {} |
| 86 | 86 | ||
| 87 | bool GetStatus() const override { | 87 | bool GetStatus() const override { |
| 88 | return joystick->GetButton(button); | 88 | return joystick->GetButton(button); |
| @@ -96,7 +96,7 @@ private: | |||
| 96 | class SDLDirectionButton final : public Input::ButtonDevice { | 96 | class SDLDirectionButton final : public Input::ButtonDevice { |
| 97 | public: | 97 | public: |
| 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) | 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) |
| 99 | : joystick(joystick_), hat(hat_), direction(direction_) {} | 99 | : joystick(std::move(joystick_)), hat(hat_), direction(direction_) {} |
| 100 | 100 | ||
| 101 | bool GetStatus() const override { | 101 | bool GetStatus() const override { |
| 102 | return joystick->GetHatDirection(hat, direction); | 102 | return joystick->GetHatDirection(hat, direction); |
| @@ -112,7 +112,7 @@ class SDLAxisButton final : public Input::ButtonDevice { | |||
| 112 | public: | 112 | public: |
| 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, | 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, |
| 114 | bool trigger_if_greater_) | 114 | bool trigger_if_greater_) |
| 115 | : joystick(joystick_), axis(axis_), threshold(threshold_), | 115 | : joystick(std::move(joystick_)), axis(axis_), threshold(threshold_), |
| 116 | trigger_if_greater(trigger_if_greater_) {} | 116 | trigger_if_greater(trigger_if_greater_) {} |
| 117 | 117 | ||
| 118 | bool GetStatus() const override { | 118 | bool GetStatus() const override { |
| @@ -132,7 +132,7 @@ private: | |||
| 132 | class SDLAnalog final : public Input::AnalogDevice { | 132 | class SDLAnalog final : public Input::AnalogDevice { |
| 133 | public: | 133 | public: |
| 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) | 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) |
| 135 | : joystick(joystick_), axis_x(axis_x_), axis_y(axis_y_) {} | 135 | : joystick(std::move(joystick_)), axis_x(axis_x_), axis_y(axis_y_) {} |
| 136 | 136 | ||
| 137 | std::tuple<float, float> GetStatus() const override { | 137 | std::tuple<float, float> GetStatus() const override { |
| 138 | return joystick->GetAnalog(axis_x, axis_y); | 138 | return joystick->GetAnalog(axis_x, axis_y); |