mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-08 15:20:45 +01:00
Modernize std::max_element
with ranges and projections
This commit is contained in:
parent
41c04ded93
commit
8a3b380ded
@ -1538,9 +1538,7 @@ void NetPlayClient::DisplayPlayersPing()
|
||||
|
||||
u32 NetPlayClient::GetPlayersMaxPing() const
|
||||
{
|
||||
return std::max_element(
|
||||
m_players.begin(), m_players.end(),
|
||||
[](const auto& a, const auto& b) { return a.second.ping < b.second.ping; })
|
||||
return std::ranges::max_element(m_players, {}, [](const auto& kv) { return kv.second.ping; })
|
||||
->second.ping;
|
||||
}
|
||||
|
||||
|
@ -1667,11 +1667,8 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
|
||||
if (!assets_data.empty())
|
||||
{
|
||||
const auto calculate_max_levels = [&]() {
|
||||
const auto max_element = std::max_element(
|
||||
assets_data.begin(), assets_data.end(), [](const auto& lhs, const auto& rhs) {
|
||||
return lhs->m_texture.m_slices[0].m_levels.size() <
|
||||
rhs->m_texture.m_slices[0].m_levels.size();
|
||||
});
|
||||
const auto max_element = std::ranges::max_element(
|
||||
assets_data, {}, [](const auto& v) { return v->m_texture.m_slices[0].m_levels.size(); });
|
||||
return (*max_element)->m_texture.m_slices[0].m_levels.size();
|
||||
};
|
||||
const u32 texLevels = no_mips ? 1 : (u32)calculate_max_levels();
|
||||
|
Loading…
Reference in New Issue
Block a user