Skip to content

Commit

Permalink
Fix: A lambda has been passed to sort to eliminate reverse call
Browse files Browse the repository at this point in the history
  • Loading branch information
CRAFTSTARCN authored and hyv1001 committed Apr 5, 2022
1 parent 38fac3a commit a1f5382
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,11 @@ void Pilot::PVulkanContext::initializePhysicalDevice()
ranked_physical_devices.push_back({score, device});
}

std::sort(ranked_physical_devices.begin(), ranked_physical_devices.end());
std::reverse(ranked_physical_devices.begin(), ranked_physical_devices.end());
std::sort(ranked_physical_devices.begin(),
ranked_physical_devices.end(),
[](const std::pair<int, VkPhysicalDevice>& p1, const std::pair<int, VkPhysicalDevice>& p2) {
return p1 > p2;
});

for (const auto& device : ranked_physical_devices)
{
Expand Down

0 comments on commit a1f5382

Please sign in to comment.