From 78440ca335d4f988092bf524f42fde66a4790abd Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:20:31 -0700 Subject: [PATCH] Modernize `std::reverse` with ranges --- Source/Core/Core/Debugger/PPCDebugInterface.cpp | 2 +- Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp | 2 +- Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 2 +- Source/Core/VideoBackends/OGL/OGLConfig.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp index 786f95bfa7..626e18c067 100644 --- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp @@ -266,7 +266,7 @@ Common::Debug::Threads PPCDebugInterface::GetThreads(const Core::CPUThreadGuard& const u32 prev_addr = active_thread->Data().thread_link.prev; insert_threads(prev_addr, [](const auto& thread) { return thread.Data().thread_link.prev; }); - std::reverse(threads.begin(), threads.end()); + std::ranges::reverse(threads); const u32 next_addr = active_thread->Data().thread_link.next; threads.emplace_back(std::move(active_thread)); diff --git a/Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp b/Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp index ad5e899c1e..9dc3b2ad1c 100644 --- a/Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/MotionPlus.cpp @@ -44,7 +44,7 @@ struct MPI : mbedtls_mpi if (mbedtls_mpi_write_binary(this, out_data->data(), out_data->size())) return false; - std::reverse(out_data->begin(), out_data->end()); + std::ranges::reverse(*out_data); return true; } diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index a0eaa58624..b8547c9de9 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -598,7 +598,7 @@ void BluetoothRealDevice::LoadLinkKeys() } auto& mac = address.value(); - std::reverse(mac.begin(), mac.end()); + std::ranges::reverse(mac); const std::string& key_string = pair.substr(index + 1); linkkey_t key{}; diff --git a/Source/Core/VideoBackends/OGL/OGLConfig.cpp b/Source/Core/VideoBackends/OGL/OGLConfig.cpp index db369a157d..387333b898 100644 --- a/Source/Core/VideoBackends/OGL/OGLConfig.cpp +++ b/Source/Core/VideoBackends/OGL/OGLConfig.cpp @@ -660,7 +660,7 @@ bool PopulateConfig(GLContext* m_main_gl_context) } g_Config.backend_info.AAModes.push_back(1); // The UI wants ascending order - std::reverse(g_Config.backend_info.AAModes.begin(), g_Config.backend_info.AAModes.end()); + std::ranges::reverse(g_Config.backend_info.AAModes); } } else