Boost logo

Boost :

Subject: Re: [boost] Interest in non-intrusive signal/slot lib?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-20 11:32:51

Edward Diener wrote:
> This is similar to the way in the signals2 library that one has to have
> access to a boost::signals2::signal in order to setup a connection to a
> slot. So while I like your library I do not immediately understand the
> advantage it has over signals2.

When you already have an existing third-party object (say, XButton) it's
more convenient to not have to think where to place the corresponding signal
object. Non-intrusive dispatch is kind of like the library containing the
equivalent of map<void*, signal>, automatically managing the signal objects
corresponding to an external, third-party, object.

In the use case in which you define your buttons, there's not much to gain,
you make them contain your signal objects. But third-party buttons don't
contain your signal objects, they contain their own functionality for
notifying you of events, sometimes that's (their own) signal implementation,
sometimes a callback/std::function, sometimes you need to override a virtual
method, sometimes they send you messages. With a non-intrusive signal
library, you just attach an emit call to the third-party notification
mechanism and the rest of the code can connect to the non-intrusive signal.
This avoids the need to wrap the external objects in your own types that
contain signal objects.

Boost list run by bdawes at, gregod at, cpdaniel at, john at