mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-01 08:48:35 +00:00
Modernize std::stable_sort
with ranges and projections
This commit is contained in:
parent
8b9f92a0af
commit
c9f589faa5
4 changed files with 13 additions and 27 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue