diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-28 22:30:41 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-10 00:53:48 -0700 |
| commit | 728663bdc03dfe20343c45ff36f5fb080b49ffec (patch) | |
| tree | f923c81683810d230c594113c0b753fc29b54a80 /Source/Core/DiscIO/VolumeVerifier.cpp | |
| parent | 01d0bdf1bbb4ad3604a6d261b8648b870b1f0131 (diff) | |
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.
Diffstat (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index 5a4a9c6856..8e31eff4eb 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -722,8 +722,7 @@ bool VolumeVerifier::ShouldHaveChannelPartition() const }; static_assert(std::ranges::is_sorted(channel_discs)); - return std::binary_search(channel_discs.cbegin(), channel_discs.cend(), - std::string_view(m_volume.GetGameID())); + return std::ranges::binary_search(channel_discs, m_volume.GetGameID()); } bool VolumeVerifier::ShouldHaveInstallPartition() const @@ -755,8 +754,7 @@ bool VolumeVerifier::ShouldBeDualLayer() const }; static_assert(std::ranges::is_sorted(dual_layer_discs)); - return std::binary_search(dual_layer_discs.cbegin(), dual_layer_discs.cend(), - std::string_view(m_volume.GetGameID())); + return std::ranges::binary_search(dual_layer_discs, m_volume.GetGameID()); } void VolumeVerifier::CheckVolumeSize() |
