Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <hash_type Hash>
- constexpr bool checkRegistered()
- {
- return false;
- }
- #define REGISTER_EVENT_TYPE(type) \
- template <> \
- constexpr bool checkRegistered<type##_sid>() \
- { \
- return true; \
- } \
- REGISTER_EVENT_TYPE("LevelChangedEvent")
- template <hash_type EventType>
- void queueEvent()
- {
- static_assert(checkRegistered<EventType>(), "Can't queue unregistered type");
- ...
- }
- template <hash_type EventType>
- void triggerEvent()
- {
- static_assert(checkRegistered<EventType>(), "Can't trigger unregistered type");
- ...
- }
- // call function like this:
- queueEvent<"HpChangedEvent"_sid>();
Advertisement
Add Comment
Please, Sign In to add comment