Skip to content

Commit

Permalink
NITWORK: Fix any_of include for macos
Browse files Browse the repository at this point in the history
PATCH
  • Loading branch information
romainpanno committed Oct 4, 2023
1 parent e669532 commit 542eca6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Nitwork/ANitwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ namespace Nitwork {
return;
}
lock.lock();
std::cout << "Packet received with id : " << header->id << std::endl;
_receivedPacketsIds.push_back(header->id);
lock.unlock();
handlePacketIdsReceived(*header);
Expand All @@ -149,7 +148,7 @@ namespace Nitwork {

bool ANitwork::isAlreadyReceived(n_id_t id)
{
return std::ranges::any_of(_receivedPacketsIds, [id](auto &receivedId) {
return std::any_of(_receivedPacketsIds.begin(), _receivedPacketsIds.end(), [id](auto &receivedId) {
return receivedId == id;
});
}
Expand Down Expand Up @@ -241,7 +240,7 @@ namespace Nitwork {
{
std::lock_guard<std::mutex> lock(_packetsSentMutex);

if (std::ranges::any_of(_packetsSent, [data](auto &packet) {
if (std::any_of(_packetsSent.begin(), _packetsSent.end(), [data](auto &packet) {
return packet.second.id == data.second.id;
})) {
return;
Expand Down Expand Up @@ -275,13 +274,12 @@ namespace Nitwork {
});
lastId = _receivedPacketsIds.back();
for (int i = 0; i < MAX_NB_ACTION; i++) {
isPresent = std::ranges::any_of(_receivedPacketsIds, [lastId, i](auto &id) {
isPresent = std::any_of(_receivedPacketsIds.begin(), _receivedPacketsIds.end(), [lastId, i](auto &id) {
return id == lastId - i;
});
idsReceived = idsReceived << 1;
idsReceived += (isPresent ? 1 : 0);
}
std::cout << "ids received : " << idsReceived << std::endl;
return idsReceived;
}

Expand Down

0 comments on commit 542eca6

Please sign in to comment.