diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-29 10:44:23 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-09 17:26:10 -0700 |
| commit | e6f93efac4c47c9281c98ad426e54e6fa5e4b0c7 (patch) | |
| tree | ddc060219b26b53606cb957fa1745dc783044c4f /Source/Core/InputCommon/ControllerEmu | |
| parent | 809766a4391b7f7b30d65804ae22a0f3e0c8a1cc (diff) | |
Simplify `std::transform` with `std::ranges::transform_view`
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 4edc07fd02..2c82788b99 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <cmath> +#include <ranges> #include <fmt/format.h> #include <fmt/ranges.h> @@ -284,11 +285,10 @@ void ReshapableInput::SaveConfig(Common::IniFile::Section* section, 50.0); } - std::vector<std::string> save_data(m_calibration.size()); - std::transform( - m_calibration.begin(), m_calibration.end(), save_data.begin(), - [](ControlState val) { return fmt::format("{:.2f}", val * CALIBRATION_CONFIG_SCALE); }); - section->Set(group + CALIBRATION_CONFIG_NAME, fmt::to_string(fmt::join(save_data, " ")), ""); + const std::ranges::transform_view scaled_calibration( + m_calibration, [](ControlState val) { return val * CALIBRATION_CONFIG_SCALE; }); + section->Set(group + CALIBRATION_CONFIG_NAME, + fmt::format("{:.2f}", fmt::join(scaled_calibration, " ")), ""); // Save center value. static constexpr char center_format[] = "{:.2f} {:.2f}"; |
