try fix size_t

This commit is contained in:
Green Sky 2023-07-25 16:21:53 +02:00
parent 6f2bc75bfa
commit 92eee153f2
No known key found for this signature in database

View File

@ -2,6 +2,7 @@
#include <array>
#include <vector>
#include <cstddef>
template<typename EventI>
struct EventProviderI {
@ -11,13 +12,13 @@ struct EventProviderI {
// TODO: unsub
virtual void subscribe(EventI* object, const enumType event_type) {
_subscribers.at(size_t(event_type)).push_back(object);
_subscribers.at(static_cast<size_t>(event_type)).push_back(object);
}
protected:
template<typename T>
bool dispatch(enumType event_type, const T& event) {
for (auto* zei : _subscribers.at(size_t(event_type))) {
for (auto* zei : _subscribers.at(static_cast<size_t>(event_type))) {
if (zei->onEvent(event)) {
return true;
}
@ -28,7 +29,7 @@ struct EventProviderI {
protected:
std::array<
std::vector<EventI*>,
size_t(enumType::MAX)
static_cast<size_t>(enumType::MAX)
> _subscribers;
};