Boost logo

Boost :

Subject: Re: [boost] Interest in non-intrusive signal/slot lib?
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2015-05-12 06:03:53


On Tue, May 12, 2015 at 11:51 AM, Emil Dotchevski <emildotchevski_at_[hidden]>
wrote:

> On Tue, May 12, 2015 at 1:34 AM, Dominique Devienne <ddevienne_at_[hidden]>
> > Also the fact that you must static_cast from a void* to get back the
> > QPushButton is a little disturbing, when the single type itself never
> > "said" in its signature the emitter has to be a QPushButton. Wouldn't
> such
> > casting also be fraught with dangers in case of multiple or virtual
> > inheritance? Thanks, --DD
> >
>
> Yes, one has to be careful with casting. I'm wondering if it's worth
> storing in the connection object the type of the emitter, which can be
> captured at the time connect is called, if available.
>

In your example, the emiter type is already lost, but yes, being able to do
at least a "safe cast" (i.e. dynamic_cast like) in the meta "slot", or even
better enforce a required emiter type in the signal itself (perhaps
optionally) would go a long way to make Synapse more typesafe, and thus
safer IMHO. My $0.02. Thanks again, --DD


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk