diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-29 11:19:05 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-10 00:53:48 -0700 |
| commit | ebf7cebc32ac9af28dc2383192b7b14f7aea134f (patch) | |
| tree | 792a436fe69984534ba5cc17544ad16722ce4e80 /Source/Core/DiscIO/DirectoryBlob.cpp | |
| parent | bcaf665d14c5e20ecc88a8978df19ca73e0e29fc (diff) | |
Modernize `std::sort` with ranges
Diffstat (limited to 'Source/Core/DiscIO/DirectoryBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index 7cd7e12def..b9e8b89dd4 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -624,16 +624,15 @@ void DirectoryBlobReader::SetWiiRegionData(const std::vector<u8>& wii_region_dat void DirectoryBlobReader::SetPartitions(std::vector<PartitionWithType>&& partitions) { - std::sort(partitions.begin(), partitions.end(), - [](const PartitionWithType& lhs, const PartitionWithType& rhs) { - if (lhs.type == rhs.type) - return lhs.partition.GetRootDirectory() < rhs.partition.GetRootDirectory(); - - // Ascending sort by partition type, except Update (1) comes before before Game (0) - return (lhs.type > PartitionType::Update || rhs.type > PartitionType::Update) ? - lhs.type < rhs.type : - lhs.type > rhs.type; - }); + std::ranges::sort(partitions, [](const PartitionWithType& lhs, const PartitionWithType& rhs) { + if (lhs.type == rhs.type) + return lhs.partition.GetRootDirectory() < rhs.partition.GetRootDirectory(); + + // Ascending sort by partition type, except Update (1) comes before before Game (0) + return (lhs.type > PartitionType::Update || rhs.type > PartitionType::Update) ? + lhs.type < rhs.type : + lhs.type > rhs.type; + }); u32 subtable_1_size = 0; while (subtable_1_size < partitions.size() && subtable_1_size < 3 && |
