Add cool new c++ 20 constraint to EventHook.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
5536a6b83d
commit
103c703208
|
@ -7,6 +7,8 @@
|
|||
#include "../../Library/Exceptions/CreatureException.hpp"
|
||||
#include "Events/EventData.hpp"
|
||||
|
||||
template <class T> concept Event = std::is_base_of<CreatureLib::Battling::EventData, T>::value;
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
/// The Event Hook class allows users to write consumers for the battle events, for example to write User Interfaces
|
||||
/// for it.
|
||||
|
@ -39,7 +41,7 @@ namespace CreatureLib::Battling {
|
|||
size_t GetPosition() const noexcept { return _offset; }
|
||||
size_t GetCapacity() const noexcept { return _capacity; }
|
||||
|
||||
template <class T, class... parameters> void Trigger(parameters... args) {
|
||||
template <Event T, class... parameters> void Trigger(parameters... args) {
|
||||
if (_listeners.size() == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace CreatureLib::Battling {
|
|||
|
||||
void DisplayText(const ArbUt::StringView& text);
|
||||
void RegisterEventListener(EventHook::EventHookFunc listener) { this->_eventHook.RegisterListener(listener); }
|
||||
template <class T, class... parameters> void TriggerEventListener(parameters... args) {
|
||||
template <Event T, class... parameters> void TriggerEventListener(parameters... args) {
|
||||
this->_eventHook.Trigger<T>(args...);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue