From 0f9e13a2bb3ad6de93c13d00cf6717fc06eede97 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Sat, 4 Dec 2021 22:23:29 +0000 Subject: [PATCH] Use list-initialization to zero-initialize 'JoystickImpl.hpp' structures --- src/SFML/Window/JoystickImpl.hpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/SFML/Window/JoystickImpl.hpp b/src/SFML/Window/JoystickImpl.hpp index 2c0b6ffab..7a78f4af2 100644 --- a/src/SFML/Window/JoystickImpl.hpp +++ b/src/SFML/Window/JoystickImpl.hpp @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////// #include #include -#include namespace sf @@ -43,14 +42,8 @@ namespace priv //////////////////////////////////////////////////////////// struct JoystickCaps { - JoystickCaps() - { - buttonCount = 0; - std::fill(axes, axes + Joystick::AxisCount, false); - } - - unsigned int buttonCount; //!< Number of buttons supported by the joystick - bool axes[Joystick::AxisCount]; //!< Support for each axis + unsigned int buttonCount{0}; //!< Number of buttons supported by the joystick + bool axes[Joystick::AxisCount]{}; //!< Support for each axis }; @@ -60,16 +53,9 @@ struct JoystickCaps //////////////////////////////////////////////////////////// struct JoystickState { - JoystickState() - { - connected = false; - std::fill(axes, axes + Joystick::AxisCount, 0.f); - std::fill(buttons, buttons + Joystick::ButtonCount, false); - } - - bool connected; //!< Is the joystick currently connected? - float axes[Joystick::AxisCount]; //!< Position of each axis, in range [-100, 100] - bool buttons[Joystick::ButtonCount]; //!< Status of each button (true = pressed) + bool connected{false}; //!< Is the joystick currently connected? + float axes[Joystick::AxisCount]{}; //!< Position of each axis, in range [-100, 100] + bool buttons[Joystick::ButtonCount]{}; //!< Status of each button (true = pressed) }; } // namespace priv