Boost logo

Boost Users :

Subject: Re: [Boost-users] [Signals2] Signal disconnect wrapper won't work
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-07-07 16:57:15


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 07 July 2009, Marc DelaCruz wrote:
> Doing the following seems to work.

So it turns out Boost.Bind does return function objects that are equality
comparable, albeit not with the proper semantics for comparison against a
boost::function. However, Boost.Bind also provides undocumented
function_equal overloads which do make comparison against boost::function
objects work. So you can use a boost::bind return value to
disconnect-by-slot, although IMO using signals2::connection objects is still
preferable.

> I have equivalent slots tied to the
> signal and
> needed to disconnect only specific ones. I guess I could force a grouping
> for each added
> slot and disconnect via the grouping.
>
> template<typename T>
> void disconnect (void (T::*pMemFunc)(), T* pObj, VoidSignal& rSig)
> {
> rSig.disconnect(boost::bind(pMemFunc, pObj));
> }
>
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]]On Behalf Of Frank Mori Hess
> Sent: Tuesday, July 07, 2009 10:31 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [Signals2] Signal disconnect wrapper won't
> work

> I don't
> believe the function objects returned by bind are either. The best
> workaround would be to not use disconnect-by-slot at all and use the
> connection object returned by the connect call to disconnect.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpTtqwACgkQ5vihyNWuA4Ul5QCffTidOo2dPMGANu67sex0ZX3V
X4sAoOFgy3ZY+pawBzC+e0SGHL3505ew
=+AOn
-----END PGP SIGNATURE-----


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