mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 12:48:57 +00:00
Modernize std::find_if
with ranges
In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile.
This commit is contained in:
parent
6ca7e2856b
commit
e4fb837f4b
24 changed files with 60 additions and 72 deletions
|
@ -162,10 +162,9 @@ void GekkoSyntaxHighlight::highlightBlock(const QString& text)
|
|||
}
|
||||
else if (m_mode == 1)
|
||||
{
|
||||
auto paren_it = std::find_if(info->parens.begin(), info->parens.end(),
|
||||
[this](const std::pair<int, int>& p) {
|
||||
return p.first == m_cursor_loc || p.second == m_cursor_loc;
|
||||
});
|
||||
auto paren_it = std::ranges::find_if(info->parens, [this](const std::pair<int, int>& p) {
|
||||
return p.first == m_cursor_loc || p.second == m_cursor_loc;
|
||||
});
|
||||
if (paren_it != info->parens.end())
|
||||
{
|
||||
HighlightSubstr(paren_it->first, 1, HighlightFormat::Paren);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue