fix Subscriber
Some checks failed
linux-x64-gcc / linux-gcc (Release) (push) Failing after 58s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 1m24s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 1m31s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m30s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 1m51s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 2m0s

This commit is contained in:
tqcq 2024-04-03 03:34:46 +00:00
parent 2b2a6101b1
commit 8bd904bfb6

View File

@ -97,10 +97,8 @@ private:
class EventBus { class EventBus {
public: public:
class Subscriber : public sigslot::has_slots<> { template<typename mt_policy = sigslot::multi_threaded_local>
public: using Subscriber = sigslot::has_slots<mt_policy>;
virtual ~Subscriber() = default;
};
EventBus() = default; EventBus() = default;
@ -120,7 +118,7 @@ public:
// On<Event1> ([](const Event1 &){}) // On<Event1> ([](const Event1 &){})
template<typename Event, typename C> template<typename Event, typename C>
typename std::enable_if<std::is_base_of<Subscriber, C>::value>::type typename std::enable_if<std::is_base_of<sigslot::has_slots_interface, C>::value>::type
Subscribe(C *instance, void (C::*method)(Event)) Subscribe(C *instance, void (C::*method)(Event))
{ {
{ {
@ -132,7 +130,7 @@ public:
} }
template<typename Event, typename C> template<typename Event, typename C>
typename std::enable_if<std::is_base_of<Subscriber, C>::value>::type Unsubscribe(C *instance) typename std::enable_if<std::is_base_of<sigslot::has_slots_interface, C>::value>::type Unsubscribe(C *instance)
{ {
EventRegistry<Event>::Instance().Unsubscribe(this, instance); EventRegistry<Event>::Instance().Unsubscribe(this, instance);
{ {