Remove std::ranges usage

This commit is contained in:
wheremyfoodat 2024-01-22 14:57:02 +02:00
parent 87b838f1bf
commit 88dc2cc864

View file

@ -2,7 +2,6 @@
#include <boost/container/flat_map.hpp> #include <boost/container/flat_map.hpp>
#include <boost/container/static_vector.hpp> #include <boost/container/static_vector.hpp>
#include <limits> #include <limits>
#include <ranges>
#include "helpers.hpp" #include "helpers.hpp"
#include "logger.hpp" #include "logger.hpp"
@ -33,11 +32,14 @@ struct Scheduler {
} }
void removeEvent(EventType type) { void removeEvent(EventType type) {
auto it = std::ranges::find_if(events, [type](decltype(events)::const_reference pair) { return pair.second == type; }); for (auto it = events.begin(); it != events.end(); it++) {
// Find first event of type "type" and remove it.
if (it != events.end()) { // Our scheduler shouldn't have duplicate events, so it's safe to exit when an event is found
events.erase(it); if (it->second == type) {
updateNextTimestamp(); events.erase(it);
updateNextTimestamp();
break;
}
} }
}; };