From 728663bdc03dfe20343c45ff36f5fb080b49ffec Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 28 Sep 2024 22:30:41 -0700 Subject: Modernize `std::binary_search` with ranges In VolumeVerifier.cpp, constructing a `std::string_view` of the volume's GameID is unnecessary, as `std::`(`ranges::`)`binary_search` supports heterogeneous lookup. The usage in GameFile.cpp is a perfect example. --- Source/Core/UICommon/GameFile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Source/Core/UICommon/GameFile.cpp') diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp index 9151aec796..5c32c511df 100644 --- a/Source/Core/UICommon/GameFile.cpp +++ b/Source/Core/UICommon/GameFile.cpp @@ -616,8 +616,7 @@ bool GameFile::CheckIfTwoDiscGame(const std::string& game_id) const static_assert(std::ranges::is_sorted(two_disc_game_id_prefixes)); std::string_view game_id_prefix(game_id.data(), GAME_ID_PREFIX_SIZE); - return std::binary_search(two_disc_game_id_prefixes.begin(), two_disc_game_id_prefixes.end(), - game_id_prefix); + return std::ranges::binary_search(two_disc_game_id_prefixes, game_id_prefix); } std::string GameFile::GetNetPlayName(const Core::TitleDatabase& title_database) const -- cgit v1.2.3