mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 07:05:40 +12:00
Remove std::ranges usage
This commit is contained in:
parent
87b838f1bf
commit
88dc2cc864
1 changed files with 8 additions and 6 deletions
|
@ -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
|
||||||
|
if (it->second == type) {
|
||||||
events.erase(it);
|
events.erase(it);
|
||||||
updateNextTimestamp();
|
updateNextTimestamp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue