Include <algorithm> - required for 'lower_bound'

This commit is contained in:
Audun Foyen 2021-07-31 21:56:31 +02:00
parent 8a79663fa0
commit bf0b598908

View File

@ -1,6 +1,8 @@
#include "configuration.h" #include "configuration.h"
#include "MeshPacketQueue.h" #include "MeshPacketQueue.h"
#include <algorithm>
/// @return the priority of the specified packet /// @return the priority of the specified packet
inline uint32_t getPriority(const MeshPacket *p) inline uint32_t getPriority(const MeshPacket *p)
{ {
@ -77,7 +79,7 @@ MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id)
auto p = (*it); auto p = (*it);
if (getFrom(p) == from && p->id == id) { if (getFrom(p) == from && p->id == id) {
queue.erase(it); queue.erase(it);
make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc); std::make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc);
return p; return p;
} }
} }
@ -109,6 +111,6 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(MeshPacket *p) {
*low = p; // replace low-pri packet at this position with incoming packet with higher priority *low = p; // replace low-pri packet at this position with incoming packet with higher priority
} }
make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc); std::make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc);
return true; return true;
} }