From 542eca6cf6f4a2cd02947ef287436f442dcd9f76 Mon Sep 17 00:00:00 2001 From: romain Date: Wed, 4 Oct 2023 18:31:15 +0200 Subject: [PATCH] NITWORK: Fix any_of include for macos PATCH --- src/Nitwork/ANitwork.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Nitwork/ANitwork.cpp b/src/Nitwork/ANitwork.cpp index 635315c4..07482c0c 100644 --- a/src/Nitwork/ANitwork.cpp +++ b/src/Nitwork/ANitwork.cpp @@ -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); @@ -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; }); } @@ -241,7 +240,7 @@ namespace Nitwork { { std::lock_guard 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; @@ -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; }