From d92c68e1de481b509d92bbdd68f83c9a92f254aa Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:50:23 -0700 Subject: Simplify `std::find_if` with `Common::Contains` --- Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 2737cb22ff..2c59e86f69 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -16,6 +16,7 @@ #include #include +#include "Common/Contains.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Core/ConfigManager.h" @@ -522,10 +523,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos) if (!is_memory_breakpoint) { const auto& inst_breakpoints = m_system.GetPowerPC().GetBreakPoints().GetBreakPoints(); - const auto bp_iter = - std::find_if(inst_breakpoints.begin(), inst_breakpoints.end(), - [bp_address](const auto& bp) { return bp.address == bp_address; }); - if (bp_iter == inst_breakpoints.end()) + if (!Common::Contains(inst_breakpoints, bp_address, &TBreakPoint::address)) return; menu->addAction(tr("Show in Code"), [this, bp_address] { emit ShowCode(bp_address); }); @@ -538,10 +536,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos) else { const auto& memory_breakpoints = m_system.GetPowerPC().GetMemChecks().GetMemChecks(); - const auto mb_iter = - std::find_if(memory_breakpoints.begin(), memory_breakpoints.end(), - [bp_address](const auto& bp) { return bp.start_address == bp_address; }); - if (mb_iter == memory_breakpoints.end()) + if (!Common::Contains(memory_breakpoints, bp_address, &TMemCheck::start_address)) return; menu->addAction(tr("Show in Memory"), [this, bp_address] { emit ShowMemory(bp_address); }); -- cgit v1.2.3