try fix size_t
This commit is contained in:
parent
6f2bc75bfa
commit
dab8ad27be
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user