From fbf9b94913bacfd9310b6ba27da803563545e686 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 28 Sep 2015 15:09:06 +0200 Subject: Fix creation of Notifier with empty argument list ie. Notifier<> foo. --- plugingui/notifier.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugingui/notifier.h b/plugingui/notifier.h index d68e28c..7e6b0d8 100644 --- a/plugingui/notifier.h +++ b/plugingui/notifier.h @@ -64,7 +64,7 @@ public: std::set signals; }; -template +template class Notifier : public NotifierBase { public: Notifier() {} @@ -75,7 +75,7 @@ public: } } - void connect(Listener* object, std::function slot) + void connect(Listener* object, std::function slot) { slots[object] = slot; if(object) { @@ -88,14 +88,14 @@ public: slots.erase(object); } - void notify(T t, Args...args) + void notify(Args...args) { for(auto slot = slots.begin(); slot != slots.end(); ++slot) { - (*slot).second(t, args...); + (*slot).second(args...); } } - std::map> slots; + std::map> slots; }; } // GUI:: @@ -118,7 +118,7 @@ template auto easy_bind(seq, F&& f, Ts&&... vs) -> decltype(std::bind(std::forward(f), std::forward(vs)..., ::placeholder<1 + Is>()...)) { - return std::bind(std::forward(f), std::forward(vs)..., ::placeholder<1 + Is>()...); + return std::bind(std::forward(f), std::forward(vs)..., ::placeholder<1 + Is>()...); } } // aux:: @@ -126,18 +126,18 @@ template auto mem_bind(R (C::*ptmf)(FArgs...), Args&&... vs) -> decltype(aux::easy_bind(gen_seq<(sizeof...(FArgs) + 1) - sizeof...(Args)>(), ptmf, std::forward(vs)...)) { - // the +1s for 'this' argument - static_assert(sizeof...(Args) <= sizeof...(FArgs) + 1, "too many arguments to mem_bind"); - return aux::easy_bind(gen_seq<(sizeof...(FArgs) + 1) - sizeof...(Args)>(), ptmf, std::forward(vs)...); + // the +1s for 'this' argument + static_assert(sizeof...(Args) <= sizeof...(FArgs) + 1, "too many arguments to mem_bind"); + return aux::easy_bind(gen_seq<(sizeof...(FArgs) + 1) - sizeof...(Args)>(), ptmf, std::forward(vs)...); } template auto mem_bind(T C::*ptmd, Args&&... vs) -> decltype(aux::easy_bind(gen_seq<1 - sizeof...(Args)>(), ptmd, std::forward(vs)...)) { - // just 'this' argument - static_assert(sizeof...(Args) <= 1, "too many arguments to mem_bind"); - return aux::easy_bind(gen_seq<1 - sizeof...(Args)>(), ptmd, std::forward(vs)...); + // just 'this' argument + static_assert(sizeof...(Args) <= 1, "too many arguments to mem_bind"); + return aux::easy_bind(gen_seq<1 - sizeof...(Args)>(), ptmd, std::forward(vs)...); } //#define obj_connect_old(SRC, SIG, TAR, SLO) (SRC).SIG.connect(&(TAR), mem_bind(&decltype(TAR)::SLO, TAR)) @@ -146,4 +146,4 @@ auto mem_bind(T C::*ptmd, Args&&... vs) (SRC).SIG.connect(nullptr, SLO) #define obj_connect(SRC, SIG, TAR, SLO) \ - (SRC)->SIG.connect(TAR, mem_bind(&SLO, std::ref(*TAR))) + (SRC)->SIG.connect(TAR, mem_bind(&SLO, std::ref(*TAR))) -- cgit v1.2.3