mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Modernize std::transform
with ranges
In StringUtil.h, the lambdas wrapping `Common::ToLower(char)` and `Common::ToUpper(char)` were only necessary due to the function names being overloaded.
This commit is contained in:
parent
7ce170f138
commit
72436a0d1f
@ -655,12 +655,12 @@ std::string GetEscapedHtml(std::string html)
|
||||
|
||||
void ToLower(std::string* str)
|
||||
{
|
||||
std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToLower(c); });
|
||||
std::ranges::transform(*str, str->begin(), static_cast<char (&)(char)>(Common::ToLower));
|
||||
}
|
||||
|
||||
void ToUpper(std::string* str)
|
||||
{
|
||||
std::transform(str->begin(), str->end(), str->begin(), [](char c) { return Common::ToUpper(c); });
|
||||
std::ranges::transform(*str, str->begin(), static_cast<char (&)(char)>(Common::ToUpper));
|
||||
}
|
||||
|
||||
bool CaseInsensitiveEquals(std::string_view a, std::string_view b)
|
||||
|
@ -70,7 +70,7 @@ CameraLogic::GetCameraPoints(const Common::Matrix44& transform, Common::Vec2 fie
|
||||
|
||||
std::array<CameraPoint, CameraLogic::NUM_POINTS> camera_points;
|
||||
|
||||
std::transform(leds.begin(), leds.end(), camera_points.begin(), [&](const Vec3& v) {
|
||||
std::ranges::transform(leds, camera_points.begin(), [&](const Vec3& v) {
|
||||
const auto point = camera_view * Vec4(v, 1.0);
|
||||
|
||||
// Check if LED is behind camera.
|
||||
|
@ -130,8 +130,7 @@ void InterfacePane::CreateUI()
|
||||
Common::DoFileSearch({File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR});
|
||||
std::vector<std::string> theme_names;
|
||||
theme_names.reserve(theme_paths.size());
|
||||
std::transform(theme_paths.cbegin(), theme_paths.cend(), std::back_inserter(theme_names),
|
||||
PathToFileName);
|
||||
std::ranges::transform(theme_paths, std::back_inserter(theme_names), PathToFileName);
|
||||
|
||||
// Theme Combobox
|
||||
m_combobox_theme = new ConfigStringChoice(theme_names, Config::MAIN_THEME_NAME);
|
||||
|
@ -143,8 +143,8 @@ void ToolBar::MakeActions()
|
||||
}
|
||||
|
||||
std::vector<int> widths;
|
||||
std::transform(items.begin(), items.end(), std::back_inserter(widths),
|
||||
[](QWidget* item) { return item->sizeHint().width(); });
|
||||
std::ranges::transform(items, std::back_inserter(widths),
|
||||
[](QWidget* item) { return item->sizeHint().width(); });
|
||||
|
||||
const int min_width = *std::max_element(widths.begin(), widths.end()) * 0.85;
|
||||
for (QWidget* widget : items)
|
||||
|
Loading…
Reference in New Issue
Block a user