diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-21 18:09:34 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-10 15:28:11 -0700 |
| commit | e4fb837f4bf886e9688ea3c12e081a2d7b4e6a75 (patch) | |
| tree | 1b16603454de34fd05e2ac49a9ba4d8cdfcb3260 /Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | |
| parent | 6ca7e2856bd704a687e8408bf7ed92b23672c7fa (diff) | |
Modernize `std::find_if` with ranges
In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile.
Diffstat (limited to 'Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index e33ba4c214..09cc7edb71 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <bit> +#include <ranges> #include <QGroupBox> #include <QHBoxLayout> @@ -472,9 +473,8 @@ void FIFOAnalyzer::FindNext() const int index = m_detail_list->currentRow(); ASSERT(index >= 0); - auto next_result = - std::find_if(m_search_results.begin(), m_search_results.end(), - [index](auto& result) { return result.m_cmd > static_cast<u32>(index); }); + auto next_result = std::ranges::find_if( + m_search_results, [index](auto& result) { return result.m_cmd > static_cast<u32>(index); }); if (next_result != m_search_results.end()) { ShowSearchResult(next_result - m_search_results.begin()); @@ -487,8 +487,9 @@ void FIFOAnalyzer::FindPrevious() ASSERT(index >= 0); auto prev_result = - std::find_if(m_search_results.rbegin(), m_search_results.rend(), - [index](auto& result) { return result.m_cmd < static_cast<u32>(index); }); + std::ranges::find_if(m_search_results | std::views::reverse, [index](auto& result) { + return result.m_cmd < static_cast<u32>(index); + }); if (prev_result != m_search_results.rend()) { ShowSearchResult((m_search_results.rend() - prev_result) - 1); |
