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