summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
diff options
context:
space:
mode:
authormitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-09-28 22:20:48 -0700
committermitaclaw <140017135+mitaclaw@users.noreply.github.com>2025-03-09 13:26:38 -0700
commitc9f589faa532105c24f4f6343cadc7f882e251a5 (patch)
treeb481b7d429ac379ee64378dbc697e99e75ada8d2 /Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
parent8b9f92a0af0f467ffa0bde5f4e6239e57fbd4b5e (diff)
Modernize `std::stable_sort` with ranges and projections
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
index 792d78d9b0..696ff60d47 100644
--- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
@@ -433,13 +433,9 @@ void CodeViewWidget::CalculateBranchIndentation()
// process in order of how much vertical space the drawn arrow would take up
// so shorter arrows go further to the left
- const auto priority = [](const CodeViewBranch& b) {
+ std::ranges::stable_sort(m_branches, {}, [](const CodeViewBranch& b) {
return b.is_link ? 0 : (std::max(b.src_addr, b.dst_addr) - std::min(b.src_addr, b.dst_addr));
- };
- std::stable_sort(m_branches.begin(), m_branches.end(),
- [&priority](const CodeViewBranch& lhs, const CodeViewBranch& rhs) {
- return priority(lhs) < priority(rhs);
- });
+ });
// build a 2D lookup table representing the columns and rows the arrow could be drawn in
// and try to place all branch arrows in it as far left as possible