Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::signal2 for generic event handling with overloaded methods
From: Igor R (boost.lists_at_[hidden])
Date: 2011-10-15 11:50:19


<...>
> struct Event {};
> struct ID {};
> struct OneSecondElapsedEvent : public Event
> {
> static ID id;
> };
> struct UpdatePresentationTracksReqEvent : public Event
> {
> UpdatePresentationTracksReqEvent() {};
> static ID id;
> };
> typedef boost::signals2::signal<void (Event*)> signal_t;
> typedef signal_t::slot_type slot_t;
<...>
> In the constructor I tried to "connect" the function
> "Handle(OneSecondElapsedEvent*)" to the slot but I cannot to this..the
> compiler write errors sayng that cannot connvert from "Event*" to
> "OneSecondElapsedEvent*".
> Is there any solution to make it working?

So, long story short, you try to connect a slot with signature
<void(Derived *)> to a signal<void(Base *)>, don't you? This won't
work, of course.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net