Skip to content

Commit

Permalink
Modernize std::partition with ranges
Browse files Browse the repository at this point in the history
The new return value is `std::ranges::subrange`.
  • Loading branch information
mitaclaw committed Oct 1, 2024
1 parent a12a9af commit a26cca0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Core/IOS/Network/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,10 +1085,10 @@ void WiiSockMan::UpdatePollCommands()
std::vector<int> original_order(pfds.size());
std::iota(original_order.begin(), original_order.end(), 0);
// Select indices with valid fds
auto mid = std::partition(original_order.begin(), original_order.end(), [&](auto i) {
const auto partition_result = std::ranges::partition(original_order, [&](auto i) {
return GetHostSocket(memory.Read_U32(pcmd.buffer_out + 0xc * i)) >= 0;
});
const auto n_valid = std::distance(original_order.begin(), mid);
const auto n_valid = std::distance(original_order.begin(), partition_result.begin());

// Move all the valid pollfds to the front of the vector
for (auto i = 0; i < n_valid; ++i)
Expand Down

0 comments on commit a26cca0

Please sign in to comment.