mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Simplify std::transform
with std::ranges::transform_view
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fmt/ranges.h>
|
#include <fmt/ranges.h>
|
||||||
@ -284,11 +285,10 @@ void ReshapableInput::SaveConfig(Common::IniFile::Section* section,
|
|||||||
50.0);
|
50.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> save_data(m_calibration.size());
|
const std::ranges::transform_view scaled_calibration(
|
||||||
std::transform(
|
m_calibration, [](ControlState val) { return val * CALIBRATION_CONFIG_SCALE; });
|
||||||
m_calibration.begin(), m_calibration.end(), save_data.begin(),
|
section->Set(group + CALIBRATION_CONFIG_NAME,
|
||||||
[](ControlState val) { return fmt::format("{:.2f}", val * CALIBRATION_CONFIG_SCALE); });
|
fmt::format("{:.2f}", fmt::join(scaled_calibration, " ")), "");
|
||||||
section->Set(group + CALIBRATION_CONFIG_NAME, fmt::to_string(fmt::join(save_data, " ")), "");
|
|
||||||
|
|
||||||
// Save center value.
|
// Save center value.
|
||||||
static constexpr char center_format[] = "{:.2f} {:.2f}";
|
static constexpr char center_format[] = "{:.2f} {:.2f}";
|
||||||
|
Reference in New Issue
Block a user